fix: update fields on change of item code In Update Items of Sales Order (#45125)
* fix: update fields on change of item code
* fix: minor update
* fix: set the new values always
* Revert "fix: set the new values always"
This reverts commit 44daa0a641.
---------
Co-authored-by: Sanket322 <shahsanket322003.com>
Co-authored-by: ruthra kumar <ruthra@erpnext.com>
This commit is contained in:
@@ -668,6 +668,62 @@ erpnext.utils.update_child_items = function (opts) {
|
|||||||
filters: filters,
|
filters: filters,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
onchange: function () {
|
||||||
|
const me = this;
|
||||||
|
|
||||||
|
frm.call({
|
||||||
|
method: "erpnext.stock.get_item_details.get_item_details",
|
||||||
|
args: {
|
||||||
|
doc: frm.doc,
|
||||||
|
ctx: {
|
||||||
|
item_code: this.value,
|
||||||
|
set_warehouse: frm.doc.set_warehouse,
|
||||||
|
customer: frm.doc.customer || frm.doc.party_name,
|
||||||
|
quotation_to: frm.doc.quotation_to,
|
||||||
|
supplier: frm.doc.supplier,
|
||||||
|
currency: frm.doc.currency,
|
||||||
|
is_internal_supplier: frm.doc.is_internal_supplier,
|
||||||
|
is_internal_customer: frm.doc.is_internal_customer,
|
||||||
|
conversion_rate: frm.doc.conversion_rate,
|
||||||
|
price_list: frm.doc.selling_price_list || frm.doc.buying_price_list,
|
||||||
|
price_list_currency: frm.doc.price_list_currency,
|
||||||
|
plc_conversion_rate: frm.doc.plc_conversion_rate,
|
||||||
|
company: frm.doc.company,
|
||||||
|
order_type: frm.doc.order_type,
|
||||||
|
is_pos: cint(frm.doc.is_pos),
|
||||||
|
is_return: cint(frm.doc.is_return),
|
||||||
|
is_subcontracted: frm.doc.is_subcontracted,
|
||||||
|
ignore_pricing_rule: frm.doc.ignore_pricing_rule,
|
||||||
|
doctype: frm.doc.doctype,
|
||||||
|
name: frm.doc.name,
|
||||||
|
qty: me.doc.qty || 1,
|
||||||
|
uom: me.doc.uom,
|
||||||
|
pos_profile: cint(frm.doc.is_pos) ? frm.doc.pos_profile : "",
|
||||||
|
tax_category: frm.doc.tax_category,
|
||||||
|
child_doctype: frm.doc.doctype + " Item",
|
||||||
|
is_old_subcontracting_flow: frm.doc.is_old_subcontracting_flow,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
callback: function (r) {
|
||||||
|
if (r.message) {
|
||||||
|
const { qty, price_list_rate: rate, uom, conversion_factor } = r.message;
|
||||||
|
|
||||||
|
const row = dialog.fields_dict.trans_items.df.data.find(
|
||||||
|
(doc) => doc.idx == me.doc.idx
|
||||||
|
);
|
||||||
|
if (row) {
|
||||||
|
Object.assign(row, {
|
||||||
|
conversion_factor: me.doc.conversion_factor || conversion_factor,
|
||||||
|
uom: me.doc.uom || uom,
|
||||||
|
qty: me.doc.qty || qty,
|
||||||
|
rate: me.doc.rate || rate,
|
||||||
|
});
|
||||||
|
dialog.fields_dict.trans_items.grid.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: "Link",
|
fieldtype: "Link",
|
||||||
|
|||||||
Reference in New Issue
Block a user