Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] base_report_to_printer: Add company rules for printers and servers #368

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.2.0",
"version": "16.0.1.2.1",
"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 @@ -43,6 +43,9 @@ class PrintingServer(models.Model):
help="List of printers available on this server.",
)
multi_thread = fields.Boolean()
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
Loading