[fix] [patch] fixed paid_amount & patch for default pos view check in features setup
This commit is contained in:
parent
734b2aab5c
commit
38e8f989fa
@ -339,7 +339,7 @@ erpnext.POS = Class.extend({
|
||||
}
|
||||
|
||||
// if form is submitted & cancelled then disable all input box & buttons
|
||||
if (cur_frm.doc.docstatus>=1) {
|
||||
if (cur_frm.doc.docstatus>=1 && cint(cur_frm.doc.is_pos)) {
|
||||
me.wrapper.find('input, button').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
|
@ -27,10 +27,11 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}
|
||||
|
||||
// toggle to pos view if is_pos is 1 in user_defaults
|
||||
if (cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos();
|
||||
cur_frm.cscript.toggle_pos(true);
|
||||
if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) &&
|
||||
cint(wn.defaults.get_user_defaults("fs_pos_view"))===1) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos();
|
||||
cur_frm.cscript.toggle_pos(true);
|
||||
}
|
||||
|
||||
// if document is POS then change default print format to "POS Invoice"
|
||||
@ -192,7 +193,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount), precision("write_off_amount"));
|
||||
}
|
||||
|
||||
this.frm.runclientscript("write_off_amount");
|
||||
this.frm.script_manager.trigger("write_off_amount");
|
||||
},
|
||||
|
||||
write_off_amount: function() {
|
||||
|
@ -261,4 +261,5 @@ patch_list = [
|
||||
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02",
|
||||
"patches.september_2013.p01_fix_buying_amount_gl_entries",
|
||||
"patches.september_2013.p01_update_communication",
|
||||
"patches.september_2013.p02_make_pos_view_checked_in_features_setup",
|
||||
]
|
@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("setup", "doctype", "features_setup")
|
||||
fs = webnotes.bean("Features Setup")
|
||||
fs.doc.fs_pos_view = 1
|
||||
fs.save()
|
@ -432,14 +432,16 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
|
||||
calculate_outstanding_amount: function() {
|
||||
// NOTE:
|
||||
// write_off_amount is only for POS Invoice
|
||||
// paid_amount and write_off_amount is only for POS Invoice
|
||||
// total_advance is only for non POS Invoice
|
||||
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
|
||||
wn.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
|
||||
"paid_amount"]);
|
||||
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount;
|
||||
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - this.frm.doc.total_advance -
|
||||
this.frm.doc.paid_amount, precision("outstanding_amount"));
|
||||
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount - this.frm.doc.total_advance;
|
||||
this.frm.doc.paid_amount = this.frm.doc.is_pos? flt(total_amount_to_pay): 0.0;
|
||||
|
||||
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - this.frm.doc.paid_amount,
|
||||
precision("outstanding_amount"));
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user