Przeglądaj źródła

Merge pull request #3570 from pratu16x7/add-child-clone-fix

[fix] Allow for cloning other children
version-14
Makarand Bauskar 8 lat temu
committed by GitHub
rodzic
commit
3c58a54a8d
1 zmienionych plików z 11 dodań i 1 usunięć
  1. +11
    -1
      frappe/public/js/legacy/clientscriptAPI.js

+ 11
- 1
frappe/public/js/legacy/clientscriptAPI.js Wyświetl plik

@@ -248,7 +248,17 @@ _f.Frm.prototype.clear_table = function(fieldname) {
_f.Frm.prototype.add_child = function(fieldname, values) {
var doc = frappe.model.add_child(this.doc, frappe.meta.get_docfield(this.doctype, fieldname).options, fieldname);
if(values) {
$.extend(doc, values);
// Values of unique keys should not be overridden
var d = {};
var unique_keys = ["idx", "name"];

Object.keys(values).map((key) => {
if(!unique_keys.includes(key)) {
d[key] = values[key];
}
});

$.extend(doc, d);
}
return doc;
}


Ładowanie…
Anuluj
Zapisz