diff --git a/wms_connector/models/stock_warehouse.py b/wms_connector/models/stock_warehouse.py index aa33c37683..1271cf4439 100644 --- a/wms_connector/models/stock_warehouse.py +++ b/wms_connector/models/stock_warehouse.py @@ -8,7 +8,7 @@ FILTER_VALS = { "wms_export_product_filter_id": { "name": "WMS: {} filter for product sync", - "model_id": "wms.product.sync", + "model_id": "product.product", }, "wms_export_picking_in_filter_id": { "name": "WMS: {} filter for picking in", @@ -211,7 +211,7 @@ def refresh_wms_products(self): self.env["wms.product.sync"].create( [{"product_id": prd.id, "warehouse_id": rec.id} for prd in to_create] ) - to_unlink.unlink() + to_unlink.wms_sync_ids.filtered(lambda s: s.warehouse_id == rec).unlink() def button_open_wms_sync_ids(self): return { diff --git a/wms_connector/models/synchronize_exportable_mixin.py b/wms_connector/models/synchronize_exportable_mixin.py index 4040ff6118..b70e9eae88 100644 --- a/wms_connector/models/synchronize_exportable_mixin.py +++ b/wms_connector/models/synchronize_exportable_mixin.py @@ -26,9 +26,13 @@ def button_trigger_export(self): def _get_export_data(self): data = [] - for rec in self.sorted("id"): + for idx, rec in enumerate(self.sorted("id")): + if self.file_creation_mode == "per_record": + sequence = 0 + else: + sequence = idx try: - data += rec._prepare_export_data() + data += rec._prepare_export_data(sequence) except Exception as e: if "pdb" in config.get("dev_mode"): raise @@ -56,7 +60,7 @@ def track_export(self, attachment): self.wms_export_date = datetime.datetime.now() self.wms_export_attachment = attachment - def _prepare_export_data(self) -> list: + def _prepare_export_data(self, idx) -> list: raise NotImplementedError def _format_to_exportfile(self, data):