Skip to content

Commit ce5d553

Browse files
author
Guewen Baconnier
committed
Invalidate computed non-stored fields in cron_actions
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: #59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
1 parent a49002f commit ce5d553

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

ddmrp/models/stock_buffer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,18 @@ def cron_actions(self, only_nfp=False):
14931493
"""This method is meant to be inherited by other modules in order to
14941494
enhance extensibility."""
14951495
self.ensure_one()
1496+
self.invalidate_cache(
1497+
fnames=[
1498+
"product_location_qty",
1499+
"incoming_location_qty",
1500+
"outgoing_location_qty",
1501+
"virtual_location_qty",
1502+
"product_location_qty_available_not_res",
1503+
"dlt",
1504+
"distributed_source_location_qty",
1505+
],
1506+
ids=self.ids,
1507+
)
14961508
if not only_nfp or only_nfp == "out":
14971509
self._calc_qualified_demand()
14981510
if not only_nfp or only_nfp == "in":

0 commit comments

Comments
 (0)