Skip to content
Snippets Groups Projects

C2/ Implementation delivered_energy_invoice_format

1 file
+ 6
4
Compare changes
  • Side-by-side
  • Inline
@@ -52,12 +52,14 @@ class ContractGenerationWizard(models.TransientModel):
# We use the next method from the contract model to update the contract fields with contract template
contract._onchange_contract_template_id()
for contract_line_id in contract.contract_line_ids:
data = {"code": supply_point_assignation.supply_point_id.code, "owner_id": supply_point_assignation.supply_point_id.owner_id.display_name,}
# Each invoicing type has different data in the description column, so we need to check and modify
if self.selfconsumption_id.invoicing_mode == 'energy_delivered':
data["cau"] = self.selfconsumption_id.code
contract_line_id.write(
{
"name": contract_line_id.name.format(
code=supply_point_assignation.supply_point_id.code,
owner_id=supply_point_assignation.supply_point_id.owner_id.display_name,
),
"name": contract_line_id.name.format(**data),
}
)
# Update selfconsumption and distribution_table state
Loading