Skip to content
Snippets Groups Projects
Commit 8ad7ad1e authored by Daniil Digtyar Vasilieva's avatar Daniil Digtyar Vasilieva :call_me:
Browse files

[IMP] added multi-company rules for new models

parent 38a7f78e
No related branches found
No related tags found
3 merge requests!138Hotfix setup name error,!134Release v14.0.1.1.6,!126[IMP] Feature/add energy selfconsumption distribution table
Pipeline #30169 passed
......@@ -31,6 +31,9 @@ class DistributionTable(models.Model):
'distribution_table_id')
coefficient_is_valid = fields.Boolean(compute=_compute_coefficient_is_valid, readonly=True, store=False)
active = fields.Boolean(default=True)
company_id = fields.Many2one(
"res.company", default=lambda self: self.env.company, readonly=True
)
@api.onchange('selfconsumption_project_id')
def _onchange_selfconsumption_project_id(self):
......
......@@ -30,7 +30,9 @@ class SupplyPointAssignation(models.Model):
supply_point_filtered_ids = fields.One2many('energy_selfconsumption.supply_point',
compute=_compute_supply_point_filtered_ids, readonly=True)
company_id = fields.Many2one(
"res.company", default=lambda self: self.env.company, readonly=True
)
@api.constrains('coefficient')
def constraint_coefficient(self):
for record in self:
......
......@@ -3,12 +3,36 @@
<record model="ir.rule" id="supply_point_company_rule">
<field name="name">Supply Point multi-company</field>
<field
name="model_id"
ref="energy_selfconsumption.model_energy_selfconsumption_supply_point"
name="model_id"
ref="energy_selfconsumption.model_energy_selfconsumption_supply_point"
/>
<field name="global" eval="True" />
<field name="global" eval="True"/>
<field
name="domain_force"
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
<record model="ir.rule" id="distribution_table_rule">
<field name="name">Distribution Table multi-company</field>
<field
name="model_id"
ref="energy_selfconsumption.model_energy_selfconsumption_distribution_table"
/>
<field name="global" eval="True"/>
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
<record model="ir.rule" id="supply_point_assignation_rule">
<field name="name">Supply Point Assignation multi-company</field>
<field
name="model_id"
ref="energy_selfconsumption.model_energy_selfconsumption_supply_point_assignation"
/>
<field name="global" eval="True"/>
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment