[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:
@@ -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'):
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user