From d4f6c9b97cc61a3b61422b9e920abaefe9174e9d Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 4 Dec 2018 12:57:13 +0100 Subject: [PATCH] [REM] - Remove unused method --- product_contract/models/__init__.py | 1 - .../models/abstract_contract_line.py | 27 ------------------- product_contract/models/sale_order_line.py | 4 +-- 3 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 product_contract/models/abstract_contract_line.py diff --git a/product_contract/models/__init__.py b/product_contract/models/__init__.py index 4d43b3ea..a275fa21 100644 --- a/product_contract/models/__init__.py +++ b/product_contract/models/__init__.py @@ -2,7 +2,6 @@ # Copyright 2017 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import abstract_contract_line from . import contract_line from . import product_template from . import sale_order diff --git a/product_contract/models/abstract_contract_line.py b/product_contract/models/abstract_contract_line.py deleted file mode 100644 index 2013cc15..00000000 --- a/product_contract/models/abstract_contract_line.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2018 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import api, models, fields - - -class AccountAbstractAnalyticContractLine(models.AbstractModel): - _inherit = 'account.abstract.analytic.contract.line' - - @api.onchange('product_id') - def onchange_product(self): - if self.product_id.is_contract: - self.recurring_rule_type = self.product_id.recurring_rule_type - self.recurring_invoicing_type = ( - self.product_id.recurring_invoicing_type - ) - self.recurring_interval = self.product_id.recurring_interval - self.date_start = fields.Date.today() - self.is_auto_renew = self.product_id.is_auto_renew - self.auto_renew_interval = self.product_id.auto_renew_interval - self.auto_renew_rule_type = self.product_id.auto_renew_rule_type - self.termination_notice_interval = ( - self.product_id.termination_notice_interval - ) - self.termination_notice_rule_type = ( - self.product_id.termination_notice_rule_type - ) diff --git a/product_contract/models/sale_order_line.py b/product_contract/models/sale_order_line.py index af93f9bf..61094b2b 100644 --- a/product_contract/models/sale_order_line.py +++ b/product_contract/models/sale_order_line.py @@ -72,7 +72,7 @@ class SaleOrderLine(models.Model): ) rec.recurring_interval = rec.product_id.recurring_interval rec.date_start = rec.date_start or fields.Date.today() - if rec.is_auto_renew: + if rec.product_id.is_auto_renew: rec.date_end = ( rec.date_start + contract_line_env.get_relative_delta( @@ -85,7 +85,7 @@ class SaleOrderLine(models.Model): @api.onchange('date_start') def onchange_date_start(self): for rec in self: - if rec.is_auto_renew: + if rec.product_id.is_auto_renew: if not rec.date_start: rec.date_end = False else: