[IMP] stock: hide quant lot_id when no tracked

On the editable list quant view, when user come from a non tracked
product, the `lot_id` field is hidden.

Task #2006337
This commit is contained in:
svs-odoo
2019-06-27 09:00:21 +00:00
parent 344614b54a
commit 9a7e66bc0e
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -414,7 +414,9 @@ class Product(models.Model):
def action_open_quants(self):
location_domain = self._get_domain_locations()[0]
domain = expression.AND([[('product_id', 'in', self.ids)], location_domain])
self = self.with_context(hide_location=not self.user_has_groups('stock.group_stock_multi_locations'))
hide_location = not self.user_has_groups('stock.group_stock_multi_locations')
hide_lot = all([product.tracking == 'none' for product in self])
self = self.with_context(hide_location=hide_location, hide_lot=hide_lot)
# If user have rights to write on quant, we define the view as editable.
if self.user_has_groups('stock.group_stock_manager'):
+1
View File
@@ -89,6 +89,7 @@
'readonly': ['|', ('id', '!=', False), ('tracking', 'not in', ['serial', 'lot'])],
'required': [('tracking', '!=', 'none')]
}"
invisible="context.get('hide_lot', False)"
context="{'default_product_id': product_id}"
domain="[('product_id', '=', product_id)]"/>
<field name="package_id" groups="stock.group_tracking_lot"