Skip to content

Commit

Permalink
fix: added a field is_generated_from_irn
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Oct 15, 2024
1 parent 58e439e commit 4d34502
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions india_compliance/gst_india/constants/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,16 @@
"read_only": 1,
"print_hide": 1,
},
{
"fieldname": "is_generated_from_irn",
"label": "Is Generated From IRN",
"fieldtype": "Check",
"default": 0,
"read_only": 1,
"print_hide": 1,
"no_copy": 1,
"hidden": 1,
},
],
"Purchase Receipt": [
{
Expand Down
6 changes: 5 additions & 1 deletion india_compliance/gst_india/overrides/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@


def onload(doc, method=None):
if frappe.db.exists("e-Invoice Log", "reference_name", doc.name):
doc.set_onload("is_generated_from_irn", 1)

if doc.docstatus != 1:
return

Expand Down Expand Up @@ -437,6 +440,7 @@ def create_purchase_invoice(supplier, company, invoice_info):
"supplier": supplier,
"company": company,
"due_date": frappe.utils.nowdate(),
"is_generated_from_irn": 1,
}
invoice_info["bill_date"] = getdate(invoice_info["bill_date"])
invoice_data.update(invoice_info)
Expand Down Expand Up @@ -549,7 +553,7 @@ def get_item_details(args, doc):
doc = json.loads(doc)
data = get_item_details(args, doc)

if not frappe.db.exists("e-Invoice Log", {"reference_name": doc.get("name")}):
if not doc.get("is_generated_from_irn"):
return data

args = json.loads(args)
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ india_compliance.patches.v15.remove_duplicate_web_template

[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() #58
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #59
execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #8
execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #2
india_compliance.patches.post_install.remove_old_fields #2
Expand Down

0 comments on commit 4d34502

Please sign in to comment.