fix: rate changed on changing of the qty

This commit is contained in:
Rohit Waghchaure
2024-03-27 13:29:22 +05:30
parent 1b0f95088a
commit cd36a1051f

View File

@@ -1249,19 +1249,20 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
this.frm.fields_dict.items.grid.toggle_enable("conversion_factor", this.frm.fields_dict.items.grid.toggle_enable("conversion_factor",
((item.uom != item.stock_uom) && !frappe.meta.get_docfield(cur_frm.fields_dict.items.grid.doctype, "conversion_factor").read_only)? true: false); ((item.uom != item.stock_uom) && !frappe.meta.get_docfield(cur_frm.fields_dict.items.grid.doctype, "conversion_factor").read_only)? true: false);
} }
} }
qty(doc, cdt, cdn) { qty(doc, cdt, cdn) {
let item = frappe.get_doc(cdt, cdn); if (!this.frm.doc.__onload?.load_after_mapping) {
// item.pricing_rules = '' let item = frappe.get_doc(cdt, cdn);
frappe.run_serially([ // item.pricing_rules = ''
() => this.remove_pricing_rule_for_item(item), frappe.run_serially([
() => this.conversion_factor(doc, cdt, cdn, true), () => this.remove_pricing_rule_for_item(item),
() => this.apply_price_list(item, true), //reapply price list before applying pricing rule () => this.conversion_factor(doc, cdt, cdn, true),
() => this.calculate_stock_uom_rate(doc, cdt, cdn), () => this.apply_price_list(item, true), //reapply price list before applying pricing rule
() => this.apply_pricing_rule(item, true) () => this.calculate_stock_uom_rate(doc, cdt, cdn),
]); () => this.apply_pricing_rule(item, true)
]);
}
} }
stock_qty(doc, cdt, cdn) { stock_qty(doc, cdt, cdn) {