mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-16 13:25:10 +00:00
fix: Tax template update on supplier
This commit is contained in:
@@ -16,6 +16,7 @@ erpnext.setup_auto_gst_taxation = (doctype) => {
|
||||
'shipping_address': frm.doc.shipping_address || '',
|
||||
'shipping_address_name': frm.doc.shipping_address_name || '',
|
||||
'customer_address': frm.doc.customer_address || '',
|
||||
'supplier_address': frm.doc.supplier_address,
|
||||
'customer': frm.doc.customer,
|
||||
'supplier': frm.doc.supplier,
|
||||
'supplier_gstin': frm.doc.supplier_gstin,
|
||||
|
||||
@@ -12,6 +12,7 @@ from erpnext.regional.india import number_state_mapping
|
||||
from six import string_types
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from frappe.model.utils import get_fetch_values
|
||||
|
||||
def validate_gstin_for_india(doc, method):
|
||||
if hasattr(doc, 'gst_state') and doc.gst_state:
|
||||
@@ -155,7 +156,15 @@ def get_regional_address_details(party_details, doctype, company, return_taxes=N
|
||||
party_details = json.loads(party_details)
|
||||
party_details = frappe._dict(party_details)
|
||||
|
||||
update_party_details(party_details, doctype)
|
||||
|
||||
party_details.place_of_supply = get_place_of_supply(party_details, doctype)
|
||||
|
||||
if is_internal_transfer(party_details, doctype):
|
||||
party_details.taxes_and_charges = ''
|
||||
party_details.taxes = ''
|
||||
return party_details
|
||||
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
master_doctype = "Sales Taxes and Charges Template"
|
||||
|
||||
@@ -196,8 +205,23 @@ def get_regional_address_details(party_details, doctype, company, return_taxes=N
|
||||
party_details["taxes_and_charges"] = default_tax
|
||||
party_details.taxes = get_taxes_and_charges(master_doctype, default_tax)
|
||||
|
||||
if return_taxes:
|
||||
return party_details
|
||||
return party_details
|
||||
|
||||
def update_party_details(party_details, doctype):
|
||||
for address_field in ['shipping_address', 'company_address', 'supplier_address', 'shipping_address_name', 'customer_address']:
|
||||
if party_details.get(address_field):
|
||||
party_details.update(get_fetch_values(doctype, address_field, party_details.get(address_field)))
|
||||
|
||||
def is_internal_transfer(party_details, doctype):
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
destination_gstin = party_details.company_gstin
|
||||
elif doctype in ("Purchase Invoice", "Purchase Order", "Purchase Receipt"):
|
||||
destination_gstin = party_details.supplier_gstin
|
||||
|
||||
if party_details.gstin == destination_gstin:
|
||||
return True
|
||||
else:
|
||||
False
|
||||
|
||||
def get_tax_template_based_on_category(master_doctype, company, party_details):
|
||||
if not party_details.get('tax_category'):
|
||||
@@ -500,7 +524,7 @@ def get_address_details(data, doc, company_address, billing_address):
|
||||
data.transType = 1
|
||||
data.actualToStateCode = data.toStateCode
|
||||
shipping_address = billing_address
|
||||
|
||||
|
||||
if doc.gst_category == 'SEZ':
|
||||
data.toStateCode = 99
|
||||
|
||||
|
||||
Reference in New Issue
Block a user