From 278fbea2c6a1e36947edc8ece4c4ddd723229e39 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Thu, 20 Apr 2023 16:33:46 +0200 Subject: [PATCH] [FIX] product,stock: allow label printing w/o doc layout The default behavior of report_action() is to check if the currently selected company has their document layout configured. The product labels do NOT depend on this layout at all though, so let's make it so the configuration never pops up when product/lot labels are being printed. Discovered during task: 3046178 Part-of: odoo/odoo#126791 --- addons/product/wizard/product_label_layout.py | 2 +- addons/stock/wizard/stock_lot_label_layout.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/wizard/product_label_layout.py b/addons/product/wizard/product_label_layout.py index 0cbcd050949..a97c68c7791 100644 --- a/addons/product/wizard/product_label_layout.py +++ b/addons/product/wizard/product_label_layout.py @@ -72,6 +72,6 @@ class ProductLabelLayout(models.TransientModel): xml_id, data = self._prepare_report_data() if not xml_id: raise UserError(_('Unable to find report template for %s format', self.print_format)) - report_action = self.env.ref(xml_id).report_action(None, data=data) + report_action = self.env.ref(xml_id).report_action(None, data=data, config=False) report_action.update({'close_on_report_download': True}) return report_action diff --git a/addons/stock/wizard/stock_lot_label_layout.py b/addons/stock/wizard/stock_lot_label_layout.py index f8505106486..0f7d24712d6 100644 --- a/addons/stock/wizard/stock_lot_label_layout.py +++ b/addons/stock/wizard/stock_lot_label_layout.py @@ -37,6 +37,6 @@ class ProductLabelLayout(models.TransientModel): docids = [] for lot_id, qty in quantity_by_lot.items(): docids.append([lot_id] * qty) - report_action = self.env.ref(xml_id).report_action(docids) + report_action = self.env.ref(xml_id).report_action(docids, config=False) report_action.update({'close_on_report_download': True}) return report_action