[FIX] stock: display of the traceability report in a picking

When nothing is tracked in the picking, there's no need to display the traceability report stat button.

task 1815243
This commit is contained in:
Priyanka Kakadiya
2018-03-23 10:35:10 +01:00
committed by Simon Lejeune
parent 39d9c362c5
commit 8e564993fc
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -300,11 +300,16 @@ class Picking(models.Model):
product_id = fields.Many2one('product.product', 'Product', related='move_lines.product_id')
show_operations = fields.Boolean(compute='_compute_show_operations')
show_lots_text = fields.Boolean(compute='_compute_show_lots_text')
has_tracking = fields.Boolean(compute='_compute_has_tracking')
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Reference must be unique per company!'),
]
def _compute_has_tracking(self):
for picking in self:
picking.has_tracking = any(m.has_tracking != 'none' for m in picking.move_lines)
@api.depends('picking_type_id.show_operations')
def _compute_show_operations(self):
for picking in self:
+2 -1
View File
@@ -227,13 +227,14 @@
<sheet>
<div class="oe_button_box" name="button_box">
<field name="has_scrap_move" invisible="True"/>
<field name="has_tracking" invisible="True"/>
<button name="action_see_move_scrap" string="Scraps" type="object"
class="oe_stat_button" icon="fa-arrows-v"
attrs="{'invisible': [('has_scrap_move', '=', False)]}"/>
<button name="action_see_packages" string="Packages" type="object"
class="oe_stat_button" icon="fa-cubes"
attrs="{'invisible': [('has_packages', '=', False)]}"/>
<button name="%(action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Up/Down Traceability" type="action" states="done" groups="stock.group_production_lot"/>
<button name="%(action_stock_report)d" attrs="{'invisible': ['|', ('state', '!=', 'done'), ('has_tracking', '=', False)]}" icon="fa-arrow-up" class="oe_stat_button" string="Up/Down Traceability" type="action" groups="stock.group_production_lot"/>
</div>
<h1 class="hidden-xs">
<field name="name" attrs="{'invisible': [('name','=','/')]}" readonly="1"/>