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
This commit is contained in:
Nabin Hait
2017-07-05 12:58:19 +05:30
committed by Makarand Bauskar
parent b66fb9a4c0
commit 852cb64e4f
18 changed files with 425 additions and 147 deletions

View File

@@ -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 -%}
{% if email_id %}Email: {{ email_id }}<br>{% endif -%}
{% if gstin %}GSTIN: {{ gstin }}<br>{% endif -%}

View File

@@ -14,6 +14,7 @@ def setup(company=None, patch=True):
add_custom_roles_for_reports()
add_hsn_codes()
update_address_template()
add_print_formats()
if not patch:
make_fixtures()
@@ -69,6 +70,9 @@ def add_permissions():
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 @@ def make_custom_fields():
'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'},

View File

@@ -16,7 +16,7 @@ def validate_gstin_for_india(doc, method):
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))