Skip to content

Commit

Permalink
[IMP] endpoint: endpoint multi-company
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiMForgeFlow authored and simahawk committed Jul 4, 2024
1 parent 1aaec8f commit 59b7483
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions endpoint/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"depends": ["endpoint_route_handler", "rpc_helper"],
"data": [
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/endpoint_view.xml",
],
"demo": [
Expand Down
1 change: 1 addition & 0 deletions endpoint/models/endpoint_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class EndpointMixin(models.AbstractModel):
default=lambda self: self._default_code_snippet_docs(),
)
exec_as_user_id = fields.Many2one(comodel_name="res.users")
company_id = fields.Many2one("res.company", string="Company")

def _selection_exec_mode(self):
return [("code", "Execute code")]
Expand Down
11 changes: 11 additions & 0 deletions endpoint/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="endpoint_endpoint_multi_company_rule" model="ir.rule">
<field name="name">Endpoint Multi-company</field>
<field name="model_id" ref="model_endpoint_endpoint" />
<field name="global" eval="True" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</odoo>
1 change: 0 additions & 1 deletion endpoint/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
4 changes: 4 additions & 0 deletions endpoint/views/endpoint_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<page name="main" string="Main">
<group name="config1">
<group name="main">
<field
name="company_id"
groups="base.group_multi_company"
/>
<field name="route_group" />
<field name="exec_mode" />
<field
Expand Down

0 comments on commit 59b7483

Please sign in to comment.