[fix] [patch] fixed paid_amount & patch for default pos view check in features setup
diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js
index 5dfe6c2..5324f01 100644
--- a/accounts/doctype/sales_invoice/pos.js
+++ b/accounts/doctype/sales_invoice/pos.js
@@ -339,7 +339,7 @@
}
// 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);
});
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 20df233..3841ef4 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -27,10 +27,11 @@
}
// 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 @@
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() {
diff --git a/patches/patch_list.py b/patches/patch_list.py
index a5c95a9..8069a52 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -261,4 +261,5 @@
"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",
]
\ No newline at end of file
diff --git a/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py b/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py
new file mode 100644
index 0000000..c5e2c7b
--- /dev/null
+++ b/patches/september_2013/p02_make_pos_view_checked_in_features_setup.py
@@ -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()
\ No newline at end of file
diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js
index 5c0c96a..0308dfc 100644
--- a/selling/doctype/sales_common/sales_common.js
+++ b/selling/doctype/sales_common/sales_common.js
@@ -432,14 +432,16 @@
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"));
}
},