From 4d77748e7627a453c02936c8795584e47faad91c Mon Sep 17 00:00:00 2001 From: Haresh Shyara Date: Fri, 12 Jan 2018 17:37:41 +0530 Subject: [PATCH] [IMP] stock: set text color on report line - Outgoing moves should be in red (if going out of the stock). - Incoming moves should be in green (if entering the stock). - Internal moves should be in black. - No lines in bold anymore in the report. --- addons/stock/models/stock_traceability.py | 13 +++++++++++++ .../static/src/less/stock_traceability_report.less | 6 ++---- .../src/xml/stock_traceability_report_line.xml | 6 +++++- addons/stock/views/report_stock_traceability.xml | 5 ++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/addons/stock/models/stock_traceability.py b/addons/stock/models/stock_traceability.py index 9bddd8cabf0..7cb3b3ba18c 100644 --- a/addons/stock/models/stock_traceability.py +++ b/addons/stock/models/stock_traceability.py @@ -92,6 +92,16 @@ class MrpStockReport(models.TransientModel): ref = move_line.move_id.scrap_ids[0].name return res_model, res_id, ref + def _get_usage(self, move_line): + usage = '' + if (move_line.location_id.usage == 'internal') and (move_line.location_dest_id.usage == 'internal'): + usage = 'internal' + elif (move_line.location_id.usage != 'internal') and (move_line.location_dest_id.usage == 'internal'): + usage = 'in' + else: + usage = 'out' + return usage + def make_dict_move(self, level, parent_id, move_line, unfoldable=False): res_model, res_id, ref = self.get_links(move_line) dummy, is_used = self._get_linked_move_lines(move_line) @@ -101,6 +111,7 @@ class MrpStockReport(models.TransientModel): 'date': move_line.move_id.date, 'parent_id': parent_id, 'is_used': bool(is_used), + 'usage': self._get_usage(move_line), 'model_id': move_line.id, 'model':'stock.move.line', 'product_id': move_line.product_id.display_name, @@ -122,6 +133,7 @@ class MrpStockReport(models.TransientModel): 'unfoldable': False if not move_line.lot_id else True, 'date': move_line.move_id.date, 'model_id': move_line.id, + 'usage': self._get_usage(move_line), 'parent_id': parent_id, 'model': model or 'stock.move.line', 'product_id': move_line.product_id.display_name, @@ -155,6 +167,7 @@ class MrpStockReport(models.TransientModel): 'model': data['model'], 'model_id': data['model_id'], 'parent_id': data['parent_id'], + 'usage': data.get('usage', False), 'is_used': data.get('is_used', False), 'lot_id': data.get('lot_id', False), 'type': 'line', diff --git a/addons/stock/static/src/less/stock_traceability_report.less b/addons/stock/static/src/less/stock_traceability_report.less index 3c0c4bce65d..8d4052b9683 100644 --- a/addons/stock/static/src/less/stock_traceability_report.less +++ b/addons/stock/static/src/less/stock_traceability_report.less @@ -1,8 +1,7 @@ -.o_stock_reports_lines(@border-width: 5px, @color: inherit, @font-weight: inherit, @border-top-style: initial, @border-bottom-style: initial) { +.o_stock_reports_lines(@border-width: 5px, @font-weight: inherit, @border-top-style: initial, @border-bottom-style: initial) { border-width: @border-width; border-left-style: hidden; border-right-style: hidden; - color: @color; font-weight: @font-weight; border-top-style: @border-top-style; border-bottom-style: @border-bottom-style; @@ -25,13 +24,12 @@ overflow-x:scroll; } background-color: @odoo-view-background-color; - color: @odoo-main-text-color; &.o_stock_reports_no_print { padding-bottom: 125px; margin: @odoo-horizontal-padding auto; .o-webclient-padding(@top: @odoo-sheet-vpadding, @bottom: @odoo-sheet-vpadding); .o_stock_reports_level0 { - .o_stock_reports_lines(@border-width: 1px, @color: @odoo-brand-primary, @font-weight: bold, @border-top-style: solid, @border-bottom-style: groove); + .o_stock_reports_lines(@border-width: 1px, @font-weight: normal, @border-top-style: solid, @border-bottom-style: groove); } .o_stock_reports_table { white-space: nowrap; diff --git a/addons/stock/static/src/xml/stock_traceability_report_line.xml b/addons/stock/static/src/xml/stock_traceability_report_line.xml index 60903e6a4e5..1a4cc85fdc1 100644 --- a/addons/stock/static/src/xml/stock_traceability_report_line.xml +++ b/addons/stock/static/src/xml/stock_traceability_report_line.xml @@ -20,6 +20,10 @@ + + + + @@ -38,7 +42,7 @@ - + diff --git a/addons/stock/views/report_stock_traceability.xml b/addons/stock/views/report_stock_traceability.xml index 4b6eb03c36a..d4800eac77c 100644 --- a/addons/stock/views/report_stock_traceability.xml +++ b/addons/stock/views/report_stock_traceability.xml @@ -13,6 +13,9 @@ + + + @@ -39,7 +42,7 @@ - +