Merge pull request #6153 from rohitwaghchaure/hotfix

[POS] Fixed decimal button not working
This commit is contained in:
Nabin Hait 2016-08-23 12:07:40 +05:30 committed by GitHub
commit f862505bf9
2 changed files with 10 additions and 9 deletions

View File

@ -471,7 +471,8 @@ class calculate_taxes_and_totals(object):
def calculate_write_off_amount(self): def calculate_write_off_amount(self):
if flt(self.doc.change_amount) > 0: if flt(self.doc.change_amount) > 0:
self.doc.write_off_amount = self.doc.grand_total - self.doc.paid_amount + self.doc.change_amount self.doc.write_off_amount = flt(self.doc.grand_total - self.doc.paid_amount + self.doc.change_amount,
self.doc.precision("write_off_amount"))
self.doc.base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate, self.doc.base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate,
self.doc.precision("base_write_off_amount")) self.doc.precision("base_write_off_amount"))

View File

@ -112,15 +112,15 @@ erpnext.payments = erpnext.stock.StockController.extend({
$(this.$body).find('.form-control').click(function(){ $(this.$body).find('.form-control').click(function(){
me.idx = $(this).attr("idx"); me.idx = $(this).attr("idx");
me.set_outstanding_amount(); me.set_outstanding_amount();
me.update_paid_amount(); me.update_paid_amount(true);
}) })
$(this.$body).find('.write_off_amount').change(function(){ $(this.$body).find('.write_off_amount').change(function(){
me.write_off_amount(flt($(this).val())); me.write_off_amount(flt($(this).val()), precision("write_off_amount"));
}) })
$(this.$body).find('.change_amount').change(function(){ $(this.$body).find('.change_amount').change(function(){
me.change_amount(flt($(this).val())); me.change_amount(flt($(this).val()), precision("change_amount"));
}) })
}, },
@ -139,7 +139,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
me.payment_val += $(this).text(); me.payment_val += $(this).text();
me.selected_mode.val(format_number(me.payment_val, 2)) me.selected_mode.val(format_number(me.payment_val, 2))
me.idx = me.selected_mode.attr("idx") me.idx = me.selected_mode.attr("idx")
me.selected_mode.change() me.update_paid_amount()
}) })
$(this.$body).find('.delete-btn').click(function(){ $(this.$body).find('.delete-btn').click(function(){
@ -192,14 +192,14 @@ erpnext.payments = erpnext.stock.StockController.extend({
this.show_amounts() this.show_amounts()
}, },
update_paid_amount: function() { update_paid_amount: function(update_write_off) {
var me = this; var me = this;
if(in_list(['change_amount', 'write_off_amount'], this.idx)){ if(in_list(['change_amount', 'write_off_amount'], this.idx)){
value = me.selected_mode.val(); value = me.selected_mode.val();
if(me.idx == 'change_amount'){ if(me.idx == 'change_amount'){
me.change_amount(value) me.change_amount(value)
} else{ } else{
if(value == 0) { if(value == 0 && update_write_off) {
value = me.frm.doc.outstanding_amount; value = me.frm.doc.outstanding_amount;
} }
me.write_off_amount(value) me.write_off_amount(value)
@ -224,9 +224,9 @@ erpnext.payments = erpnext.stock.StockController.extend({
show_amounts: function(){ show_amounts: function(){
var me = this; var me = this;
$(this.$body).find(".write_off_amount").val(flt(this.frm.doc.write_off_amount, precision("write_off_amount"))); $(this.$body).find(".write_off_amount").val(format_number(this.frm.doc.write_off_amount, precision("write_off_amount")));
$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency)); $(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));
$(this.$body).find('.change_amount').val(flt(this.frm.doc.change_amount, precision("change_amount"))) $(this.$body).find('.change_amount').val(format_number(this.frm.doc.change_amount, precision("change_amount")))
$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency)) $(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency))
this.update_invoice(); this.update_invoice();
} }