From ba6bd4d8bacdb19f5e2927d53d041dda4cb6514c Mon Sep 17 00:00:00 2001 From: Michael Tietz Date: Thu, 13 Jul 2023 19:55:56 +0200 Subject: [PATCH] update --- .../models/stock_release_channel.py | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/stock_release_channel/models/stock_release_channel.py b/stock_release_channel/models/stock_release_channel.py index ad19a2a2488..46edff775d0 100644 --- a/stock_release_channel/models/stock_release_channel.py +++ b/stock_release_channel/models/stock_release_channel.py @@ -222,7 +222,7 @@ def _get_picking_compute_fields(self): return [("count", "release_channel_id_count")] @api.model - def _get_move_read_fields(self): + def _get_move_read_group_fields(self): return [] @api.model @@ -265,23 +265,20 @@ def _compute_picking_count(self): + picking_read_fields, ["release_channel_id"], ) - for prefix, fetch in picking_compute_fields: - field = self._get_compute_field_name(prefix, "picking", domain_name) - for row in data: - channel_id = ( - row["release_channel_id"] and row["release_channel_id"][0] - ) - if not channel_id: - continue + for row in data: + channel_id = row["release_channel_id"] and row["release_channel_id"][0] + if not channel_id: + continue + picking_ids = row["picking_ids"] + all_picking_ids.update(picking_ids) + for picking_id in picking_ids: + picking_channels[picking_id]["channel_id"] = channel_id + picking_channels[picking_id]["matched_domains"].append(domain_name) + + for prefix, fetch in picking_compute_fields: + field = self._get_compute_field_name(prefix, "picking", domain_name) channels_aggregate_values[channel_id][field] = row[fetch] - picking_ids = row["picking_ids"] - all_picking_ids.update(picking_ids) - for picking_id in picking_ids: - picking_channels[picking_id]["channel_id"] = channel_id - picking_channels[picking_id]["matched_domains"].append( - domain_name - ) - move_read_fields = self._get_move_read_fields() + move_read_fields = self._get_move_read_group_fields() move_compute_fields = self._get_move_compute_fields() data = self.env["stock.move"].read_group( # TODO for now we do estimates, later we may improve the domains per