summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Lamotte (pila) <pila@odoo.com>2024-12-10 08:03:17 +0000
committerPierre Lamotte (pila) <pila@odoo.com>2025-02-05 12:54:26 +0000
commit5a46227eb45b705f5cf84585f2509d60e61a8bca (patch)
tree61e36ed3eaa3359d9d1d094e2e91a734bf405cc4
parentbf554a1761ae931b38d9ae4083ffcefc639a03cb (diff)
[FIX] mrp: correct color logic for consumed quantities' display
## Steps to reproduce: - Create a storable product `P1` with the following BoM: - Qty: 1 unit - Components: - C1, C2, C3: 3 units - Create a MO to produce one unit of `P1`; - Confirm the order; - Update the product's `Quantity` to 1 at least; *The quantities of `To Consume` and `Quantity` columns in the `Components` tab of the notebook are automatically set to 3.* - Update the field `Quantity` of components to: - C1: 1 unit - C2: 3 units - C3: 4 units ## Issue: On a Manufacturing Order, if a component's quantity is: - C1: less than the total needed value > highlights in green; - C2: equal to the value > highlights in black; - C3: higher than the value > highlights in orange. ## Expected: On a Manufacturing Order, if a component's quantity is: - C1: less -> black; - C2: equal -> green; - C3: higher -> orange. ## Cause: Text decorations are based on a wrong logic by getting the quantities from wrong field. This field has been changed during an apocalypse. https://github.com/odoo/odoo/blob/c43297435cfcaf560d5c952ac3c4a383a6f1dc28/addons/mrp/views/mrp_production_views.xml#L405-L406 ## Fix: Reset good field to check quantities, inspired by Odoo 16 using the computed `should_consume_qty` value to check the consumption status: https://github.com/odoo/odoo/blob/67c78b38e794333eae55758ad4610515df5c49d2/addons/mrp/views/mrp_production_views.xml#L342-L343 opw-4393156 opw-4391582 opw-4391600 closes odoo/odoo#196429 X-original-commit: 38157aa8485dabf021c87e4adacea35196719694 Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com> Signed-off-by: Pierre Lamotte (pila) <pila@odoo.com>
-rw-r--r--addons/mrp/views/mrp_production_views.xml2
1 files changed, 2 insertions, 0 deletions
diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml
index a2c8a6f87a9..6bde0fd6e20 100644
--- a/addons/mrp/views/mrp_production_views.xml
+++ b/addons/mrp/views/mrp_production_views.xml
@@ -449,6 +449,8 @@
<!-- TODO put forecast back -->
<field name="forecast_availability" column_invisible="parent.state in ['done', 'cancel']" string="Forecast" widget="forecast_widget" optional="hide"/>
<field name="quantity" string="Quantity"
+ decoration-success="not is_done and (quantity - should_consume_qty == 0)"
+ decoration-warning="not is_done and (quantity - should_consume_qty &gt; 0.0001)"
column_invisible="parent.state == 'draft'"
decoration-info="manual_consumption"
decoration-bf="manual_consumption"