Skip to content

feat: add BT-120 VAT exemption reason (backport #247)#254

Open
mergify[bot] wants to merge 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-247
Open

feat: add BT-120 VAT exemption reason (backport #247)#254
mergify[bot] wants to merge 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-247

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Apr 27, 2026

Adds a BT-120 textfield for the VAT exemption reason to the E-Invoice Settings: #183


This is an automatic backport of pull request #247 done by Mergify.

(cherry picked from commit cec83b5)

# Conflicts:
#	eu_einvoice/locale/de.po
#	eu_einvoice/locale/main.pot
@mergify mergify Bot added the conflicts label Apr 27, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Apr 27, 2026

Cherry-pick of cec83b5 has failed:

On branch mergify/bp/version-16-hotfix/pr-247
Your branch is up to date with 'origin/version-16-hotfix'.

You are currently cherry-picking commit cec83b5.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   eu_einvoice/european_e_invoice/custom/sales_invoice.py
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_import/e_invoice_import.py
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.py
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_trade_tax/e_invoice_trade_tax.json
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_trade_tax/e_invoice_trade_tax.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   eu_einvoice/locale/de.po
	both modified:   eu_einvoice/locale/main.pot

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This backport (from #247) adds BT-120 (ram:ExemptionReason) support: a new "Default VAT exemption reason" text field in E Invoice Settings that is written to exempt/zero-rate VAT breakdowns on generation, and parsed back from imported XML into e_invoice_trade_tax. The Python logic is correct on both sides — the text is only applied inside the rate == 0 guard for item-level taxes and the exemption-code path for document-level taxes.

  • P0 — Unresolved merge conflict in eu_einvoice/locale/de.po (lines 10–14): Git conflict markers (<<<<<<< HEAD / ======= / >>>>>>>) were never resolved; the .po file is invalid and will cause translation failures at runtime.
  • P0 — Unresolved merge conflict in eu_einvoice/locale/main.pot (lines 10–16): Same issue in the .pot template; Babel tooling (pybabel update) will fail to parse it. Both conflicts are trivial (only metadata dates differ) and must be resolved before merging.

Confidence Score: 2/5

Not safe to merge — both locale files contain unresolved git conflict markers that will break translation parsing at runtime.

Two P0 findings (unresolved merge conflicts in de.po and main.pot) cap the confidence at 2/5. The underlying feature logic is otherwise correct.

eu_einvoice/locale/de.po and eu_einvoice/locale/main.pot both require conflict resolution before this can be merged.

Important Files Changed

Filename Overview
eu_einvoice/locale/de.po Contains unresolved git merge conflict markers on lines 10–14; file will fail to parse as a valid gettext .po file.
eu_einvoice/locale/main.pot Contains unresolved git merge conflict markers on lines 10–16; .pot template is unparseable by Babel tooling.
eu_einvoice/european_e_invoice/custom/sales_invoice.py Adds vat_exemption_reason_text fetched from settings, correctly guarded inside the rate == 0 block for item-level taxes and the exemption-code path for document-level taxes; also fixes a getattr guard for supplier_numbers.
eu_einvoice/european_e_invoice/doctype/e_invoice_import/e_invoice_import.py Parses exemption_reason._text from imported XML and stores it in the new vat_exemption_reason_text field; logic is sound.
eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json Adds a new Section Break and Small Text field vat_exemption_reason_text under a 'VAT exemption (e-invoice)' section; JSON definition looks correct.
eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.py Auto-generated type stub updated with `vat_exemption_reason_text: DF.SmallText
eu_einvoice/european_e_invoice/doctype/e_invoice_trade_tax/e_invoice_trade_tax.json Adds vat_exemption_reason_text (read-only Small Text) to the child table for imported e-invoice trade taxes; definition is correct.
eu_einvoice/european_e_invoice/doctype/e_invoice_trade_tax/e_invoice_trade_tax.py Auto-generated type stub updated with `vat_exemption_reason_text: DF.SmallText

Sequence Diagram

sequenceDiagram
    participant SI as Sales Invoice
    participant EIG as EInvoiceGenerator
    participant DB as E Invoice Settings (DB)
    participant XML as E-Invoice XML

    SI->>EIG: create_einvoice()
    EIG->>DB: get_single_value("vat_exemption_reason_text")
    DB-->>EIG: reason_text (or "")
    EIG->>EIG: _set_taxes_for_item() [rate == 0]
    EIG->>EIG: _set_optional_vat_exemption_reason_text(trade_tax)
    EIG->>XML: trade_tax.exemption_reason = reason_text (BT-120)

    Note over EIG,XML: Document-level path
    EIG->>EIG: _add_taxes_and_charges()
    EIG->>EIG: _set_optional_vat_exemption_reason_text(trade_tax)
    EIG->>XML: trade_tax.exemption_reason = reason_text (BT-120)

    Note over SI,XML: Import path
    XML->>EIG: parse_tax(ApplicableTradeTax)
    EIG->>SI: t.vat_exemption_reason_text = exemption_reason._text
Loading

Reviews (1): Last reviewed commit: "feat: add BT-120 VAT exemption reason (#..." | Re-trigger Greptile

Comment thread eu_einvoice/locale/de.po Outdated
Comment thread eu_einvoice/locale/main.pot Outdated
@dafrose dafrose removed the conflicts label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants