[IMP] stock: Avoid unneeded write in _enable_show_reserved method
As long as the framework is not able to avoid rewriting values that are already set, we must add checks to avoid triggering multiple processes linked to that value assignment. Example: https://github.com/odoo/odoo/blob/66c11acdbedf8d1bcae6deb8ec54c5da5a3ae16d/addons/stock/models/product_strategy.py#L111 https://github.com/odoo/odoo/blob/11d81b2145e95c50481101a63d3ad1d244279af4/addons/stock/models/stock_move.py#L302-L341 https://github.com/odoo/odoo/blob/daea3d4e10b8fc2c4840fff30474a1203eff55c2/addons/sale_stock/models/sale_order.py#L402-L418 It may be unusual for a field to compute stored depending on a non-stored, but the reality is this. closes odoo/odoo#152026 X-original-commit: 123212a5f5598d91f31869c49ac8d28aba1f698a Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -94,7 +94,7 @@ class StockPutawayRule(models.Model):
|
||||
out_locations = self.location_out_id
|
||||
if out_locations:
|
||||
self.env['stock.picking.type'].with_context(active_test=False)\
|
||||
.search([('default_location_dest_id', 'in', out_locations.ids)])\
|
||||
.search([('default_location_dest_id', 'in', out_locations.ids), ('show_reserved', '=', False)])\
|
||||
.write({'show_reserved': True})
|
||||
|
||||
def _get_putaway_location(self, product, quantity=0, package=None, packaging=None, qty_by_location=None):
|
||||
|
||||
Reference in New Issue
Block a user