From 651e43abe53352065d3efdc9edd35ff98c8d0f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Todorovich?= Date: Thu, 5 Mar 2020 10:37:51 +0530 Subject: [PATCH] [ADD] Reference and Barcode column in stock inventory valuation report --- .../i18n/stock_inventory_valuation_report.pot | 17 +++++++++ .../stock_inventory_valuation_report.py | 8 +++-- .../stock_inventory_valuation_report.xml | 12 +++++-- .../stock_inventory_valuation_report_xlsx.py | 36 ++++++++++++++----- 4 files changed, 61 insertions(+), 12 deletions(-) diff --git a/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot b/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot index 5b8ac8a..54a277f 100644 --- a/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot +++ b/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot @@ -210,3 +210,20 @@ msgstr "" msgid "report.s_i_v_r.report_stock_inventory_valuation_report_xlsx" msgstr "" +#. module: stock_inventory_valuation_report +#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__name +#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__name +#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__name +#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header +msgid "Name" +msgstr "" + +#. module: stock_inventory_valuation_report +#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__reference +msgid "Reference" +msgstr "" + +#. module: stock_inventory_valuation_report +#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__barcode +msgid "Barcode" +msgstr "" diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py index 26caecf..715e05a 100644 --- a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py @@ -8,7 +8,9 @@ class StockInventoryValuationView(models.TransientModel): _name = 'stock.inventory.valuation.view' _description = 'Stock Inventory Valuation View' - display_name = fields.Char() + name = fields.Char() + reference = fields.Char() + barcode = fields.Char() qty_at_date = fields.Float() uom_id = fields.Many2one( comodel_name='uom.uom', @@ -54,7 +56,9 @@ class StockInventoryValuationReport(models.TransientModel): ReportLine = self.env['stock.inventory.valuation.view'] for product in products: line = { - 'display_name': product.display_name, + 'name': product.name, + 'reference': product.default_code, + 'barcode': product.barcode, 'qty_at_date': product.qty_at_date, 'uom_id': product.uom_id, 'currency_id': product.currency_id, diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml index 6f5fdb7..c927aba 100644 --- a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml @@ -99,7 +99,9 @@
#
-
Display Name
+
Reference
+
Name
+
Barcode
Quantity
Cost
Value
@@ -113,7 +115,13 @@
- + +
+
+ +
+
+
diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report_xlsx.py b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report_xlsx.py index 3cf992e..12e51fd 100644 --- a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report_xlsx.py +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report_xlsx.py @@ -23,16 +23,34 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel): }, 'width': 12, }, - '2_display_name': { + '2_reference': { 'header': { - 'value': 'Display Name', + 'value': 'Reference', }, 'data': { - 'value': self._render('display_name'), + 'value': self._render('reference'), + }, + 'width': 15, + }, + '3_name': { + 'header': { + 'value': 'Name', + }, + 'data': { + 'value': self._render('name'), }, 'width': 36, }, - '3_qty_at_date': { + '4_barcode': { + 'header': { + 'value': 'Barcode', + }, + 'data': { + 'value': self._render('barcode'), + }, + 'width': 15, + }, + '5_qty_at_date': { 'header': { 'value': 'Quantity', }, @@ -42,7 +60,7 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel): }, 'width': 18, }, - '4_standard_price': { + '6_standard_price': { 'header': { 'value': 'Cost', }, @@ -52,7 +70,7 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel): }, 'width': 18, }, - '5_stock_value': { + '7_stock_value': { 'header': { 'value': 'Value', }, @@ -109,7 +127,9 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel): ws, row_pos, ws_params, col_specs_section='data', render_space={ 'n': row_pos-5, - 'display_name': line.display_name or '', + 'name': line.name or '', + 'reference': line.reference or '', + 'barcode': line.barcode or '', 'qty_at_date': line.qty_at_date or 0.000, 'standard_price': line.standard_price or 0.00, 'stock_value': line.stock_value or 0.00, @@ -117,4 +137,4 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel): default_format=self.format_tcell_left) total += line.stock_value - ws.write(row_pos, 4, total, self.format_theader_blue_amount_right) + ws.write(row_pos, 6, total, self.format_theader_blue_amount_right)