diff --git a/wms_connector/models/attachment_synchronize_task.py b/wms_connector/models/attachment_synchronize_task.py index 75470198e9..db252a943e 100644 --- a/wms_connector/models/attachment_synchronize_task.py +++ b/wms_connector/models/attachment_synchronize_task.py @@ -7,6 +7,8 @@ class AttachmentSynchronizeTask(models.Model): _inherit = "attachment.synchronize.task" + default_warehouse_id = fields.Many2one("stock.warehouse") + file_type = fields.Selection( selection_add=[ ("export", "Export"), @@ -15,3 +17,9 @@ class AttachmentSynchronizeTask(models.Model): ("wms_update_inventory", "Inventory update"), ] ) + + def _prepare_attachment_vals(self, data, filename): + self.ensure_one() + vals = super()._prepare_attachment_vals(data, filename) + vals["default_warehouse_id"] = self.default_warehouse_id.id + return vals diff --git a/wms_connector/models/stock_warehouse.py b/wms_connector/models/stock_warehouse.py index 16ebb232d6..e45d177c71 100644 --- a/wms_connector/models/stock_warehouse.py +++ b/wms_connector/models/stock_warehouse.py @@ -200,6 +200,7 @@ def _prepare_wms_task_vals( "filepath": filepath, "backend_id": self.env.ref("fs_storage.default_fs_storage").id, "file_type": filetype, + "default_warehouse_id": self.id, } def _prepare_wms_cron_vals(self, code="", name_fragment=""):