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:
commit
bd42b5df9f
1 changed files with 18 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue