diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py
index 2f8484c7f3a..9f347391877 100644
--- a/addons/stock/models/stock_picking.py
+++ b/addons/stock/models/stock_picking.py
@@ -116,6 +116,9 @@ class PickingType(models.Model):
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.")
+ auto_print_packages = fields.Boolean(
+ "Auto Print Packages",
+ help="If this checkbox is ticked, Odoo will automatically print the packages and their contents of a picking when it is validated.")
auto_print_package_label = fields.Boolean(
"Auto Print Package Label",
@@ -1806,4 +1809,10 @@ class Picking(models.Model):
if action:
clean_action(action, self.env)
report_actions.append(action)
+ if self.user_has_groups('stock.group_tracking_lot'):
+ pickings_print_packages = self.filtered(lambda p: p.picking_type_id.auto_print_packages and p.move_line_ids.result_package_id)
+ if pickings_print_packages:
+ action = self.env.ref("stock.action_report_picking_packages").report_action(pickings_print_packages.ids, config=False)
+ clean_action(action, self.env)
+ report_actions.append(action)
return report_actions
diff --git a/addons/stock/views/stock_picking_type_views.xml b/addons/stock/views/stock_picking_type_views.xml
index ae59af42de1..b0a8fc60371 100644
--- a/addons/stock/views/stock_picking_type_views.xml
+++ b/addons/stock/views/stock_picking_type_views.xml
@@ -142,6 +142,7 @@
+