[IMP] stock: auto-print packages

Add in feature to allow auto-printing of packages at picking
validation

Part of task: 3046178 - general auto-print goal

Part-of: odoo/odoo#126791
This commit is contained in:
Tiffany Chang (tic)
2023-10-24 12:38:06 +00:00
parent f00f02d1ae
commit d43416c65d
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -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
@@ -142,6 +142,7 @@
<field name="lot_label_format" invisible="not auto_print_lot_labels"/>
</div>
<field name="auto_print_reception_report_labels" string="Reception Report Labels" invisible="code == 'outgoing'" groups="stock.group_reception_report"/>
<field name="auto_print_packages" string="Package Content" groups="stock.group_tracking_lot"/>
</group>
<group string="">
<div colspan="2">