Skip to content

Commit

Permalink
wms_connector: ADD adds method_type and filepath to task mappings for…
Browse files Browse the repository at this point in the history
… default task creation
  • Loading branch information
FranzPoize committed Nov 20, 2023
1 parent 048e83e commit 270a5e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions wms_connector/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@
"fieldname_task": "wms_import_confirm_reception_task_id",
"fieldname_cron": "wms_import_confirm_reception_cron_id",
"filetype": "wms_reception_confirmed",
"method_type": "import",
"filepath": "OUT/",
"name_fragment": "reception confirmation",
"code": "env['stock.warehouse'].browse({}).{}.run_import()",
},
"delivery": {
"fieldname_task": "wms_import_confirm_delivery_task_id",
"fieldname_cron": "wms_import_confirm_delivery_cron_id",
"filetype": "wms_delivery_confirmed",
"method_type": "import",
"filepath": "OUT/",
"name_fragment": "delivery confirmation",
"code": "env['stock.warehouse'].browse({}).{}.run_import()",
},
Expand Down Expand Up @@ -136,7 +140,7 @@ def _activate_tasks(self):
else:
self[task_field_name] = self.env["attachment.synchronize.task"].create(
self._prepare_wms_task_vals(
mappings["filetype"], mappings["name_fragment"]
mappings["filetype"], mappings["name_fragment"], mappings["method_type"], mappings["filepath"]
)
)

Expand Down Expand Up @@ -171,11 +175,11 @@ def _activate_filters(self):
"wms_export_picking_out_filter_id"
].format(self.out_type_id.id)

def _prepare_wms_task_vals(self, filetype, name_fragment=""):
def _prepare_wms_task_vals(self, filetype, name_fragment="", method_type="export", filepath="IN/"):
return {
"name": "WMS task for {} {}".format(self.name, name_fragment),
"method_type": "export",
"filepath": "IN/",
"method_type": method_type,
"filepath": filepath,
"backend_id": self.env.ref("storage_backend.default_storage_backend").id,
"file_type": filetype,
}
Expand Down

0 comments on commit 270a5e5

Please sign in to comment.