GST tax invoice print format and more (#9616)
* GST Tax Invoice print format and more. Fixes #9545 #9566 #9608
* Reload gst print format only for Indian users
* Fixes as Codacy
diff --git a/erpnext/regional/india/address_template.html b/erpnext/regional/india/address_template.html
index 706c7a4..46879ad 100644
--- a/erpnext/regional/india/address_template.html
+++ b/erpnext/regional/india/address_template.html
@@ -2,7 +2,7 @@
{% if state %}{{ state }}<br>{% endif -%}
{% if pincode %}{{ pincode }}<br>{% endif -%}
{{ country }}<br>
-{% if gstin %}GSTIN: {{ gstin }}<br>{% endif -%}
{% if phone %}Phone: {{ phone }}<br>{% endif -%}
{% if fax %}Fax: {{ fax }}<br>{% endif -%}
-{% if email_id %}Email: {{ email_id }}<br>{% endif -%}
\ No newline at end of file
+{% if email_id %}Email: {{ email_id }}<br>{% endif -%}
+{% if gstin %}GSTIN: {{ gstin }}<br>{% endif -%}
\ No newline at end of file
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index a9f3a30..46cfdb8 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -14,6 +14,7 @@
add_custom_roles_for_reports()
add_hsn_codes()
update_address_template()
+ add_print_formats()
if not patch:
make_fixtures()
@@ -69,6 +70,9 @@
add_permission(doctype, 'Accounts Manager', 0)
add_permission(doctype, 'All', 0)
+def add_print_formats():
+ frappe.reload_doc("regional", "print_format", "gst_tax_invoice")
+
def make_custom_fields():
custom_fields = {
'Address': [
@@ -80,39 +84,39 @@
'Purchase Invoice': [
dict(fieldname='supplier_gstin', label='Supplier GSTIN',
fieldtype='Data', insert_after='supplier_address',
- options='supplier_address.gstin'),
+ options='supplier_address.gstin', print_hide=1),
dict(fieldname='company_gstin', label='Company GSTIN',
fieldtype='Data', insert_after='shipping_address',
- options='shipping_address.gstin'),
+ options='shipping_address.gstin', print_hide=1),
],
'Sales Invoice': [
dict(fieldname='customer_gstin', label='Customer GSTIN',
fieldtype='Data', insert_after='shipping_address',
- options='shipping_address_name.gstin'),
+ options='shipping_address_name.gstin', print_hide=1),
dict(fieldname='company_gstin', label='Company GSTIN',
fieldtype='Data', insert_after='company_address',
- options='company_address.gstin'),
+ options='company_address.gstin', print_hide=1),
],
'Item': [
- dict(fieldname='gst_hsn_code', label='GST HSN Code',
+ dict(fieldname='gst_hsn_code', label='HSN/SAC Code',
fieldtype='Link', options='GST HSN Code', insert_after='item_group'),
],
'Sales Invoice Item': [
- dict(fieldname='gst_hsn_code', label='GST HSN Code',
+ dict(fieldname='gst_hsn_code', label='HSN/SAC Code',
fieldtype='Data', options='item_code.gst_hsn_code',
- insert_after='income_account'),
+ insert_after='description'),
],
'Purchase Invoice Item': [
- dict(fieldname='gst_hsn_code', label='GST HSN Code',
+ dict(fieldname='gst_hsn_code', label='HSN/SAC Code',
fieldtype='Data', options='item_code.gst_hsn_code',
- insert_after='expense_account'),
+ insert_after='description'),
]
}
for doctype, fields in custom_fields.items():
for df in fields:
create_custom_field(doctype, df)
-
+
def make_fixtures():
docs = [
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax', 'description': 'Professional Tax', 'type': 'Deduction'},
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index 4d37498..c4acafc 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -16,7 +16,7 @@
if doc.state in states:
doc.gst_state = doc.state
- if doc.gst_state:
- state_number = state_numbers[doc.gst_state]
- if state_number != doc.gstin[:2]:
- frappe.throw(_("First 2 digits of GSTIN should match with State number {0}").format(state_number))
+ if doc.gst_state:
+ state_number = state_numbers[doc.gst_state]
+ if state_number != doc.gstin[:2]:
+ frappe.throw(_("First 2 digits of GSTIN should match with State number {0}").format(state_number))