From 594c3fb0ed0fde151dc06986e955585969db2c7b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 21 Oct 2024 17:31:02 +0200 Subject: [PATCH] [IMP] stock_valuation_xlsx: add barcode in stock variation report Fix empty col in variation XLSX report --- stock_valuation_xlsx/wizard/stock_valuation_xlsx.py | 2 +- stock_valuation_xlsx/wizard/stock_variation_xlsx.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py b/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py index de5b506..75741fa 100644 --- a/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py +++ b/stock_valuation_xlsx/wizard/stock_valuation_xlsx.py @@ -553,7 +553,7 @@ class StockValuationXlsx(models.TransientModel): def _prepare_cols(self): cols = { 'default_code': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Code')}, - 'barcode': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Barcode')}, + 'barcode': {'width': 18, 'style': 'regular', 'sequence': 15, 'title': _('Product Barcode')}, 'product_name': {'width': 40, 'style': 'regular', 'sequence': 20, 'title': _('Product Name')}, 'loc_name': {'width': 25, 'style': 'regular_small', 'sequence': 30, 'title': _('Location Name')}, 'lot_name': {'width': 18, 'style': 'regular', 'sequence': 40, 'title': _('Lot')}, diff --git a/stock_valuation_xlsx/wizard/stock_variation_xlsx.py b/stock_valuation_xlsx/wizard/stock_variation_xlsx.py index 06a6758..46457e6 100644 --- a/stock_valuation_xlsx/wizard/stock_variation_xlsx.py +++ b/stock_valuation_xlsx/wizard/stock_variation_xlsx.py @@ -342,6 +342,8 @@ class StockVariationXlsx(models.TransientModel): sheet.write_formula(i, cols['end_subtotal']['pos'], end_subtotal_formula, styles[cols['end_subtotal']['style']], l['end_subtotal']) for col_name, col in cols.items(): if not col.get('formula'): + if not l[col_name]: + l[col_name] = '' # to avoid display of 31/12/1899 (dates) or '0' (char) if col.get('type') == 'date' and l[col_name]: l[col_name] = fields.Date.from_string(l[col_name]) sheet.write(i, col['pos'], l[col_name], styles[col['style']]) @@ -388,6 +390,7 @@ class StockVariationXlsx(models.TransientModel): def _prepare_cols(self): cols = { 'default_code': {'width': 18, 'style': 'regular', 'sequence': 10, 'title': _('Product Code')}, + 'barcode': {'width': 18, 'style': 'regular', 'sequence': 15, 'title': _('Product Barcode')}, 'product_name': {'width': 40, 'style': 'regular', 'sequence': 20, 'title': _('Product Name')}, 'uom_name': {'width': 5, 'style': 'regular_small', 'sequence': 30, 'title': _('UoM')}, 'start_qty': {'width': 8, 'style': 'regular', 'sequence': 40, 'title': _('Start Qty')},