[fix] calculate withholding only on invoice

This commit is contained in:
Saurabh 2018-05-16 14:03:41 +05:30
parent 778841f399
commit 3c204122cd
4 changed files with 2 additions and 114 deletions

View File

@ -43,7 +43,6 @@ class PaymentEntry(AccountsController):
def validate(self):
self.setup_party_account_field()
self.set_tax_withholding()
self.set_missing_values()
self.validate_payment_type()
self.validate_party_details()
@ -512,20 +511,6 @@ class PaymentEntry(AccountsController):
self.reference_no = reference_doc.name
self.reference_date = nowdate()
def set_tax_withholding(self):
if self.party_type != 'Supplier':
return
self.supplier = self.party
tax_withholding_details = get_patry_tax_withholding_details(self)
for tax_details in tax_withholding_details:
if self.deductions:
if tax_details['tax']['account_head'] not in [deduction.account for deduction in self.deductions]:
self.append('deductions', self.calculate_deductions(tax_details))
else:
self.append('deductions', self.calculate_deductions(tax_details))
def calculate_deductions(self, tax_details):
return {
"account": tax_details['tax']['account_head'],

View File

@ -4231,7 +4231,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2018-04-19 15:48:29.457594",
"modified": "2018-05-16 15:48:29.457594",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -751,10 +751,6 @@ class PurchaseInvoice(BuyingController):
self.db_set('release_date', None)
def set_tax_withholding(self):
"""
1. Get TDS Configurations against Supplier
"""
tax_withholding_details = get_patry_tax_withholding_details(self)
for tax_details in tax_withholding_details:
if flt(self.get("rounded_total") or self.grand_total) >= flt(tax_details['threshold']):

View File

@ -13,68 +13,6 @@
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "is_default",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Default",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "enabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Enabled",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -198,37 +136,6 @@
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "book_on_advance",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Book on Advance",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -333,7 +240,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-11 14:25:07.474461",
"modified": "2018-05-16 13:57:52.489773",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Tax Withholding Category",