Skip to content

Commit

Permalink
[FIX] printing_auto*: bound to model
Browse files Browse the repository at this point in the history
And add security rule
  • Loading branch information
jbaudoux committed Sep 19, 2023
1 parent 1b0dc61 commit 24aca97
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions printing_auto_base/models/printing_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
1 change: 1 addition & 0 deletions printing_auto_stock_picking/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
4 changes: 3 additions & 1 deletion printing_auto_stock_picking/models/stock_picking_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
)
13 changes: 13 additions & 0 deletions printing_auto_stock_picking/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="ir_rule_user" model="ir.rule">
<field name="name">stock picking auto print</field>
<field name="model_id" ref="printing_auto_base.model_printing_auto" />
<field name="domain_force">[("model", "=", "stock.picking.type")]</field>
<field name="groups" eval="[(4, ref('tock.group_stock_user'))]" />
<field name="perm_create" eval="0" />
<field name="perm_write" eval="0" />
<field name="perm_unlink" eval="0" />
<field name="perm_read" eval="1" />
</record>
</odoo>
5 changes: 4 additions & 1 deletion printing_auto_stock_picking/views/stock_picking_type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<field name="arch" type="xml">
<xpath expr="//sheet/group[last()]">
<separator string="Auto Printing Configuration" colspan="4" />
<field name="auto_printing_ids" />
<field
name="auto_printing_ids"
context="{'default_model': 'stock.picking.type'}"
/>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 24aca97

Please sign in to comment.