[ADD] Reference and Barcode column in stock inventory valuation report

This commit is contained in:
Iván Todorovich
2020-03-05 10:37:51 +05:30
committed by Alessandro Uffreduzzi
parent e32de8e49d
commit f2d52d4637
5 changed files with 63 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
{ {
'name': 'Stock Inventory Valuation Report', 'name': 'Stock Inventory Valuation Report',
'summary': 'Add report button on Inventory Valuation.', 'summary': 'Add report button on Inventory Valuation.',
'version': '12.0.1.0.0', 'version': '12.0.1.1.1',
'category': 'Warehouse', 'category': 'Warehouse',
'website': 'https://github.com/OCA/stock-logistics-reporting', 'website': 'https://github.com/OCA/stock-logistics-reporting',
'author': 'Ecosoft,Odoo Community Association (OCA)', 'author': 'Ecosoft,Odoo Community Association (OCA)',

View File

@@ -23,6 +23,12 @@ msgstr ""
msgid "<span class=\"fa fa-print\"/>Print" msgid "<span class=\"fa fa-print\"/>Print"
msgstr "" msgstr ""
#. module: stock_inventory_valuation_report
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__barcode
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
msgid "Barcode"
msgstr ""
#. module: stock_inventory_valuation_report #. module: stock_inventory_valuation_report
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__company_id #: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__company_id
msgid "Company" msgid "Company"
@@ -77,7 +83,6 @@ msgstr ""
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__display_name #: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__display_name
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__display_name #: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__display_name
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__display_name #: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__display_name
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@@ -125,6 +130,12 @@ msgstr ""
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
#. module: stock_inventory_valuation_report
#: 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 #. module: stock_inventory_valuation_report
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters #: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters
msgid "Partner" msgid "Partner"
@@ -140,6 +151,12 @@ msgstr ""
msgid "Quantity" msgid "Quantity"
msgstr "" msgstr ""
#. module: stock_inventory_valuation_report
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__reference
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
msgid "Reference"
msgstr ""
#. module: stock_inventory_valuation_report #. module: stock_inventory_valuation_report
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__results #: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__results
msgid "Results" msgid "Results"

View File

@@ -8,7 +8,9 @@ class StockInventoryValuationView(models.TransientModel):
_name = 'stock.inventory.valuation.view' _name = 'stock.inventory.valuation.view'
_description = '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() qty_at_date = fields.Float()
uom_id = fields.Many2one( uom_id = fields.Many2one(
comodel_name='uom.uom', comodel_name='uom.uom',
@@ -59,7 +61,9 @@ class StockInventoryValuationReport(models.TransientModel):
self.env.user.company_id.id, self.env.user.company_id.id,
date=self.date) date=self.date)
line = { line = {
'display_name': product.display_name, 'name': product.name,
'reference': product.default_code,
'barcode': product.barcode,
'qty_at_date': product.qty_at_date, 'qty_at_date': product.qty_at_date,
'uom_id': product.uom_id, 'uom_id': product.uom_id,
'currency_id': product.currency_id, 'currency_id': product.currency_id,

View File

@@ -99,7 +99,9 @@
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">#</div> <div class="act_as_cell">#</div>
<div class="act_as_cell">Display Name</div> <div class="act_as_cell">Reference</div>
<div class="act_as_cell">Name</div>
<div class="act_as_cell">Barcode</div>
<div class="act_as_cell">Quantity</div> <div class="act_as_cell">Quantity</div>
<div class="act_as_cell">Cost</div> <div class="act_as_cell">Cost</div>
<div class="act_as_cell">Value</div> <div class="act_as_cell">Value</div>
@@ -113,7 +115,13 @@
<t t-esc="n"/> <t t-esc="n"/>
</div> </div>
<div class="act_as_cell left"> <div class="act_as_cell left">
<t t-esc="line.display_name"/> <t t-esc="line.reference"/>
</div>
<div class="act_as_cell left">
<t t-esc="line.name"/>
</div>
<div class="act_as_cell left">
<t t-esc="line.barcode"/>
</div> </div>
<div class="act_as_cell right"> <div class="act_as_cell right">
<t t-esc="'{0:,.3f}'.format(line.qty_at_date)"/> <t t-esc="'{0:,.3f}'.format(line.qty_at_date)"/>

View File

@@ -23,16 +23,34 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel):
}, },
'width': 12, 'width': 12,
}, },
'2_display_name': { '2_reference': {
'header': { 'header': {
'value': 'Display Name', 'value': 'Reference',
}, },
'data': { 'data': {
'value': self._render('display_name'), 'value': self._render('reference'),
},
'width': 15,
},
'3_name': {
'header': {
'value': 'Name',
},
'data': {
'value': self._render('name'),
}, },
'width': 36, 'width': 36,
}, },
'3_qty_at_date': { '4_barcode': {
'header': {
'value': 'Barcode',
},
'data': {
'value': self._render('barcode'),
},
'width': 15,
},
'5_qty_at_date': {
'header': { 'header': {
'value': 'Quantity', 'value': 'Quantity',
}, },
@@ -42,7 +60,7 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel):
}, },
'width': 18, 'width': 18,
}, },
'4_standard_price': { '6_standard_price': {
'header': { 'header': {
'value': 'Cost', 'value': 'Cost',
}, },
@@ -52,7 +70,7 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel):
}, },
'width': 18, 'width': 18,
}, },
'5_stock_value': { '7_stock_value': {
'header': { 'header': {
'value': 'Value', 'value': 'Value',
}, },
@@ -109,7 +127,9 @@ class ReportStockInventoryValuationReportXlsx(models.TransientModel):
ws, row_pos, ws_params, col_specs_section='data', ws, row_pos, ws_params, col_specs_section='data',
render_space={ render_space={
'n': row_pos-5, '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, 'qty_at_date': line.qty_at_date or 0.000,
'standard_price': line.standard_price or 0.00, 'standard_price': line.standard_price or 0.00,
'stock_value': line.stock_value 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) default_format=self.format_tcell_left)
total += line.stock_value 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)