Merge pull request #30459 from frappe/mergify/bp/develop/pr-30385
fix(India): Auto tax fetching based on GSTIN (backport #30385)
This commit is contained in:
commit
ddbd82af95
@ -364,3 +364,4 @@ erpnext.patches.v13_0.add_cost_center_in_loans
|
||||
erpnext.patches.v13_0.set_return_against_in_pos_invoice_references
|
||||
erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items # 24-03-2022
|
||||
erpnext.patches.v13_0.update_expense_claim_status_for_paid_advances
|
||||
erpnext.patches.v13_0.create_gst_custom_fields_in_quotation
|
@ -0,0 +1,53 @@
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all("Company", filters={"country": "India"}, fields=["name"])
|
||||
if not company:
|
||||
return
|
||||
|
||||
sales_invoice_gst_fields = [
|
||||
dict(
|
||||
fieldname="billing_address_gstin",
|
||||
label="Billing Address GSTIN",
|
||||
fieldtype="Data",
|
||||
insert_after="customer_address",
|
||||
read_only=1,
|
||||
fetch_from="customer_address.gstin",
|
||||
print_hide=1,
|
||||
length=15,
|
||||
),
|
||||
dict(
|
||||
fieldname="customer_gstin",
|
||||
label="Customer GSTIN",
|
||||
fieldtype="Data",
|
||||
insert_after="shipping_address_name",
|
||||
fetch_from="shipping_address_name.gstin",
|
||||
print_hide=1,
|
||||
length=15,
|
||||
),
|
||||
dict(
|
||||
fieldname="place_of_supply",
|
||||
label="Place of Supply",
|
||||
fieldtype="Data",
|
||||
insert_after="customer_gstin",
|
||||
print_hide=1,
|
||||
read_only=1,
|
||||
length=50,
|
||||
),
|
||||
dict(
|
||||
fieldname="company_gstin",
|
||||
label="Company GSTIN",
|
||||
fieldtype="Data",
|
||||
insert_after="company_address",
|
||||
fetch_from="company_address.gstin",
|
||||
print_hide=1,
|
||||
read_only=1,
|
||||
length=15,
|
||||
),
|
||||
]
|
||||
|
||||
custom_fields = {"Quotation": sales_invoice_gst_fields}
|
||||
|
||||
create_custom_fields(custom_fields, update=True)
|
@ -930,6 +930,7 @@ def get_custom_fields():
|
||||
"Journal Entry": journal_entry_fields,
|
||||
"Sales Order": sales_invoice_gst_fields,
|
||||
"Tax Category": inter_state_gst_field,
|
||||
"Quotation": sales_invoice_gst_fields,
|
||||
"Item": [
|
||||
dict(
|
||||
fieldname="gst_hsn_code",
|
||||
|
@ -225,7 +225,7 @@ def get_place_of_supply(party_details, doctype):
|
||||
if not frappe.get_meta("Address").has_field("gst_state"):
|
||||
return
|
||||
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order", "Quotation"):
|
||||
address_name = party_details.customer_address or party_details.shipping_address_name
|
||||
elif doctype in ("Purchase Invoice", "Purchase Order", "Purchase Receipt"):
|
||||
address_name = party_details.shipping_address or party_details.supplier_address
|
||||
@ -254,7 +254,7 @@ def get_regional_address_details(party_details, doctype, company):
|
||||
party_details.taxes = []
|
||||
return party_details
|
||||
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order", "Quotation"):
|
||||
master_doctype = "Sales Taxes and Charges Template"
|
||||
tax_template_by_category = get_tax_template_based_on_category(
|
||||
master_doctype, company, party_details
|
||||
@ -311,7 +311,7 @@ def update_party_details(party_details, doctype):
|
||||
|
||||
|
||||
def is_internal_transfer(party_details, doctype):
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order", "Quotation"):
|
||||
destination_gstin = party_details.company_gstin
|
||||
elif doctype in ("Purchase Invoice", "Purchase Order", "Purchase Receipt"):
|
||||
destination_gstin = party_details.supplier_gstin
|
||||
|
@ -31,6 +31,8 @@
|
||||
"col_break98",
|
||||
"shipping_address_name",
|
||||
"shipping_address",
|
||||
"company_address",
|
||||
"company_address_display",
|
||||
"customer_group",
|
||||
"territory",
|
||||
"currency_and_price_list",
|
||||
@ -955,7 +957,18 @@
|
||||
"fieldname": "competitors",
|
||||
"fieldtype": "Table MultiSelect",
|
||||
"label": "Competitors",
|
||||
"options": "Competitor Detail",
|
||||
"options": "Competitor Detail"
|
||||
},
|
||||
{
|
||||
"fieldname": "company_address",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company Address Name",
|
||||
"options": "Address"
|
||||
},
|
||||
{
|
||||
"fieldname": "company_address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Company Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
|
3
erpnext/selling/doctype/quotation/regional/india.js
Normal file
3
erpnext/selling/doctype/quotation/regional/india.js
Normal file
@ -0,0 +1,3 @@
|
||||
{% include "erpnext/regional/india/taxes.js" %}
|
||||
|
||||
erpnext.setup_auto_gst_taxation('Quotation');
|
Loading…
Reference in New Issue
Block a user