[16.0][IMP] lighting_export_xlsx: group attachment columns by type#101
Open
deeniiz wants to merge 2 commits into
Open
[16.0][IMP] lighting_export_xlsx: group attachment columns by type#101deeniiz wants to merge 2 commits into
deeniiz wants to merge 2 commits into
Conversation
Replace the position-based attachment columns (Adjuntos1/Tipo,
Adjuntos1/URL, Adjuntos2/Tipo, ...) with type-based columns where each
attachment type is its own column ("Foto producto (F) 1", "Foto de
aplicacion (FA) 1", "Foto de aplicacion (FA) 2", ...). The Tipo column
is eliminated; the type becomes the column header itself.
LightingAttachment.export_xlsx now returns an OrderedDict (one entry per
attachment, keyed by "<type display_name> <N>") instead of a list of
{Tipo, URL} dicts. The counter is per type and per product, starting at
1.
The report gains a new _set_flat_columns helper plus an
isinstance(datum, dict) branch in _generate_products so that this new
flat return shape is expanded directly into obj_d and meta["subfields"]
without the "FieldNameJ/" prefix that _get_meta_num applies. The
existing list[OrderedDict] path used by other one2many fields
(suppliers, sources, ...) is untouched.
After processing all products, sort the accumulated meta["subfields"] of flat-mode fields (attachments) according to the template's attachment_ids.sequence, grouping duplicates of the same type contiguously (FA 1, FA 2, FA 3, ...). Without this sort, the column order was insertion-order during product iteration: a type only present in a later-processed product ended up at the right of the spreadsheet even if the template defined it earlier. The sort key is built from a type display_name -> sequence map derived from template_id.attachment_ids, parsing each subfield with rsplit to extract (type, counter). Only fields flagged with _flat_mode are sorted, so the existing position-based one2many fields (suppliers, sources, ...) are not affected.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 16.0 #101 +/- ##
==========================================
- Coverage 43.91% 43.77% -0.15%
==========================================
Files 285 285
Lines 8149 8181 +32
Branches 1566 1576 +10
==========================================
+ Hits 3579 3581 +2
- Misses 4475 4505 +30
Partials 95 95 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.