From 43bac7a671ca7e1566d719a613923e780e2281de Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 2 Sep 2020 13:06:05 +0200 Subject: [PATCH] stock_vertical_lift: packaging template more flexible As the template is not used by JS we can pass full objects to it. This way we can use any recordset information directly in the template without having to override the method. --- .../models/vertical_lift_operation_base.py | 15 +++++++-------- .../views/shuttle_screen_templates.xml | 12 ++++-------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/stock_vertical_lift/models/vertical_lift_operation_base.py b/stock_vertical_lift/models/vertical_lift_operation_base.py index ac3147244..c96e78c99 100644 --- a/stock_vertical_lift/models/vertical_lift_operation_base.py +++ b/stock_vertical_lift/models/vertical_lift_operation_base.py @@ -229,14 +229,13 @@ class VerticalLiftOperationBase(models.AbstractModel): self.next_step() def _render_product_packagings(self, product): - values = { - "packagings": [ - {"name": pkg.name, "qty": pkg.qty, "unit": product.uom_id.name} - for pkg in product.packaging_ids - ] - } - content = self.env["ir.qweb"].render("stock_vertical_lift.packagings", values) - return content + return self.env["ir.qweb"].render( + "stock_vertical_lift.packagings", + self._prepare_values_for_product_packaging(product), + ) + + def _prepare_values_for_product_packaging(self, product): + return {"product": product} def _get_tray_qty(self, product, location): quants = self.env["stock.quant"].search( diff --git a/stock_vertical_lift/views/shuttle_screen_templates.xml b/stock_vertical_lift/views/shuttle_screen_templates.xml index a34365026..396a35a8b 100644 --- a/stock_vertical_lift/views/shuttle_screen_templates.xml +++ b/stock_vertical_lift/views/shuttle_screen_templates.xml @@ -1,24 +1,20 @@