fix: India utils code cleanup

(cherry picked from commit 56c626adbfbd04e7e9063f6500ec380f7bfb3da4)
This commit is contained in:
Deepesh Garg 2021-12-02 17:17:56 +05:30 committed by mergify-bot
parent f12be3001d
commit 35e2bd89c0
2 changed files with 7 additions and 19 deletions

View File

@ -77,7 +77,6 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) {
if (args) {
args.posting_date = frm.doc.posting_date || frm.doc.transaction_date;
args.fetch_payment_terms_template = cint(!frm.doc.ignore_default_payment_terms_template);
args.taxes_and_charges = frm.doc.taxes_and_charges;
}
}
if (!args || !args.party) return;

View File

@ -206,28 +206,18 @@ def get_regional_address_details(party_details, doctype, company):
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
master_doctype = "Sales Taxes and Charges Template"
get_tax_template_based_on_category(master_doctype, company, party_details)
if party_details.get('taxes_and_charges'):
return party_details
if not party_details.company_gstin:
return party_details
tax_template_by_category = get_tax_template_based_on_category(master_doctype, company, party_details)
elif doctype in ("Purchase Invoice", "Purchase Order", "Purchase Receipt"):
master_doctype = "Purchase Taxes and Charges Template"
get_tax_template_based_on_category(master_doctype, company, party_details)
tax_template_by_category = get_tax_template_based_on_category(master_doctype, company, party_details)
if party_details.get('taxes_and_charges'):
return party_details
if not party_details.supplier_gstin:
return party_details
if tax_template_by_category:
party_details.get['taxes_and_charges'] = tax_template_by_category
return
if not party_details.place_of_supply: return party_details
if not party_details.company_gstin: return party_details
if ((doctype in ("Sales Invoice", "Delivery Note", "Sales Order") and party_details.company_gstin
and party_details.company_gstin[:2] != party_details.place_of_supply[:2]) or (doctype in ("Purchase Invoice",
"Purchase Order", "Purchase Receipt") and party_details.supplier_gstin and party_details.supplier_gstin[:2] != party_details.place_of_supply[:2])):
@ -237,6 +227,7 @@ def get_regional_address_details(party_details, doctype, company):
if not default_tax:
return party_details
party_details["taxes_and_charges"] = default_tax
party_details.taxes = get_taxes_and_charges(master_doctype, default_tax)
@ -268,9 +259,7 @@ def get_tax_template_based_on_category(master_doctype, company, party_details):
default_tax = frappe.db.get_value(master_doctype, {'company': company, 'tax_category': party_details.get('tax_category')},
'name')
if default_tax:
party_details["taxes_and_charges"] = default_tax
party_details.taxes = get_taxes_and_charges(master_doctype, default_tax)
return default_tax
def get_tax_template(master_doctype, company, is_inter_state, state_code):
tax_categories = frappe.get_all('Tax Category', fields = ['name', 'is_inter_state', 'gst_state'],