Skip to content

Commit

Permalink
[IMP] edi_oca: edi_backend multi-company
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiMForgeFlow committed Oct 23, 2024
1 parent 8fa351e commit 367c091
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class EDIBackend(models.Model):
"""
)
active = fields.Boolean(default=True)
company_id = fields.Many2one("res.company", string="Company")

def _get_component(self, exchange_record, key):
record_conf = self._get_component_conf_for_record(exchange_record, key)
Expand Down
7 changes: 7 additions & 0 deletions edi_oca/security/ir_model_access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,11 @@
name="domain_force"
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
</record>
<record id="rule_edi_backend_multi_company" model="ir.rule">
<field name="name">edi_backend multi-company</field>
<field name="model_id" ref="model_edi_backend" />
<field
name="domain_force"
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions edi_oca/views/edi_backend_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<list decoration-muted="(not active)">
<field name="name" />
<field name="active" />
<field
name="company_id"
groups="base.group_multi_company"
optional="hide"
/>
</list>
</field>
</record>
Expand Down Expand Up @@ -47,6 +52,7 @@
<group>
<field name="output_sent_processed_auto" />
<field name="active" invisible="1" />
<field name="company_id" groups="base.group_multi_company" />
</group>
<!-- Hook to add more config -->
<notebook />
Expand Down
6 changes: 1 addition & 5 deletions edi_oca/views/edi_exchange_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@
string="Model rules"
groups="edi_oca.group_edi_advanced_settings_manager"
>
<!-- <field
name="rule_ids"
context="{'default_type_id': active_id}"
> -->
<field name="rule_ids">
<field name="rule_ids" context="{'default_type_id': id}">
<list decoration-muted="(not active)">
<field name="active" invisible="1" />
<field name="name" />
Expand Down

0 comments on commit 367c091

Please sign in to comment.