Skip to content
Snippets Groups Projects
Commit f6e5346b authored by Emanuel Buzey's avatar Emanuel Buzey Committed by Daniil Digtyar Vasilieva
Browse files

[REF] energy_selfconsumption: move contract template relation

parent 2f3d7aff
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !228. Comments created here will be created in the context of that merge request.
......@@ -11,3 +11,4 @@ class Product(models.Model):
string="Energy Project",
check_company=True,
)
contract_template_id = fields.Many2one("contract.template")
......@@ -87,7 +87,11 @@ class Selfconsumption(models.Model):
contracts_count = fields.Integer(compute=_compute_contract_count)
invoicing_mode = fields.Selection(INVOICING_VALUES, string="Invoicing Mode")
product_id = fields.Many2one("product.product", string="Product")
contract_template_id = fields.Many2one("contract.template")
contract_template_id = fields.Many2one(
"contract.template",
string="Contract Template",
related="product_id.contract_template_id",
)
def get_distribution_tables(self):
self.ensure_one()
......
......@@ -27,7 +27,7 @@ class ContractGenerationWizard(models.TransientModel):
product_id = self.selfconsumption_id.product_id
formula_contract_id = (
self.selfconsumption_id.contract_template_id.contract_line_ids.qty_formula_id
self.selfconsumption_id.product_id.contract_template_id.contract_line_ids.qty_formula_id
)
# Search accounting journal
......@@ -86,9 +86,9 @@ class ContractGenerationWizard(models.TransientModel):
"company_id": self.env.company.id,
"contract_line_ids": contract_lines,
"project_id": self.selfconsumption_id.project_id.id,
"contract_template_id": self.selfconsumption_id.contract_template_id.id,
"recurring_interval": self.selfconsumption_id.contract_template_id.recurring_interval,
"recurring_rule_type": self.selfconsumption_id.contract_template_id.recurring_rule_type,
"contract_template_id": self.selfconsumption_id.product_id.contract_template_id.id,
"recurring_interval": self.selfconsumption_id.product_id.contract_template_id.recurring_interval,
"recurring_rule_type": self.selfconsumption_id.product_id.contract_template_id.recurring_rule_type,
}
)
......
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