From 0c19fc32be0e87a5487e0a56d06ca08f8d313496 Mon Sep 17 00:00:00 2001 From: Emanuel Buzey <buzeyemanuel@gmail.com> Date: Wed, 18 Oct 2023 14:47:15 +0200 Subject: [PATCH] [REF] energy_selfconsumption: remove field and key values depricated --- .../wizards/contract_generation_wizard.py | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/energy_selfconsumption/wizards/contract_generation_wizard.py b/energy_selfconsumption/wizards/contract_generation_wizard.py index 591f2df7f..f68cc656d 100644 --- a/energy_selfconsumption/wizards/contract_generation_wizard.py +++ b/energy_selfconsumption/wizards/contract_generation_wizard.py @@ -4,27 +4,6 @@ from odoo import _, fields, models class ContractGenerationWizard(models.TransientModel): _name = "energy_selfconsumption.contract_generation.wizard" - price_energy = fields.Float(string="Price (€/kWn/day)") - - recurring_interval = fields.Integer( - default=1, - string="Invoice Every", - help="Invoice every (Days/Week/Month/Year)", - ) - recurring_rule_type = fields.Selection( - [ - ("daily", "Day(s)"), - ("weekly", "Week(s)"), - ("monthly", "Month(s)"), - ("monthlylastday", "Month(s) last day"), - ("quarterly", "Quarter(s)"), - ("semesterly", "Semester(s)"), - ("yearly", "Year(s)"), - ], - default="monthly", - string="Recurrence", - help="Specify Interval for automatic invoice generation.", - ) selfconsumption_id = fields.Many2one( "energy_selfconsumption.selfconsumption", readonly=True ) @@ -46,29 +25,6 @@ class ContractGenerationWizard(models.TransientModel): SomeException: When no distribution table in process of activation is found. """ - # Create product - product_id = self.env["product.product"].create( - { - "name": _("Energy Acquired - %s") % (self.selfconsumption_id.name), - "lst_price": self.price_energy, - "company_id": self.env.company.id, - } - ) - - # Create contract formula - formula_contract_id = self.env["contract.line.qty.formula"].create( - { - "name": _("Formula - %s") % (self.selfconsumption_id.name), - "code": """ -days_timedelta = line.next_period_date_end - line.next_period_date_start -if days_timedelta: - # Add one so it counts the same day too (month = 29 + 1) - days_between = days_timedelta.days + 1 -else: - days_between = 0 -result = line.supply_point_assignation_id.distribution_table_id.selfconsumption_project_id.power * line.supply_point_assignation_id.coefficient * days_between - """, - } product_id = self.selfconsumption_id.product_id formula_contract_id = ( self.selfconsumption_id.contract_template_id.contract_line_ids.qty_formula_id @@ -125,14 +81,12 @@ result = line.supply_point_assignation_id.distribution_table_id.selfconsumption_ ), "partner_id": supply_point_assignation.supply_point_id.partner_id.id, "invoice_partner_id": supply_point_assignation.supply_point_id.partner_id.id, - "journal_id": journal_id.id, - "recurring_interval": self.recurring_interval, - "recurring_rule_type": self.recurring_rule_type, "recurring_invoicing_type": "post-paid", "date_start": fields.date.today(), "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, } ) -- GitLab