diff options
| author | Goffin Simon <sig@odoo.com> | 2018-12-04 10:33:31 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2018-12-04 10:33:31 +0000 |
| commit | edc1cbc063535fa69a526dc3d069dca76daadd63 (patch) | |
| tree | dc9efb0c32c82bf50c74827f57885004e48a4e06 /addons | |
| parent | 24f7c7ce7f371bbc6c820f458de16e26a943723f (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/stock/models/stock_inventory.py | 1 | ||||
| -rw-r--r-- | addons/stock/views/stock_inventory_views.xml | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index c63288d8b60..682fb083da1 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -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) diff --git a/addons/stock/views/stock_inventory_views.xml b/addons/stock/views/stock_inventory_views.xml index f6c60243c22..0aef58e898c 100644 --- a/addons/stock/views/stock_inventory_views.xml +++ b/addons/stock/views/stock_inventory_views.xml @@ -164,7 +164,8 @@ <tree string="Inventory Details" editable="bottom" decoration-info="product_qty != theoretical_qty" decoration-danger="theoretical_qty < 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"/> |
