feat: implement XML attachment file naming functionality (backport #253)#258
feat: implement XML attachment file naming functionality (backport #253)#258mergify[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 (from #253) introduces configurable XML attachment file naming for Sales Invoices: a new
Confidence Score: 1/5Not safe to merge — three committed files are broken due to unresolved backport merge conflicts. The Python implementation and tests are solid, but e_invoice_settings.json is invalid JSON with literal conflict markers, meaning Frappe will fail to load the E Invoice Settings DocType entirely. Both locale files (de.po, main.pot) are also corrupted by the same unresolved conflict, breaking German translations. These files must be corrected before merging. e_invoice_settings.json, de.po, and main.pot all require manual conflict resolution before this backport can be merged. Important Files Changed
|
4ac1f3d to
f67eb48
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 v16+ implementation beside get_xml_attachment_file_base_name as _get_safe_file_name.
f67eb48 to
3ed4c2e
Compare
|
Conflicts are resolved and I added a _get_safe_filename local helper, because it did not exist in frappe v15. |
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.