Skip to content

Commit

Permalink
[FIX] mrp_subcontracting: changing UoM causes unreserve issues
Browse files Browse the repository at this point in the history
Before this commit:
It was possible to purchase a subcontracted product and on the receipt of the product, change the unit of measure o on the stock move lines of the components when the quantities were already reserved.
This caused unreserve issue given that, all of a sudden, instead of having 200g, we would have 200kg reserved and the change would not be reflected on the quant.

After this commit:
The view was modified to not allow changes of UoM if there are reserved quantities, or if the state is done.

OPW-3742720

X-original-commit: 35da769
  • Loading branch information
pno-odoo committed Feb 19, 2024
1 parent 07177bb commit 5cb12ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/mrp_subcontracting/views/stock_move_views.xml
Expand Up @@ -23,10 +23,11 @@
attrs="{'invisible': [('tracking', 'not in', ('serial', 'lot'))], 'required': [('tracking', 'in', ('serial', 'lot'))]}"
context="{'default_product_id': product_id, 'default_company_id': company_id}"/>
<field name="reserved_uom_qty" readonly="1" force_save="1"/>
<field name="qty_done"
<field name="qty_done"
decoration-warning="reserved_uom_qty &lt; qty_done"
decoration-success="reserved_uom_qty == qty_done"/>
<field name="product_uom_id" groups="uom.group_uom"/>
<field name="product_uom_id" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="uom.group_uom"
attrs="{'readonly': ['|', ('reserved_uom_qty', '!=', 0.0), '&amp;', ('state', '=', 'done'), ('id', '!=', False)]}"/>
</tree>
</field>
</record>
Expand Down

0 comments on commit 5cb12ca

Please sign in to comment.