[fix] Payments on the invoice is showing even if IS POS option is disabled (#8802)

This commit is contained in:
rohitwaghchaure 2017-05-16 11:29:57 +05:30 committed by Nabin Hait
parent aa1be1ce92
commit 73456ac81a
4 changed files with 21 additions and 1 deletions

View File

@ -465,6 +465,8 @@ class calculate_taxes_and_totals(object):
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
paid_amount += payment.amount
base_paid_amount += payment.base_amount
elif not self.doc.is_return:
self.doc.set('payments', [])
self.doc.paid_amount = flt(paid_amount, self.doc.precision("paid_amount"))
self.doc.base_paid_amount = flt(base_paid_amount, self.doc.precision("base_paid_amount"))

View File

@ -393,4 +393,5 @@ erpnext.patches.v7_2.stock_uom_in_selling
erpnext.patches.v8_0.revert_manufacturers_table_from_item
erpnext.patches.v8_0.disable_instructor_role
erpnext.patches.v8_0.merge_student_batch_and_student_group
erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin # 11-05-2017
erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin # 11-05-2017
erpnext.patches.v8_0.make_payments_table_blank_for_non_pos_invoice

View File

@ -0,0 +1,15 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('Sales Invoice')
frappe.db.sql("""
delete from
`tabSales Invoice Payment`
where
parent in (select name from `tabSales Invoice` where is_pos = 0)
""")

View File

@ -594,6 +594,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
paid_amount += data.amount;
base_paid_amount += data.base_amount;
})
} else if(!this.frm.doc.is_return){
this.frm.doc.payments = [];
}
this.frm.doc.paid_amount = flt(paid_amount, precision("paid_amount"));