fix: Allocate advance taxes only for payment entry

This commit is contained in:
Deepesh Garg 2021-05-17 20:58:50 +05:30
parent e2f83ffaa4
commit a23aaf43f4
3 changed files with 76 additions and 73 deletions

View File

@ -903,6 +903,7 @@ class PurchaseInvoice(BuyingController):
def allocate_advance_taxes(self, gl_entries): def allocate_advance_taxes(self, gl_entries):
tax_map = self.get_tax_map() tax_map = self.get_tax_map()
for pe in self.get('advances'): for pe in self.get('advances'):
if pe.reference_type == 'Payment Entry':
pe = frappe.get_doc('Payment Entry', pe.reference_name) pe = frappe.get_doc('Payment Entry', pe.reference_name)
for tax in pe.get('taxes'): for tax in pe.get('taxes'):
account_currency = get_account_currency(tax.account_head) account_currency = get_account_currency(tax.account_head)

View File

@ -916,6 +916,7 @@ class SalesInvoice(SellingController):
def allocate_advance_taxes(self, gl_entries): def allocate_advance_taxes(self, gl_entries):
tax_map = self.get_tax_map() tax_map = self.get_tax_map()
for pe in self.get('advances'): for pe in self.get('advances'):
if pe.reference_type == 'Payment Entry':
pe = frappe.get_doc('Payment Entry', pe.reference_name) pe = frappe.get_doc('Payment Entry', pe.reference_name)
for tax in pe.get('taxes'): for tax in pe.get('taxes'):
account_currency = get_account_currency(tax.account_head) account_currency = get_account_currency(tax.account_head)

View File

@ -726,6 +726,7 @@ class AccountsController(TransactionBase):
tax_map = self.get_tax_map() tax_map = self.get_tax_map()
for pe in self.get('advances'): for pe in self.get('advances'):
if pe.reference_type == 'Payment Entry':
pe = frappe.get_doc('Payment Entry', pe.reference_name) pe = frappe.get_doc('Payment Entry', pe.reference_name)
for tax in pe.get('taxes'): for tax in pe.get('taxes'):
allocated_amount = tax_map.get(tax.account_head) - allocated_tax_map.get(tax.account_head) allocated_amount = tax_map.get(tax.account_head) - allocated_tax_map.get(tax.account_head)