diff --git a/india_compliance/gst_india/overrides/test_transaction.py b/india_compliance/gst_india/overrides/test_transaction.py index 2ff66ce97..28c57fb1b 100644 --- a/india_compliance/gst_india/overrides/test_transaction.py +++ b/india_compliance/gst_india/overrides/test_transaction.py @@ -1246,6 +1246,7 @@ def test_pos_sales_invoice(self): doc_args = { "doctype": "Sales Invoice", "customer": "_Test Registered Composition Customer", + "shipping_address_name": "_Test Indian Registered Company-Billing", } settings = ["Accounts Settings", None, "determine_address_tax_category_from"] diff --git a/india_compliance/gst_india/setup/property_setters.py b/india_compliance/gst_india/setup/property_setters.py index 21efb585d..ecb904deb 100644 --- a/india_compliance/gst_india/setup/property_setters.py +++ b/india_compliance/gst_india/setup/property_setters.py @@ -91,11 +91,17 @@ def get_property_setters(*, include_defaults=False): "property": "read_only", "value": "1", }, + { + "doctype": "Accounts Settings", + "fieldname": "add_taxes_from_item_tax_template", + "property": "description", + "value": "Overridden by India Compliance", + }, { "doctype": "Accounts Settings", "fieldname": "tax_settings_section", "property": "label", - "value": "Tax Settings (Overridden by India Compliance)", + "value": "Tax Settings", }, { "doctype": "Accounts Settings", diff --git a/india_compliance/gst_india/utils/__init__.py b/india_compliance/gst_india/utils/__init__.py index 79cd7ab3a..c700c0e08 100644 --- a/india_compliance/gst_india/utils/__init__.py +++ b/india_compliance/gst_india/utils/__init__.py @@ -391,31 +391,32 @@ def get_place_of_supply(party_details, doctype): "Accounts Settings", "Accounts Settings", "determine_address_tax_category_from" ) - if pos_basis == "Shipping Address" and doctype in SALES_DOCTYPES: - # POS Basis Shipping Address is only applicable for Sales - pos_gstin = party_details.company_gstin - # fallback to company GSTIN for sales or supplier GSTIN for purchases # (in retail scenarios, customer / company GSTIN may not be set) - - elif doctype in SALES_DOCTYPES or doctype == "Payment Entry": + if doctype in SALES_DOCTYPES or doctype == "Payment Entry": # for exports, Place of Supply is set using GST category in absence of GSTIN if party_details.gst_category == "Overseas": return get_overseas_place_of_supply(party_details) - if ( - party_details.gst_category == "Unregistered" - and party_details.customer_address - ): + address = ( + party_details.shipping_address_name or party_details.company_address + if pos_basis == "Shipping Address" and doctype != "Payment Entry" + else party_details.customer_address + ) + if party_details.gst_category == "Unregistered" and address: gst_state_number, gst_state = frappe.db.get_value( "Address", - party_details.customer_address, + address, ("gst_state_number", "gst_state"), ) if gst_state_number and gst_state: return f"{gst_state_number}-{gst_state}" - pos_gstin = party_details.billing_address_gstin or party_details.company_gstin + pos_gstin = ( + frappe.db.get_value("Address", party_details.shipping_address_name, "gstin") + if pos_basis == "Shipping Address" + else party_details.billing_address_gstin + ) or party_details.company_gstin elif doctype == "Stock Entry": pos_gstin = party_details.bill_to_gstin or party_details.bill_from_gstin diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index 4840d66eb..9ba00fa85 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -5,7 +5,7 @@ india_compliance.patches.v15.remove_duplicate_web_template [post_model_sync] india_compliance.patches.v14.set_default_for_overridden_accounts_setting execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #59 -execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #9 +execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #10 execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #2 india_compliance.patches.post_install.remove_old_fields #2 india_compliance.patches.post_install.set_gst_tax_type