fix: Revert #frappe/erpnext/17896 (#18251)
This commit is contained in:
parent
c32e287441
commit
fca86c48c8
@ -573,7 +573,6 @@ erpnext.utils.map_current_doc = function(opts) {
|
|||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
var doc = frappe.model.sync(r.message);
|
var doc = frappe.model.sync(r.message);
|
||||||
cur_frm.dirty();
|
cur_frm.dirty();
|
||||||
erpnext.utils.clear_duplicates();
|
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -604,28 +603,6 @@ erpnext.utils.map_current_doc = function(opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
erpnext.utils.clear_duplicates = function() {
|
|
||||||
if(!cur_frm.doc.items) return;
|
|
||||||
const unique_items = new Map();
|
|
||||||
/*
|
|
||||||
Create a Map of items with
|
|
||||||
item_code => [qty, warehouse, batch_no]
|
|
||||||
*/
|
|
||||||
let items = [];
|
|
||||||
|
|
||||||
for (let item of cur_frm.doc.items) {
|
|
||||||
if (!(unique_items.has(item.item_code) && unique_items.get(item.item_code)[0] === item.qty &&
|
|
||||||
unique_items.get(item.item_code)[1] === item.warehouse && unique_items.get(item.item_code)[2] === item.batch_no &&
|
|
||||||
unique_items.get(item.item_code)[3] === item.delivery_date && unique_items.get(item.item_code)[4] === item.required_date &&
|
|
||||||
unique_items.get(item.item_code)[5] === item.rate)) {
|
|
||||||
|
|
||||||
unique_items.set(item.item_code, [item.qty, item.warehouse, item.batch_no, item.delivery_date, item.required_date, item.rate]);
|
|
||||||
items.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cur_frm.doc.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.form.link_formatters['Item'] = function(value, doc) {
|
frappe.form.link_formatters['Item'] = function(value, doc) {
|
||||||
if(doc && doc.item_name && doc.item_name !== value) {
|
if(doc && doc.item_name && doc.item_name !== value) {
|
||||||
return value? value + ': ' + doc.item_name: doc.item_name;
|
return value? value + ': ' + doc.item_name: doc.item_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user