Skip to content

Commit

Permalink
[16.0][IMP] base_report_to_printer: Add company rules for printers an…
Browse files Browse the repository at this point in the history
…d servers
  • Loading branch information
GabbasovDinar committed Oct 14, 2024
1 parent c199434 commit 7c5eab1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base_report_to_printer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{
"name": "Report to printer",
"version": "16.0.1.1.7",
"version": "16.0.1.1.8",
"category": "Generic Modules/Base",
"author": "Agile Business Group & Domsense, Pegueroles SCP, NaN,"
" LasLabs, Camptocamp, Odoo Community Association (OCA),"
Expand Down
3 changes: 3 additions & 0 deletions base_report_to_printer/models/printing_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class PrintingServer(models.Model):
string="Printers List",
help="List of printers available on this server.",
)
company_ids = fields.Many2many(
comodel_name="res.company",
)

def _open_connection(self, raise_on_error=False):
self.ensure_one()
Expand Down
21 changes: 21 additions & 0 deletions base_report_to_printer/security/security.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,25 @@
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
</record>
<record id="printing_server_company_rule" model="ir.rule">
<field name="name">Printing Server multi-company</field>
<field name="model_id" ref="model_printing_server" />
<field name="domain_force">
["|", ("company_ids", "=", False), ("company_ids", "in", company_ids)]
</field>
</record>
<record id="printer_company_rule" model="ir.rule">
<field name="name">Printer multi-company</field>
<field name="model_id" ref="model_printing_printer" />
<field name="domain_force">
["|", ("server_id.company_ids", "=", False), ("server_id.company_ids", "in", company_ids)]
</field>
</record>
<record id="printing_job_company_rule" model="ir.rule">
<field name="name">Printing Job multi-company</field>
<field name="model_id" ref="model_printing_job" />
<field name="domain_force">
["|", ("server_id.company_ids", "=", False), ("server_id.company_ids", "in", company_ids)]
</field>
</record>
</odoo>
13 changes: 11 additions & 2 deletions base_report_to_printer/views/printing_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@
</h1>
</div>
<group>
<field name="address" />
<field name="port" />
<group>
<field name="address" />
<field name="port" />
</group>
<group>
<field
name="company_ids"
widget="many2many_tags"
groups="base.group_multi_company"
/>
</group>
</group>
<group>
<field name="user" />
Expand Down

0 comments on commit 7c5eab1

Please sign in to comment.