[fix] [patch] fixed paid_amount & patch for default pos view check in features setup

This commit is contained in:
Akhilesh Darjee 2013-09-05 12:59:33 +05:30
parent 734b2aab5c
commit 38e8f989fa
5 changed files with 25 additions and 10 deletions

View File

@ -339,7 +339,7 @@ erpnext.POS = Class.extend({
} }
// if form is submitted & cancelled then disable all input box & buttons // 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 () { me.wrapper.find('input, button').each(function () {
$(this).prop('disabled', true); $(this).prop('disabled', true);
}); });

View File

@ -27,7 +27,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
} }
// toggle to pos view if is_pos is 1 in user_defaults // 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) { 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.frm.set_value("is_pos", 1);
this.is_pos(); this.is_pos();
cur_frm.cscript.toggle_pos(true); cur_frm.cscript.toggle_pos(true);
@ -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")); 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() { write_off_amount: function() {

View File

@ -261,4 +261,5 @@ patch_list = [
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02", "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_fix_buying_amount_gl_entries",
"patches.september_2013.p01_update_communication", "patches.september_2013.p01_update_communication",
"patches.september_2013.p02_make_pos_view_checked_in_features_setup",
] ]

View File

@ -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()

View File

@ -432,14 +432,16 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
calculate_outstanding_amount: function() { calculate_outstanding_amount: function() {
// NOTE: // 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 // total_advance is only for non POS Invoice
if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) { 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", wn.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
"paid_amount"]); "paid_amount"]);
var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_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.outstanding_amount = flt(total_amount_to_pay - 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.paid_amount, precision("outstanding_amount"));
this.frm.doc.outstanding_amount = flt(total_amount_to_pay - this.frm.doc.paid_amount,
precision("outstanding_amount"));
} }
}, },