[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.
This commit is contained in:
Haresh Shyara
2018-01-31 14:15:00 +01:00
committed by Simon Lejeune
parent 05305729ee
commit 4d77748e76
4 changed files with 24 additions and 6 deletions
+13
View File
@@ -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',
@@ -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;
@@ -20,6 +20,10 @@
<t t-set="domainClass" t-value="'o_stock_reports_domain_line_1'"/>
</t>
<t t-set="span_color" t-value="'color: #666666;'"/>
<t t-if="l.usage == 'in'"><t t-set="span_color" t-value="'color: #3c763d;'"/></t>
<t t-if="l.usage == 'out'"><t t-set="span_color" t-value="'color: #a94442;'"/></t>
<tr t-att-data-type="l.type" t-att-data-unfold="l.unfoldable" t-att-data-parent_id="l.parent_id" t-att-data-id="l.id" t-att-data-model_id="l.model_id" t-att-data-model="l.model" t-att-class="trclass">
<t t-if="l.unfoldable == true"><t t-set="tdclass" t-value="'o_stock_reports_unfoldable'" /></t>
<t t-set="column" t-value="0" />
@@ -38,7 +42,7 @@
</span>
</t>
<t t-if="l.reference != c">
<t t-if="typeof c == 'string' || typeof c == 'number'"><span>
<t t-if="typeof c == 'string' || typeof c == 'number'"><span t-att-style="span_color">
<t t-raw="c"/>
</span></t>
<t t-if="typeof c != 'string' &amp; typeof c != 'number'"><span t-att-style="c[1]">
@@ -13,6 +13,9 @@
<tr t-att-data-type="a['type']" t-att-data-unfold="a['unfoldable']" t-att-data-parent_id="a['parent_id']" t-att-data-id="a['id']" t-att-data-model_id="a['model_id']" t-att-data-model="a['model']" t-att-data-lot_id="a['lot_id']" t-att-class="trclass">
<t t-set="tdclass" t-value="''" />
<t t-set="spanclass" t-value="''" />
<t t-set="span_color" t-value="'color: #666666;'"/>
<t t-if="a['usage'] == 'in'"><t t-set="span_color" t-value="'color: #3c763d;'"/></t>
<t t-if="a['usage'] == 'out'"><t t-set="span_color" t-value="'color: #a94442;'"/></t>
<t t-if="a.get('unfoldable')"><t t-set="tdclass" t-value="'o_stock_reports_unfoldable'" /></t>
<t t-if="not a.get('unfoldable')"><t t-set="spanclass" t-value="'o_stock_reports_nofoldable'" /></t>
<t t-set="column" t-value="0" />
@@ -39,7 +42,7 @@
</span>
</t>
<t t-else="">
<span>
<span t-att-style="span_color">
<t t-raw="c"/>
</span>
</t>