Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pos based on account settings #2647

Merged
25 changes: 22 additions & 3 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ def get_place_of_supply(party_details, doctype):
# fallback to company GSTIN for sales or supplier GSTIN for purchases
# (in retail scenarios, customer / company GSTIN may not be set)

determine_address_tax_category_from = frappe.db.get_single_value(
vorasmit marked this conversation as resolved.
Show resolved Hide resolved
"Accounts Settings", "determine_address_tax_category_from"
)

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":
Expand All @@ -407,13 +411,28 @@ def get_place_of_supply(party_details, doctype):
if gst_state_number and gst_state:
return f"{gst_state_number}-{gst_state}"

party_gstin = party_details.billing_address_gstin or party_details.company_gstin
party_gstin = (
party_details.billing_address_gstin
if determine_address_tax_category_from == "Billing Address"
and party_details.billing_address_gstin
else party_details.company_gstin
)

elif doctype == "Stock Entry":
party_gstin = party_details.bill_to_gstin or party_details.bill_from_gstin
party_gstin = (
party_details.bill_to_gstin
if determine_address_tax_category_from == "Billing Address"
and party_details.bill_to_gstin
else party_details.bill_from_gstin
)
else:
# for purchase, subcontracting order and receipt
party_gstin = party_details.company_gstin or party_details.supplier_gstin
party_gstin = (
party_details.company_gstin
if determine_address_tax_category_from == "Billing Address"
and party_details.company_gstin
else party_details.supplier_gstin
)

if not party_gstin:
return
Expand Down