Skip to content

feat: implement XML attachment file naming functionality#253

Merged
barredterra merged 4 commits into
alyf-de:developfrom
dafrose:feat-xml-auto-name
May 12, 2026
Merged

feat: implement XML attachment file naming functionality#253
barredterra merged 4 commits into
alyf-de:developfrom
dafrose:feat-xml-auto-name

Conversation

@dafrose

@dafrose dafrose commented Apr 24, 2026

Copy link
Copy Markdown
Member
  • Added E Invoice Settings field for global autonaming pattern for XML attachements.
  • Added get_xml_attachment_file_base_name function to resolve file names.
  • Introduced unit tests for various naming scenarios in test_xml_attachment_naming.py.
  • Updated Sales Invoice logic to utilize the new naming function for XML file attachments.
  • Integrated autonaming pattern into "Download XML" button on Sales Invoice.

Ref: IBT-164
closes #245

@dafrose dafrose changed the title feat: implement XML attachment file naming functionality #245 feat: implement XML attachment file naming functionality Apr 24, 2026
@greptile-apps

greptile-apps Bot commented Apr 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a configurable auto-naming pattern for XML attachment file names in E Invoice Settings, wires the new auto_name_format_for_xml_file field into both the auto-attach path (_attach_xml_file) and the manual download path (download_xrechnung), and covers the logic with dedicated unit tests.

  • Adds get_xml_attachment_file_base_name which splits the pattern on ., strips leading # from each segment to avoid triggering Frappe's naming-series counter logic, runs parse_naming_series, and passes the result through get_safe_file_name; errors fall back to doc.name.
  • Extends download_xrechnung to fetch the invoice document and perform an explicit permission check before generating the file name, which also avoids a redundant re-fetch inside get_einvoice.
  • Updates E Invoice Settings doctype (JSON, Python controller, translations) to expose the new Data field.

Confidence Score: 4/5

The core naming logic and its fallbacks are sound, but the new settings field is gated behind auto_attach_xml in the UI while the manual download path also reads it, leaving that path unconfigurable without auto-attach enabled.

The naming logic itself is well-implemented with proper sanitization and fallback. The one real defect is that auto_name_format_for_xml_file is hidden from the UI unless auto_attach_xml is checked, yet download_xrechnung always reads it — a user who only uses the download button cannot configure the naming pattern because the field never appears in their E Invoice Settings form.

eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json — the depends_on condition on auto_name_format_for_xml_file needs to be reconsidered or removed

Important Files Changed

