feat: implement XML attachment file naming functionality (backport #253)#257
feat: implement XML attachment file naming functionality (backport #253)#257mergify[bot] wants to merge 2 commits into
Conversation
|
Cherry-pick of d45a1f0 has failed: 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 SummaryThis backport of #253 adds configurable XML attachment file naming to the E Invoice workflow: a new
Confidence Score: 2/5Not safe to merge — three files contain raw git conflict markers that make the doctype JSON invalid and break the German locale. The Python implementation in
Important Files Changed
|
0e23163 to
b40013c
Compare
* 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>
Frappe v15 does not expose get_safe_file_name on file utils; mirror the v17+ implementation beside get_xml_attachment_file_base_name as _get_safe_file_name.
b40013c to
f8aa2b0
Compare
get_xml_attachment_file_base_namefunction to resolve file names.test_xml_attachment_naming.py.Ref: IBT-164
closes #245
This is an automatic backport of pull request #253 done by Mergify.