diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 9f347391877..746eae0d903 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -113,6 +113,9 @@ class PickingType(models.Model): ('zpl_lots', 'ZPL Labels - One per lot/SN'), ('zpl_units', 'ZPL Labels - One per unit')], string="Lot Label Format to auto-print", default='4x12_lots') + auto_print_reception_report = fields.Boolean( + "Auto Print Reception Report", + help="If this checkbox is ticked, Odoo will automatically print the reception report of a picking when it is validated and has assigned moves.") auto_print_reception_report_labels = fields.Boolean( "Auto Print Reception Report Labels", help="If this checkbox is ticked, Odoo will automatically print the reception report labels of a picking when it is validated.") @@ -1768,6 +1771,15 @@ class Picking(models.Model): report_actions.append(action) if self.user_has_groups('stock.group_reception_report'): + reception_reports_to_print = self.filtered( + lambda p: p.picking_type_id.auto_print_reception_report + and p.picking_type_id.code != 'outgoing' + and p.move_ids.move_dest_ids + ) + if reception_reports_to_print: + action = self.env.ref('stock.stock_reception_report_action').report_action(reception_reports_to_print, config=False) + clean_action(action, self.env) + report_actions.append(action) reception_labels_to_print = self.filtered(lambda p: p.picking_type_id.auto_print_reception_report_labels and p.picking_type_id.code != 'outgoing') if reception_labels_to_print: moves_to_print = reception_labels_to_print.move_ids.move_dest_ids diff --git a/addons/stock/report/report_stock_reception.xml b/addons/stock/report/report_stock_reception.xml index 2b64c03ed27..0bc63526637 100644 --- a/addons/stock/report/report_stock_reception.xml +++ b/addons/stock/report/report_stock_reception.xml @@ -30,7 +30,7 @@ Reception Report stock.picking - qweb-html + qweb-pdf stock.report_reception diff --git a/addons/stock/views/stock_picking_type_views.xml b/addons/stock/views/stock_picking_type_views.xml index b0a8fc60371..d57f04d15dc 100644 --- a/addons/stock/views/stock_picking_type_views.xml +++ b/addons/stock/views/stock_picking_type_views.xml @@ -141,6 +141,7 @@