Files
odoo_source/addons/product/wizard
Touati Djamel (otd) 48a6f88c50 [FIX] product: prevent printing labels for archived products
Steps to reproduce the bug:
- Create a storable product
- Archive it
- Try to print labels

Problem:
A traceback is triggered, Because when we click on print the label
we have to open the wizard, so we load the wizard model
`product.label.layout` via an onchange:
https://github.com/odoo/odoo/blob/15.0/odoo/models.py#L6357-L6360
thanks to the context, it will find the concerned product
(via default_product_id) Except that the product is archived,
so ignored in the result returned by the onchange

therefore, in the confirmation, we will create the wizard,
but it will not have a product filled, so in the `_prepare_report_data`
function we do not enter in the if or the elif:
https://github.com/odoo/odoo/blob/d9f45ba6941939b3d4b40beb5abbc330be84d695/addons/product/wizard/product_label_layout. py#L49-L54

it will therefore raise a traceback when we want to iterate on it:
https://github.com/odoo/odoo/blob/d9f45ba6941939b3d4b40beb5abbc330be84d695/addons/product/wizard/product_label_layout.py#L60

opw-2855659

closes odoo/odoo#97226

X-original-commit: 6dcec12074014434ce1283449700aa352993ac0c
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-08-01 19:37:20 +02:00
..