From bd35a92532a28d2d26aa404d763a8d83034f7542 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Wed, 22 Apr 2026 13:04:58 +0200 Subject: [PATCH] [FIX] lighting_reporting_vanguard_product: round Flujo total to integer on datasheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Flujo total row on the vanguard technical datasheet (FUENTES DE LUZ section) was rendered via get_format_lang_decimal, which preserves all non-trailing-zero decimals — so a raw value of 3516.4125 was shown as "3.516,4125 lm", confusing the technical department and end customers. Per Albert Orteu (Lighting Projects), the spec is "sense cap decimal, números naturals" — Flujo total must always render as a natural integer, with the unit preserved. Extend _get_color_temperature_flux_values with an as_integer kwarg that coerces the value with int(round(...)) before handing it off to the existing get_format_lang_decimal helper (which returns "%g" for integer-valued numbers, matching how nominal_flux already renders integer values in this module). Storage is untouched and all other flux/wattage/color-consistency fields keep their prior formatting. --- .../models/lighting_product_source_line.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lighting_reporting_vanguard_product/models/lighting_product_source_line.py b/lighting_reporting_vanguard_product/models/lighting_product_source_line.py index 6d5c1e82..cd267f7d 100644 --- a/lighting_reporting_vanguard_product/models/lighting_product_source_line.py +++ b/lighting_reporting_vanguard_product/models/lighting_product_source_line.py @@ -18,13 +18,15 @@ def _prepend_source_num(self, value): values_l.append(value) return " ".join(values_l) - def _get_color_temperature_flux_values(self, flux_attr): + def _get_color_temperature_flux_values(self, flux_attr, as_integer=False): self.ensure_one() found = False flux_data = [] for flux in self.color_temperature_flux_ids: value = flux[flux_attr] if value: + if as_integer: + value = round(value) value = self.get_format_lang_decimal(value) + flux.flux_magnitude if not found: found = True @@ -42,7 +44,7 @@ def get_nominal_flux_display(self): def get_total_flux_display(self): self.ensure_one() return self._prepend_source_num( - self._get_color_temperature_flux_values("total_flux") + self._get_color_temperature_flux_values("total_flux", as_integer=True) ) def get_total_wattage_display(self):