diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index cfbb54ab2d00..f71211b88263 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -969,7 +969,21 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.frm.set_df_property("conversion_rate", "read_only", erpnext.stale_rate_allowed() ? 0 : 1); } +<<<<<<< HEAD shipping_rule() { +======= + apply_discount_on_item: function(doc, cdt, cdn, field) { + var item = frappe.get_doc(cdt, cdn); + if(!item.price_list_rate) { + item[field] = 0.0; + } else { + this.price_list_rate(doc, cdt, cdn); + } + this.set_gross_profit(item); + }, + + shipping_rule: function() { +>>>>>>> bde9e89582 (fix: apply discount on item after applying price list (#36125)) var me = this; if(this.frm.doc.shipping_rule) { return this.frm.call({ @@ -1639,6 +1653,9 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe () => { if(args.items.length) { me._set_values_for_item_list(r.message.children); + $.each(r.message.children || [], function(i, d) { + me.apply_discount_on_item(d, d.doctype, d.name, 'discount_percentage'); + }); } }, () => { me.in_apply_price_list = false; } diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index e3de49c57d81..0f6b330cbf84 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -145,6 +145,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran this.apply_discount_on_item(doc, cdt, cdn, 'discount_amount'); } +<<<<<<< HEAD apply_discount_on_item(doc, cdt, cdn, field) { var item = frappe.get_doc(cdt, cdn); if(!item.price_list_rate) { @@ -156,6 +157,9 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran } commission_rate() { +======= + commission_rate: function() { +>>>>>>> bde9e89582 (fix: apply discount on item after applying price list (#36125)) this.calculate_commission(); }