Skip to content

fix(italy): skip e-invoicing for opening invoices#57314

Open
krishna-254 wants to merge 1 commit into
frappe:developfrom
krishna-254:fix/skip-italy-einvoice-opening-invoices
Open

fix(italy): skip e-invoicing for opening invoices#57314
krishna-254 wants to merge 1 commit into
frappe:developfrom
krishna-254:fix/skip-italy-einvoice-opening-invoices

Conversation

@krishna-254

Copy link
Copy Markdown
Contributor

Changes:

  • Added condition check validation to skip if doc is_opening..
  • Added a test for the same

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the change is three one-line guard additions that only affect opening invoices, and no existing logic or queries are modified.

All three guards use the established is_opening == "Yes" string comparison consistent with ERPNext's Select field values, no database queries are touched, and the early returns are placed before any I/O-heavy operations.

No files require special attention.

Reviews (3): Last reviewed commit: "fix(italy): skip e-invoicing for opening..." | Re-trigger Greptile

Comment thread erpnext/regional/italy/test_utils.py Outdated
Comment on lines +22 to +26
def test_opening_sales_invoice_skips_einvoice_validation_and_export(self):
invoice = frappe._dict(doctype="Sales Invoice", is_opening="Yes")

sales_invoice_validate(invoice)
sales_invoice_on_submit(invoice, None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test lacks explicit assertions

The test verifies the guard implicitly — if the early-return wasn't there, both functions would throw (e.g., sales_invoice_validate would reach if not doc.company_address and throw, and sales_invoice_on_submit would call get_company_country(None)). That implicit check is enough to catch a regression, but adding self.assertIsNone(sales_invoice_validate(invoice)) (and similarly for on_submit) would make the intent explicit and guard against future refactors that silently swallow the call.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@krishna-254
krishna-254 requested a review from nabinhait July 21, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant