[FIX] stock: display the forecast symbol on outgoing SM

To reproduce the issue:
1. Create a storable product P
2. Update the on-hand quantity: 5 x P
3. Create a planned delivery order with 4 x P
    - Note: once saved, the forecast symbole is green
4. On the delivery order, set the quantity to 5 and save

Error: The symbol is now red, which is incorrect: there are 5 available
P in the stock

The color condition is incorrect, when `forecast_availability` is equal
to zero, it means that there will be just the right quantity:
https://github.com/odoo/odoo/blob/892232b5aef42dd2706cb9d1d027b1c463ca50dd/addons/stock/models/stock_move.py#L446-L448

task-2822157

X-original-commit: b49577d1aa0dda3b3890c7150db0242254cf46c5
Part-of: odoo/odoo#94332
This commit is contained in:
Adrien Widart
2022-06-24 11:32:48 +02:00
parent 7b179f411a
commit 9c8ddea062
+2 -2
View File
@@ -396,9 +396,9 @@
<field name="product_packaging_id" groups="product.group_stock_packaging"/>
<field name="product_uom_qty" string="Demand" attrs="{'column_invisible': [('parent.immediate_transfer', '=', True)], 'readonly': ['|', ('is_initial_demand_editable', '=', False), '&amp;', '&amp;', ('show_operations', '=', True), ('is_locked', '=', True), ('is_initial_demand_editable', '=', False)]}"/>
<button type="object" name="action_product_forecast_report" title="Forecast Report" icon="fa-area-chart"
attrs="{'invisible': ['|', ('forecast_availability', '&lt;=', 0), '|', ('parent.immediate_transfer', '=', True), '&amp;', ('parent.picking_type_code', '=', 'outgoing'), ('state', '!=', 'draft')]}"/>
attrs="{'invisible': ['|', ('forecast_availability', '&lt;', 0), '|', ('parent.immediate_transfer', '=', True), '&amp;', ('parent.picking_type_code', '=', 'outgoing'), ('state', '!=', 'draft')]}"/>
<button type="object" name="action_product_forecast_report" title="Forecast Report" icon="fa-area-chart text-danger"
attrs="{'invisible': ['|', ('forecast_availability', '&gt;', 0), '|', ('parent.immediate_transfer', '=', True), '&amp;', ('parent.picking_type_code', '=', 'outgoing'), ('state', '!=', 'draft')]}"/>
attrs="{'invisible': ['|', ('forecast_availability', '&gt;=', 0), '|', ('parent.immediate_transfer', '=', True), '&amp;', ('parent.picking_type_code', '=', 'outgoing'), ('state', '!=', 'draft')]}"/>
<field name="forecast_expected_date" invisible="1"/>
<field name="forecast_availability" string="Reserved"
attrs="{'column_invisible': ['|', '|', ('parent.state', 'in', ['draft', 'done']), ('parent.picking_type_code', '!=', 'outgoing'), ('parent.immediate_transfer', '=', True)]}" widget="forecast_widget"/>