feat: uom in update items for SO & PO (#22869)
* feat: uom in update items for SO & PO * fix: supplied items doesn't updates on uom change * chore: add uom and conv factor change test * fix: test * fix: purchase order updates are not tracked * fix: fetch conversion factor on uom change * fix: codacy Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
@@ -466,6 +466,33 @@ erpnext.utils.update_child_items = function(opts) {
|
||||
read_only: 0,
|
||||
disabled: 0,
|
||||
label: __('Item Code')
|
||||
}, {
|
||||
fieldtype:'Link',
|
||||
fieldname:'uom',
|
||||
options: 'UOM',
|
||||
read_only: 0,
|
||||
label: __('UOM'),
|
||||
reqd: 1,
|
||||
onchange: function () {
|
||||
frappe.call({
|
||||
method: "erpnext.stock.get_item_details.get_conversion_factor",
|
||||
args: { item_code: this.doc.item_code, uom: this.value },
|
||||
callback: r => {
|
||||
if(!r.exc) {
|
||||
if (this.doc.conversion_factor == r.message.conversion_factor) return;
|
||||
|
||||
const docname = this.doc.docname;
|
||||
dialog.fields_dict.trans_items.df.data.some(doc => {
|
||||
if (doc.docname == docname) {
|
||||
doc.conversion_factor = r.message.conversion_factor;
|
||||
dialog.fields_dict.trans_items.grid.refresh();
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
fieldtype:'Float',
|
||||
fieldname:"qty",
|
||||
@@ -546,6 +573,7 @@ erpnext.utils.update_child_items = function(opts) {
|
||||
"conversion_factor": d.conversion_factor,
|
||||
"qty": d.qty,
|
||||
"rate": d.rate,
|
||||
"uom": d.uom
|
||||
});
|
||||
this.data = dialog.fields_dict.trans_items.df.data;
|
||||
dialog.fields_dict.trans_items.grid.refresh();
|
||||
|
||||
Reference in New Issue
Block a user