Merge pull request #28656 from UmakanthKaspa/fix/no-copy-child-duplicate

Fix: Exclude "No Copy" Fields in Child Table Duplication
This commit is contained in:
Akhil Narang 2024-12-04 16:09:19 +05:30 committed by GitHub
commit bd42b5df9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -881,20 +881,25 @@ export default class Grid {
}
duplicate_row(d, copy_doc) {
const noCopyFields = new Set([
"creation",
"modified",
"modified_by",
"idx",
"owner",
"parent",
"doctype",
"name",
"parentfield",
]);
const docfields = frappe.get_meta(this.doctype).fields || [];
$.each(docfields, function (_index, df) {
if (cint(df.no_copy)) noCopyFields.add(df.fieldname);
});
$.each(copy_doc, function (key, value) {
if (
![
"creation",
"modified",
"modified_by",
"idx",
"owner",
"parent",
"doctype",
"name",
"parentfield",
].includes(key)
) {
if (!noCopyFields.has(key)) {
d[key] = value;
}
});