Skip to content

Commit

Permalink
fix: apply discount on item after applying price list (#36125)
Browse files Browse the repository at this point in the history
(cherry picked from commit bde9e89)

# Conflicts:
#	erpnext/public/js/controllers/transaction.js
#	erpnext/selling/sales_common.js
  • Loading branch information
anandbaburajan authored and mergify[bot] committed Jul 25, 2023
1 parent 2c1943c commit ab1a7c9
Show file tree
Hide file tree
Showing 2 changed files with 523 additions and 0 deletions.
17 changes: 17 additions & 0 deletions erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,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({
Expand Down Expand Up @@ -1661,6 +1675,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; }
Expand Down
Loading

0 comments on commit ab1a7c9

Please sign in to comment.