Skip to content

Commit

Permalink
fix: load gst_breakup before_print to ensure it shows in PDF
Browse files Browse the repository at this point in the history
(cherry picked from commit 747de03)
  • Loading branch information
vorasmit authored and mergify[bot] committed Feb 23, 2024
1 parent 6c4018d commit 9dc12ee
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
12 changes: 6 additions & 6 deletions india_compliance/gst_india/constants/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@
"default": 0,
},
{
"fieldname": "custom_gst_breakup",
"fieldname": "section_gst_breakup",
"label": "GST Breakup",
"fieldtype": "Section Break",
"insert_after": "other_charges_calculation",
"collapsible": 1,
},
{
"fieldname": "custom_gst_breakup_table",
"fieldname": "gst_breakup_table",
"label": "GST Breakup Table",
"fieldtype": "Long Text",
"insert_after": "custom_gst_breakup",
"insert_after": "section_gst_breakup",
"is_virtual": 1,
"read_only": 1,
"allow_on_submit": 1,
Expand Down Expand Up @@ -249,17 +249,17 @@
"translatable": 0,
},
{
"fieldname": "custom_gst_breakup",
"fieldname": "section_gst_breakup",
"label": "GST Breakup",
"fieldtype": "Section Break",
"insert_after": "other_charges_calculation",
"collapsible": 1,
},
{
"fieldname": "custom_gst_breakup_table",
"fieldname": "gst_breakup_table",
"label": "GST Breakup Table",
"fieldtype": "Long Text",
"insert_after": "custom_gst_breakup",
"insert_after": "section_gst_breakup",
"is_virtual": 1,
"read_only": 1,
"allow_on_submit": 1,
Expand Down
4 changes: 2 additions & 2 deletions india_compliance/gst_india/overrides/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
}


def set_gst_breakup(doc, method=None):
def set_gst_breakup(doc, method=None, print_settings=None):
if ignore_gst_validations(doc) or not doc.place_of_supply or not doc.company_gstin:
return

doc.custom_gst_breakup_table = frappe.render_template(
doc.gst_breakup_table = frappe.render_template(
"templates/gst_breakup.html", dict(doc=doc)
)

Expand Down
9 changes: 9 additions & 0 deletions india_compliance/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"india_compliance.gst_india.overrides.delivery_note.onload",
"india_compliance.gst_india.overrides.transaction.set_gst_breakup",
],
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_save": "india_compliance.gst_india.overrides.transaction.update_gst_details",
"before_submit": "india_compliance.gst_india.overrides.transaction.update_gst_details",
"validate": (
Expand Down Expand Up @@ -131,6 +132,7 @@
"india_compliance.gst_india.overrides.purchase_invoice.onload",
"india_compliance.gst_india.overrides.transaction.set_gst_breakup",
],
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": "india_compliance.gst_india.overrides.purchase_invoice.validate",
"before_validate": (
"india_compliance.gst_india.overrides.transaction.before_validate"
Expand All @@ -143,6 +145,7 @@
},
"Purchase Order": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": (
"india_compliance.gst_india.overrides.transaction.validate_transaction"
),
Expand All @@ -154,6 +157,7 @@
},
"Purchase Receipt": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": (
"india_compliance.gst_india.overrides.transaction.validate_transaction"
),
Expand All @@ -173,6 +177,7 @@
"india_compliance.gst_india.overrides.sales_invoice.onload",
"india_compliance.gst_india.overrides.transaction.set_gst_breakup",
],
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": "india_compliance.gst_india.overrides.sales_invoice.validate",
"before_save": "india_compliance.gst_india.overrides.transaction.update_gst_details",
"before_submit": "india_compliance.gst_india.overrides.transaction.update_gst_details",
Expand All @@ -185,6 +190,7 @@
},
"Sales Order": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": (
"india_compliance.gst_india.overrides.transaction.validate_transaction"
),
Expand All @@ -211,6 +217,7 @@
},
"POS Invoice": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": (
"india_compliance.gst_india.overrides.transaction.validate_transaction"
),
Expand All @@ -219,6 +226,7 @@
},
"Quotation": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"validate": (
"india_compliance.gst_india.overrides.transaction.validate_transaction"
),
Expand All @@ -227,6 +235,7 @@
},
"Supplier Quotation": {
"onload": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_print": "india_compliance.gst_india.overrides.transaction.set_gst_breakup",
"before_validate": (
"india_compliance.gst_india.overrides.transaction.before_validate"
),
Expand Down
4 changes: 2 additions & 2 deletions india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ execute:import frappe; frappe.delete_doc_if_exists("DocType", "GSTIN")

[post_model_sync]
india_compliance.patches.v14.set_default_for_overridden_accounts_setting
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #42
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #43
execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #7
india_compliance.patches.post_install.remove_old_fields
india_compliance.patches.post_install.remove_old_fields #1
india_compliance.patches.post_install.update_company_gstin
india_compliance.patches.post_install.update_custom_role_for_e_invoice_summary
india_compliance.patches.v14.remove_ecommerce_gstin_from_purchase_invoice
Expand Down
16 changes: 16 additions & 0 deletions india_compliance/patches/post_install/remove_old_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@ def execute():
delete_old_fields("pan_details", "Company")
delete_old_fields("export_type", ("Customer", "Supplier"))
delete_old_fields("company_address", "Journal Entry")

# Field renamed post release
delete_old_fields(
("custom_gst_breakup", "custom_gst_breakup_table"),
(
"Supplier Quotation",
"Purchase Order",
"Purchase Receipt",
"Purchase Invoice",
"Quotation",
"Sales Order",
"Delivery Note",
"Sales Invoice",
"POS Invoice",
),
)

0 comments on commit 9dc12ee

Please sign in to comment.