diff --git a/printing_auto_base/models/printing_auto.py b/printing_auto_base/models/printing_auto.py
index fe1d13ac9c2..5f3ed8bf6dc 100644
--- a/printing_auto_base/models/printing_auto.py
+++ b/printing_auto_base/models/printing_auto.py
@@ -19,6 +19,7 @@ class PrintingAuto(models.Model):
_description = "Printing Auto"
name = fields.Char(string="Name", required=True)
+ model = fields.Char(string="Related Document Model", required=True)
data_source = fields.Selection(
[
diff --git a/printing_auto_base/tests/common.py b/printing_auto_base/tests/common.py
index 310d4aff8d8..78c4bbfdeca 100644
--- a/printing_auto_base/tests/common.py
+++ b/printing_auto_base/tests/common.py
@@ -54,6 +54,7 @@ def setUpClass(cls):
@classmethod
def _create_printing_auto(cls, vals):
+ vals.setdefault("model", "printing.auto")
return cls.env["printing.auto"].create(vals)
@classmethod
diff --git a/printing_auto_stock_picking/__manifest__.py b/printing_auto_stock_picking/__manifest__.py
index b685f875579..3b6752370a7 100644
--- a/printing_auto_stock_picking/__manifest__.py
+++ b/printing_auto_stock_picking/__manifest__.py
@@ -8,6 +8,7 @@
"category": "Warehouse Management",
"data": [
"security/ir.model.access.csv",
+ "security/ir_rule.xml",
"views/stock_picking.xml",
"views/stock_picking_type.xml",
],
diff --git a/printing_auto_stock_picking/models/stock_picking_type.py b/printing_auto_stock_picking/models/stock_picking_type.py
index 7ae139fce91..dbca36da747 100644
--- a/printing_auto_stock_picking/models/stock_picking_type.py
+++ b/printing_auto_stock_picking/models/stock_picking_type.py
@@ -9,5 +9,7 @@ class StockPickingType(models.Model):
_inherit = "stock.picking.type"
auto_printing_ids = fields.Many2many(
- "printing.auto", string="Auto Printing Configuration"
+ "printing.auto",
+ string="Auto Printing Configuration",
+ domain=[("model", "=", "stock.picking.type")],
)
diff --git a/printing_auto_stock_picking/security/ir_rule.xml b/printing_auto_stock_picking/security/ir_rule.xml
new file mode 100644
index 00000000000..3ceacbda3a7
--- /dev/null
+++ b/printing_auto_stock_picking/security/ir_rule.xml
@@ -0,0 +1,13 @@
+
+
+
+ stock picking auto print
+
+ [("model", "=", "stock.picking.type")]
+
+
+
+
+
+
+
diff --git a/printing_auto_stock_picking/views/stock_picking_type.xml b/printing_auto_stock_picking/views/stock_picking_type.xml
index 8c2e299322a..f957549f380 100644
--- a/printing_auto_stock_picking/views/stock_picking_type.xml
+++ b/printing_auto_stock_picking/views/stock_picking_type.xml
@@ -6,7 +6,10 @@
-
+