Merge pull request #10080 from rohitwaghchaure/hotfix

[Fix] Negative amount showing in the grand total for multicurrency if discount has applied
This commit is contained in:
Saurabh 2017-07-25 15:43:00 +05:30 committed by GitHub
commit 6436b9d089

View File

@ -40,8 +40,10 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
}, },
calculate_discount_amount: function(){ calculate_discount_amount: function(){
if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount")) if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount")) {
this.set_discount_amount();
this.apply_discount_amount(); this.apply_discount_amount();
}
}, },
_calculate_taxes_and_totals: function() { _calculate_taxes_and_totals: function() {
@ -451,6 +453,13 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
} }
}, },
set_discount_amount: function() {
if(this.frm.doc.additional_discount_percentage) {
this.frm.doc.discount_amount = flt(flt(this.frm.doc[frappe.scrub(this.frm.doc.apply_discount_on)])
* this.frm.doc.additional_discount_percentage / 100, precision("discount_amount"));
}
},
apply_discount_amount: function() { apply_discount_amount: function() {
var me = this; var me = this;
var distributed_amount = 0.0; var distributed_amount = 0.0;