[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
This commit is contained in:
Tiffany Chang (tic)
2023-10-24 12:38:05 +00:00
parent 1f438ca0e1
commit 278fbea2c6
2 changed files with 2 additions and 2 deletions
@@ -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
@@ -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