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

[REF] energy_selfconsumption: crete a wizard and contracts from activate method

parent db1cff39
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.
......@@ -142,7 +142,7 @@ class Selfconsumption(models.Model):
Activates the energy self-consumption project, performing various validations.
This method checks for the presence of a valid code, CIL, and rated power
for the project. If all validations pass, it opens a wizard for generating
for the project. If all validations pass, it instances a wizard and generating
contracts for the project.
Note:
......@@ -163,16 +163,14 @@ class Selfconsumption(models.Model):
raise ValidationError(_("Project must have a valid CIL."))
if not record.power or record.power <= 0:
raise ValidationError(_("Project must have a valid Rated Power."))
return {
"name": _("Generate Contracts"),
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "energy_selfconsumption.contract_generation.wizard",
"views": [(False, "form")],
"view_id": False,
"target": "new",
"context": {"default_selfconsumption_id": self.id},
}
# Create ContractGenerationWizard
contract_wizard = self.env[
"energy_selfconsumption.contract_generation.wizard"
].create({"selfconsumption_id": self.id})
# Generate Contracts
contract_wizard.generate_contracts_button()
def set_invoicing_mode(self):
return {
......
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