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

[FIX] energy_selfconsumption: set name field correctly

parent 71cbf67f
No related branches found
No related tags found
3 merge requests!253[REL] Release 06/11/23,!228[IMP] energy_selfconsumption: integration invoicing,!211[IMP] energy_selfconsumption: invoicing acquired power
......@@ -64,7 +64,14 @@ class ContractGenerationWizard(models.TransientModel):
"contract_template_id": self.selfconsumption_id.product_id.contract_template_id.id,
}
)
# We use the next method from the contract model to update the contract fields with contract template
contract._onchange_contract_template_id()
# Now, we need to update the name field using the code and display_name fields
name = _("""CUPS: %s\nOwner: %s\nInvoicing period: #START# - #END#""") % (
supply_point_assignation.supply_point_id.code,
supply_point_assignation.supply_point_id.owner_id.display_name,
)
contract.contract_line_ids.name = name
# Update selfconsumption and distribution_table state
self.selfconsumption_id.write({"state": "active"})
self.selfconsumption_id.distribution_table_state("process", "active")
......
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