From e1be055d8cc07294d74c5d1319d9cb8fb3796289 Mon Sep 17 00:00:00 2001 From: Francois Poizat Date: Tue, 28 Nov 2023 13:58:31 +0100 Subject: [PATCH] wms_connector: ADD a smart button to the picking view form that links to the wms export --- wms_connector/models/stock_picking.py | 21 +++++++++++++++++-- wms_connector/views/stock_picking.xml | 29 ++++++++++++++++++++------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/wms_connector/models/stock_picking.py b/wms_connector/models/stock_picking.py index eaa2d7de9a..f1fe658043 100644 --- a/wms_connector/models/stock_picking.py +++ b/wms_connector/models/stock_picking.py @@ -8,8 +8,15 @@ class StockPicking(models.Model): _inherit = ["synchronize.exportable.mixin", "stock.picking"] _name = "stock.picking" - wms_connector_exported = fields.Boolean(String="Exported to WMS", compute="_compute_wms_exported", readonly=True, store=True) - is_wms_exportable = fields.Boolean(compute="_compute_is_wms_exportable", readonly=True, store=True) + wms_connector_exported = fields.Boolean( + String="Exported to WMS", + compute="_compute_wms_exported", + readonly=True, + store=True, + ) + is_wms_exportable = fields.Boolean( + compute="_compute_is_wms_exportable", readonly=True, store=True + ) @api.depends("wms_export_attachment") def _compute_wms_exported(self): @@ -20,3 +27,13 @@ def _compute_wms_exported(self): def _compute_is_wms_exportable(self): for rec in self: rec.is_wms_exportable = rec.picking_type_id.warehouse_id.active_wms_sync + + def action_show_export(self): + self.ensure_one() + return { + "name": "WMS export", + "type": "ir.actions.act_window", + "res_model": "attachment.queue", + "view_mode": "form", + "res_id": self.wms_export_attachment.id, + } diff --git a/wms_connector/views/stock_picking.xml b/wms_connector/views/stock_picking.xml index dd3005eef6..3cea4f7077 100644 --- a/wms_connector/views/stock_picking.xml +++ b/wms_connector/views/stock_picking.xml @@ -9,8 +9,8 @@
- - + +
+ + + +
@@ -26,12 +41,12 @@ - + + /> @@ -42,9 +57,9 @@ - - - + + +