[HotFix] Taxes not adding in POS sales invoice (#13776)
This commit is contained in:
parent
ede0af97cd
commit
57914f140e
@ -319,6 +319,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
},
|
||||
|
||||
pos_profile: function() {
|
||||
this.frm.doc.taxes = []
|
||||
this.set_pos_data();
|
||||
},
|
||||
|
||||
|
@ -344,8 +344,8 @@ class SalesInvoice(SellingController):
|
||||
self.terms = frappe.db.get_value("Terms and Conditions", self.tc_name, "terms")
|
||||
|
||||
# fetch charges
|
||||
if self.taxes_and_charges:
|
||||
self.set_other_charges()
|
||||
if self.taxes_and_charges and not len(self.get("taxes")):
|
||||
self.set_taxes()
|
||||
|
||||
return pos
|
||||
|
||||
|
@ -232,7 +232,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
tax_master_doctype = self.meta.get_field("taxes_and_charges").options
|
||||
|
||||
if self.is_new() and not self.get("taxes"):
|
||||
if (self.is_new() or self.is_pos_profile_changed()) and not self.get("taxes"):
|
||||
if self.company and not self.get("taxes_and_charges"):
|
||||
# get the default tax master
|
||||
self.taxes_and_charges = frappe.db.get_value(tax_master_doctype,
|
||||
@ -240,6 +240,11 @@ class AccountsController(TransactionBase):
|
||||
|
||||
self.append_taxes_from_master(tax_master_doctype)
|
||||
|
||||
def is_pos_profile_changed(self):
|
||||
if (self.doctype == 'Sales Invoice' and self.is_pos and
|
||||
self.pos_profile != frappe.db.get_value('Sales Invoice', self.name, 'pos_profile')):
|
||||
return True
|
||||
|
||||
def append_taxes_from_master(self, tax_master_doctype=None):
|
||||
if self.get("taxes_and_charges"):
|
||||
if not tax_master_doctype:
|
||||
|
@ -498,4 +498,5 @@ erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
|
||||
erpnext.patches.v10_0.update_hub_connector_domain
|
||||
erpnext.patches.v10_0.set_student_party_type
|
||||
erpnext.patches.v10_0.update_project_in_sle
|
||||
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
|
||||
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
|
||||
erpnext.patches.v10_0.taxes_issue_with_pos
|
26
erpnext/patches/v10_0/taxes_issue_with_pos.py
Normal file
26
erpnext/patches/v10_0/taxes_issue_with_pos.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for d in frappe.get_all('Sales Invoice', fields=["name"],
|
||||
filters = {'is_pos':1, 'docstatus': 1, 'creation': ('>', '2018-04-23')}):
|
||||
doc = frappe.get_doc('Sales Invoice', d.name)
|
||||
if (not doc.taxes and doc.taxes_and_charges and doc.pos_profile and
|
||||
frappe.db.get_value('POS Profile', doc.pos_profile, 'taxes_and_charges', cache=True) == doc.taxes_and_charges):
|
||||
|
||||
doc.append_taxes_from_master()
|
||||
doc.calculate_taxes_and_totals()
|
||||
for d in doc.taxes:
|
||||
d.db_update()
|
||||
|
||||
doc.db_update()
|
||||
|
||||
delete_gle_for_voucher(doc.name)
|
||||
doc.make_gl_entries()
|
||||
|
||||
def delete_gle_for_voucher(voucher_no):
|
||||
frappe.db.sql("""delete from `tabGL Entry` where voucher_no = %(voucher_no)s""",
|
||||
{'voucher_no': voucher_no})
|
Loading…
x
Reference in New Issue
Block a user