[FIX] mrp: warning message in production order report

— create a bom which uses 5.6 units of a product;
— make a production order;
— reserve the materials (all materials should be available);
— print the production order report.

Before this commit, a warning message in the report that says : 'All
components could not be reserved. Click on the "Check Availability
button" to try to reserve components'. This warning message is shown
despite the fact that all the components are reserved. This occurs
because of a rounding error.

Now, the warning message only when a component could not be reserved.

opw-2058921

closes odoo/odoo#36462

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-09-05 13:37:12 +00:00
parent b4a1b87fb6
commit 2581693b5d
@@ -136,7 +136,8 @@
</t>
</tbody>
</table>
<t t-set="has_product_reserved" t-value="o.move_raw_ids.filtered(lambda x: x.product_uom_qty != x.reserved_availability)"/>
<t t-set="decimal_precision" t-value="o.env['decimal.precision'].precision_get('Product Unit of Measure')"/>
<t t-set="has_product_reserved" t-value="o.move_raw_ids.filtered(lambda x: round(x.product_uom_qty, decimal_precision) != round(x.reserved_availability, decimal_precision))"/>
<p t-if="o.state !='done' and (not has_product_available or has_product_reserved)" class="fa fa-exclamation-triangle">
All components could not be reserved. Click on the "Check Availability button" to try to reserve components.
</p>