diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a3bf78b532e..6e5ffed7797 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -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 \ No newline at end of file diff --git a/erpnext/patches/v13_0/create_gst_custom_fields_in_quotation.py b/erpnext/patches/v13_0/create_gst_custom_fields_in_quotation.py new file mode 100644 index 00000000000..3217eab43d6 --- /dev/null +++ b/erpnext/patches/v13_0/create_gst_custom_fields_in_quotation.py @@ -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) diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index 40fa6cd097c..446faaa708b 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -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", diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index 10b1edbad48..0b6fcc6f7aa 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -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 diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 0318b704af0..75443abe493 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -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 }, { diff --git a/erpnext/selling/doctype/quotation/regional/india.js b/erpnext/selling/doctype/quotation/regional/india.js new file mode 100644 index 00000000000..955083565bc --- /dev/null +++ b/erpnext/selling/doctype/quotation/regional/india.js @@ -0,0 +1,3 @@ +{% include "erpnext/regional/india/taxes.js" %} + +erpnext.setup_auto_gst_taxation('Quotation');