[FIX] stock: To prevent settig a wrong uom

Steps to reproduce the bug:

- Configure to use UoM
- Make an inventory adjustment for all product
- Select one product one the inventory line, and select the UoM

Bug:

All the UoMs were selectable but only the uoms in the same category of
the product are allowed.

opw:1911941

closes odoo/odoo#29238
This commit is contained in:
Goffin Simon
2018-12-04 10:33:31 +00:00
parent 24f7c7ce7f
commit edc1cbc063
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -333,6 +333,7 @@ class InventoryLine(models.Model):
'uom.uom', 'Product Unit of Measure',
required=True,
default=lambda self: self.env.ref('uom.product_uom_unit', raise_if_not_found=True))
product_uom_category_id = fields.Many2one(string='Uom category', related='product_uom_id.category_id', readonly=True)
product_qty = fields.Float(
'Checked Quantity',
digits=dp.get_precision('Product Unit of Measure'), default=0)
+2 -1
View File
@@ -164,7 +164,8 @@
<tree string="Inventory Details" editable="bottom" decoration-info="product_qty != theoretical_qty" decoration-danger="theoretical_qty &lt; 0">
<field name="product_tracking" invisible="1"/>
<field name="product_id" domain="[('type','=','product')]" attrs="{'readonly': [('parent.filter', '=', 'product')]}" force_save="1"/>
<field name="product_uom_id" string="UoM" groups="uom.group_uom"/>
<field name="product_uom_id" string="UoM" groups="uom.group_uom" domain="[('category_id', '=', product_uom_category_id)]"/>
<field name="product_uom_category_id" invisible="1"/>
<field name="location_id" domain="[('id', 'child_of', parent.location_id)]" groups="stock.group_stock_multi_locations"/>
<field name="prod_lot_id" domain="[('product_id', '=', product_id)]" attrs="{'readonly': [('product_tracking', '=', 'none')]}" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/>
<field name="package_id" domain="['|', ('location_id','=', False), ('location_id', '=', location_id)]" groups="stock.group_tracking_lot"/>