Filename Overview
eu_einvoice/european_e_invoice/custom/sales_invoice.py Adds get_xml_attachment_file_base_name, updates download_xrechnung and _attach_xml_file to use configurable naming; one UX visibility concern noted
eu_einvoice/european_e_invoice/custom/test_sales_invoice.py New unit tests for get_xml_attachment_file_base_name covering empty/whitespace, dot-separated patterns, hash stripping, and sanitization edge cases
eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json Adds auto_name_format_for_xml_file Data field with depends_on: auto_attach_xml; field is also consumed by the manual download path which doesn't require auto-attach
eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.py Adds `auto_name_format_for_xml_file: DF.Data
eu_einvoice/locale/de.po Adds German translation for the new field label and updates Babel-generated metadata; no issues
eu_einvoice/locale/main.pot Updated translation template to include the new Auto Name Format for XML File label; no issues

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User action] --> B{Trigger}
    B --> |Submit / Auto-attach| C[_attach_xml_file]
    B --> |Download button| D[download_xrechnung]

    C --> E[frappe.get_cached_doc E Invoice Settings]
    D --> F[frappe.get_doc Sales Invoice]
    F --> G[check_permission read]
    G --> H[frappe.get_cached_doc E Invoice Settings]

    E --> I[get_xml_attachment_file_base_name doc, pattern]
    H --> I

    I --> J{pattern empty?}
    J --> |Yes| K[get_safe_file_name doc.name]
    J --> |No| L[lstrip # from each dot-segment]
    L --> M[parse_naming_series parts, doc]
    M --> N{result empty or error?}
    N --> |Yes / Exception| O[log_error + fallback to doc.name]
    N --> |No| P[get_safe_file_name base]

    K --> Q[base_name + .xml]
    O --> Q
    P --> Q
Loading

Reviews (3): Last reviewed commit: "refactor(eu_einvoice): enhance download_..." | Re-trigger Greptile

Comment thread eu_einvoice/xml_attachment_naming.py Outdated
Comment thread eu_einvoice/xml_attachment_naming.py Outdated
@dafrose

dafrose commented Apr 24, 2026

Copy link
Copy Markdown
Member Author

Here is, how this looks in Desk:

  1. Attachement disabled:
image
  1. Attachement enabled:
image
  1. Filename in Sales Invoice:
image

Comment thread eu_einvoice/xml_attachment_naming.py Outdated
@HenningWendtland

Copy link
Copy Markdown
Member

@dafrose I think allowing endings like .#### creates new (global) naming series counters in the database and is something that we do not need. Normally a user wants to:

  • use the docname or
  • a custom Invoice ID (may be a different field)

in the .xml name + some string like "Rechnung-", which makes the .xml prefix usually unique per Invoice, so no further numbering is needed

@dafrose

dafrose commented Apr 24, 2026

Copy link
Copy Markdown
Member Author

I removed the mention of .#### counters in the field description and added code to strip hashtag-segments entirely in aca4527.

@0xD0M1M0

Copy link
Copy Markdown
Collaborator

Just thinking of the manual "download"-button. Is there a reason, why, if the admin chooses to rename automatically, we would exclude it on this button?

Comment thread eu_einvoice/xml_attachment_naming.py Outdated
Comment thread eu_einvoice/xml_attachment_naming.py Outdated
@dafrose dafrose force-pushed the feat-xml-auto-name branch from 10a6f18 to a0e6a1e Compare April 28, 2026 13:12
… XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.
@dafrose dafrose force-pushed the feat-xml-auto-name branch from c009198 to 4812a5d Compare April 28, 2026 13:43
… base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.
@dafrose

dafrose commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

Just thinking of the manual "download"-button. Is there a reason, why, if the admin chooses to rename automatically, we would exclude it on this button?

I implemented the button behaviour @0xD0M1M0

I also squashed the commits after rearranging the files a little bit.

If there are no further comments, the PR is ready to be merged @barredterra

@barredterra barredterra self-requested a review April 28, 2026 16:38
@barredterra

Copy link
Copy Markdown
Member

@greptileai

Comment thread eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json Outdated
Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.
Comment thread eu_einvoice/european_e_invoice/custom/sales_invoice.py Outdated
Comment thread eu_einvoice/european_e_invoice/custom/sales_invoice.py Outdated
Comment thread eu_einvoice/european_e_invoice/custom/sales_invoice.py Outdated
Comment thread eu_einvoice/european_e_invoice/custom/sales_invoice.py Outdated
@barredterra

Copy link
Copy Markdown
Member

Functionality works fine, just some nitpicks on the code.

@dafrose dafrose requested a review from barredterra May 11, 2026 06:51
Comment thread eu_einvoice/european_e_invoice/custom/sales_invoice.py Outdated
@dafrose dafrose force-pushed the feat-xml-auto-name branch from bda172e to f740d09 Compare May 12, 2026 13:41
@dafrose dafrose requested a review from barredterra May 12, 2026 13:41
@dafrose dafrose force-pushed the feat-xml-auto-name branch 2 times, most recently from 05eb28c to d8e3413 Compare May 12, 2026 17:27
Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.
@dafrose dafrose force-pushed the feat-xml-auto-name branch from d8e3413 to 41de37a Compare May 12, 2026 17:29

@barredterra barredterra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested again, LGTM

@barredterra barredterra merged commit d45a1f0 into alyf-de:develop May 12, 2026
6 checks passed
@barredterra

Copy link
Copy Markdown
Member

@Mergifyio backport version-16-hotfix version-15-hotfix

@mergify

mergify Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

backport version-16-hotfix version-15-hotfix

✅ Backports have been created

Details

Cherry-pick of d45a1f0 has failed:

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

You are currently cherry-picking commit d45a1f0.
  (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
	new file:   eu_einvoice/european_e_invoice/custom/test_sales_invoice.py
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json
	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

Cherry-pick of d45a1f0 has failed:

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

You are currently cherry-picking commit d45a1f0.
  (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
	new file:   eu_einvoice/european_e_invoice/custom/test_sales_invoice.py
	modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   eu_einvoice/european_e_invoice/doctype/e_invoice_settings/e_invoice_settings.json
	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

dafrose added a commit that referenced this pull request May 15, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
(cherry picked from commit d45a1f0)
dafrose added a commit that referenced this pull request May 15, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
(cherry picked from commit d45a1f0)
Co-authored-by: Cursor <cursoragent@cursor.com>
dafrose added a commit that referenced this pull request May 15, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
(cherry picked from commit d45a1f0)
Co-authored-by: Cursor <cursoragent@cursor.com>
dafrose added a commit that referenced this pull request May 15, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
(cherry picked from commit d45a1f0)
Co-authored-by: Cursor <cursoragent@cursor.com>
@dafrose dafrose deleted the feat-xml-auto-name branch June 3, 2026 09:10
0xD0M1M0 pushed a commit to 0xD0M1M0/eu_einvoice that referenced this pull request Jun 5, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
dafrose added a commit that referenced this pull request Jun 8, 2026
* feat(eu_einvoice): configurable base name for auto-attached XRechnung XML

Add optional pattern on E Invoice Settings (auto_name_format_for_xml_file) for the
file base name when auto-attaching XML on Sales Invoice submit. Empty pattern keeps
using the document name; otherwise use naming-series-style segments (dot-separated,
parse_naming_series, {field} placeholders, date tokens), strip leading # per
segment so counter-only parts do not consume Series, sanitize with get_safe_file_name,
and fall back to the document name on error.

Colocate get_xml_attachment_file_base_name with Sales Invoice custom logic and cover
naming edge cases in test_sales_invoice.py.

Refresh E Invoice Settings controller and de / template catalogs for the new strings.

* refactor(eu_einvoice): enhance download_xrechnung to use configurable base name

Update the download_xrechnung function to retrieve the Sales Invoice document
and check permissions before generating the XML file.
The filename now utilizes a configurable base name from E Invoice Settings,
improving flexibility for file naming.
This change ensures that the generated XML file adheres to the specified naming format.

* chore(eu_einvoice): update E Invoice Settings and localization files

Rearrange fields in e_invoice_settings.json for better organization, adding a label for
the XML Settings section. Update localization files (de.po and main.pot) to reflect
changes in field names and add new translations for XML Settings.
Adjust POT creation dates for consistency.

* refactor(eu_einvoice): centralize sales invoice xml stem naming

Resolve the downloadable XML filename stem in get_xml_attachment_file_base_name:
read *Auto name format for XML file* from **E Invoice Settings** when the pattern
argument is omitted, accept an optional keyword-only pattern override, and build
the stem with parse_naming_series plus a no-op number generator so naming has no
series counter DB side effects. Sanitize with get_safe_file_name and fall back to
doc.name when the pattern is empty or fails.

Call sites use the helper without duplicating settings reads. Tests pass pattern=
for empty or whitespace patterns, and assert the settings-backed path by patching
frappe.get_single_value only for **E Invoice Settings** / auto_name_format_for_xml_file.

---------

Co-authored-by: Daniel Rose <26166128+dafrose@users.noreply.github.com>
(cherry picked from commit d45a1f0)
Co-authored-by: Cursor <cursoragent@cursor.com>
dafrose added a commit that referenced this pull request Jun 8, 2026
Combine BT-120 VAT exemption fields from #255 with XML attachment
naming from #253; regenerate locale catalogs via po_branch_maps replay.
dafrose added a commit that referenced this pull request Jun 8, 2026
Combine BT-120 VAT exemption fields from #255 with XML attachment
naming from #253; regenerate locale catalogs via po_branch_maps replay.
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.

feat: Auto Name Field for Auto-attach XML File feature

4 participants