Skip to content

[16.0][IMP] lighting_export*: fixes, improvements and translations#84

Merged
eantones merged 9 commits into16.0from
16.0-imp-lighting_export-fixes_and_translations
Mar 8, 2026
Merged

[16.0][IMP] lighting_export*: fixes, improvements and translations#84
eantones merged 9 commits into16.0from
16.0-imp-lighting_export-fixes_and_translations

Conversation

@eantones
Copy link
Member

@eantones eantones commented Mar 8, 2026

Summary

  • lighting_export_bmecat: Fix XSD error on long product descriptions, remove unnecessary mail dependency, remove inline xmlstarlet installation
  • lighting_export_xlsx: Fix duplicated field label crash, fix serialized/binary field crashes, validate duplicate column labels before export, format date/datetime cells with locale-aware Excel formats, convert datetime values from UTC to user timezone
  • lighting_export: Add translations for all languages (es, ca, fr, pt, de, it)
  • lighting_export_xlsx: Add and complete translations for all languages
  • lighting_export_json: Add missing translations (ca, de, it), update stale es/fr/pt from Odoo 11 to Odoo 16 format, remove inherited model/field entries that belong to other modules

Test plan

  • Export a template with date/datetime fields and verify they show formatted dates (not integers) in Excel
  • Export a template with binary fields and verify it shows file sizes instead of crashing
  • Export a template with duplicate field labels and verify a clear ValidationError is raised
  • Verify the UI shows translated field labels in es/ca on the export template form
  • Verify BMEcat export works with long product descriptions

eantones added 9 commits March 8, 2026 11:49
fields_get resolves field labels by following base_field, which for
_inherits delegated fields points to the parent model. This caused
delegated fields like "code" (from product.product) to get the parent
model's label instead of lighting.product's own label. When two fields
from different models shared the same translated label (e.g. "code"
and "reference" both resolving to "Referencia" in Spanish), the export
crashed with "The field 'Referencia' is duplicated".

Use line.field_id.field_description (from ir.model.fields, scoped to
the correct model) instead of the label returned by fields_get.
Serialized fields (e.g. json_search_cri, json_search_wattage) store
raw JSON values such as lists of ints or strings. The export code did
not handle the "serialized" field type, so these raw lists passed the
isinstance(datum, (tuple, list)) check and reached _get_meta_num,
which expects a list of dicts, causing:
  AttributeError: 'int' object has no attribute 'keys'

Convert serialized field values to their JSON string representation.
…xport

When the export template has multiple fields resolving to the same
column name (e.g. two fields both labeled "SAP B1 Bindings"), the export
would crash with an internal "The field 'X' is duplicated" error.

Detect all duplicate column labels upfront and raise a user-friendly
ValidationError listing every conflict and guiding the user to set a
distinct label on the template field definition, or remove the
duplicate.
Rewrite es.po and fr.po removing parent model strings that don't
belong to this module and fixing bad translations (technical names
used as translations). Add missing ca.po, de.po, it.po and pt.po
for all installed languages.
Binary field values are bytes objects that xlsxwriter cannot write
to cells. Export the human-readable file size instead, matching
how Odoo displays binary fields in tree views.
…port

Use xlsxwriter's write_datetime with locale-aware number formats
derived from Odoo's res.lang date/time settings instead of writing
raw values. Extract field type conversion logic into a dedicated
method to improve readability.
… export

Datetime values are stored in UTC in the database. Convert them to the
user's timezone before writing to Excel so exported times match what
users see in the Odoo interface.
…uages

Add missing ca, de, it translations and update stale es, fr, pt files
from Odoo 11 to current Odoo 16 format. Remove inherited model and
field entries that belong to other modules.
@eantones eantones force-pushed the 16.0-imp-lighting_export-fixes_and_translations branch from c7fafd6 to 419e0c3 Compare March 8, 2026 10:51
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 16.07143% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.93%. Comparing base (3ca0576) to head (419e0c3).
⚠️ Report is 9 commits behind head on 16.0.

Files with missing lines Patch % Lines
lighting_export_xlsx/report/export_product_xlsx.py 16.07% 47 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             16.0      #84      +/-   ##
==========================================
- Coverage   44.03%   43.93%   -0.11%     
==========================================
  Files         283      283              
  Lines        8007     8044      +37     
  Branches     1543     1549       +6     
==========================================
+ Hits         3526     3534       +8     
- Misses       4386     4415      +29     
  Partials       95       95              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eantones eantones merged commit d7e4d64 into 16.0 Mar 8, 2026
4 of 6 checks passed
@eantones eantones deleted the 16.0-imp-lighting_export-fixes_and_translations branch March 8, 2026 10:58
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.

1 participant