Skip to content
Snippets Groups Projects

[IMP] energy_selfconsumption: integration invoicing

Files
3
@@ -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 {
Loading