summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramoyaux <arm@odoo.com>2017-08-11 16:17:48 +0200
committeramoyaux <arm@odoo.com>2017-08-17 17:16:34 +0200
commit9054d082be2d388801dfefe2f7758a1d62ea0cc2 (patch)
treef08c49d9b099118321eecca0e299987053ba68a5
parent2a160329bb39edd3580bb46f98dd5a2ae9c4f9de (diff)
[IMP] stock: picking and ml views improvements.
commit 0a960c08757a8ba5e1dc1dd36c17a35de8913975 introduced change about reserved quantity that set it to 0 once the move is done. This commit add views improvement. If the move lines are done reserved quantity does not really matter and thus it is better to not display it. Modify the decorator on stock picking that change the font to red if the quantity processed is greater than the reserved quantity. This decorator does not trigger if the picking is in state done since reserved quantity is always 0.
-rw-r--r--addons/stock/models/stock_move.py1
-rw-r--r--addons/stock/views/stock_move_views.xml2
-rw-r--r--addons/stock/views/stock_picking_views.xml2
3 files changed, 3 insertions, 2 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index d0d51e0f217..5eab237011e 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -436,6 +436,7 @@ class StockMove(models.Model):
show_source_location=self.location_id.child_ids,
show_destination_location=self.location_dest_id.child_ids,
show_package=not self.location_id.usage == 'supplier',
+ show_reserved_quantity=self.state != 'done'
),
}
diff --git a/addons/stock/views/stock_move_views.xml b/addons/stock/views/stock_move_views.xml
index c9a906b5da3..6c9e5230575 100644
--- a/addons/stock/views/stock_move_views.xml
+++ b/addons/stock/views/stock_move_views.xml
@@ -176,7 +176,7 @@
<field name="package_id" invisible="not context.get('show_package')" groups="stock.group_tracking_lot"/>
<field name="result_package_id" groups="stock.group_tracking_lot"/>
<field name="owner_id" groups="stock.group_tracking_owner"/>
- <field name="product_uom_qty" readonly="1"/>
+ <field name="product_uom_qty" invisible="not context.get('show_reserved_quantity')" readonly="1"/>
<field name="qty_done"/>
<field name="product_uom_id" options="{'no_open': True, 'no_create': True}" attrs="{'readonly': [('product_uom_qty', '!=', 0.0)]}" string="Unit of Measure" groups="product.group_uom"/>
</tree>
diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml
index 1fca0c2b2b2..66b287e8cab 100644
--- a/addons/stock/views/stock_picking_views.xml
+++ b/addons/stock/views/stock_picking_views.xml
@@ -277,7 +277,7 @@
<page string="Operations">
<field name="id" invisible="1"/>
<field name="move_lines" attrs="{'readonly': [('state', 'in', ('cancel', 'done'))]}" context="{'default_picking_id': id, 'form_view_ref':'stock.view_move_picking_form', 'address_in_id': partner_id, 'default_picking_type_id': picking_type_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}">
- <tree decoration-danger="quantity_done > reserved_availability" decoration-muted="scrapped == True" string="Stock Moves" editable="bottom">
+ <tree decoration-danger="state != 'done' and quantity_done > reserved_availability" decoration-muted="scrapped == True" string="Stock Moves" editable="bottom">
<field name="name" invisible="1"/>
<field name="date_expected" invisible="1"/>
<field name="state" invisible="1" readonly="0"/>