mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] product_contract: Remove unnecessary methods
This commit is contained in:
@@ -149,7 +149,7 @@ class SaleOrderLine(models.Model):
|
|||||||
if sol.is_auto_renew and sol.date_start:
|
if sol.is_auto_renew and sol.date_start:
|
||||||
sol.date_end = self.env["contract.line"]._get_first_date_end(
|
sol.date_end = self.env["contract.line"]._get_first_date_end(
|
||||||
sol.date_start,
|
sol.date_start,
|
||||||
sol._get_auto_renew_rule_type(),
|
sol.auto_renew_rule_type,
|
||||||
sol.auto_renew_interval,
|
sol.auto_renew_interval,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -161,13 +161,6 @@ class SaleOrderLine(models.Model):
|
|||||||
recurring_rule_type, interval
|
recurring_rule_type, interval
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_auto_renew_rule_type(self):
|
|
||||||
"""monthly last day don't make sense for auto_renew_rule_type"""
|
|
||||||
self.ensure_one()
|
|
||||||
if self.auto_renew_rule_type == "monthlylastday":
|
|
||||||
return "monthly"
|
|
||||||
return self.auto_renew_rule_type
|
|
||||||
|
|
||||||
@api.depends("product_id")
|
@api.depends("product_id")
|
||||||
def _compute_auto_renew(self):
|
def _compute_auto_renew(self):
|
||||||
for rec in self.filtered("product_id.is_contract"):
|
for rec in self.filtered("product_id.is_contract"):
|
||||||
|
|||||||
@@ -93,12 +93,5 @@ class ProductContractConfigurator(models.TransientModel):
|
|||||||
self.update({"date_end": False})
|
self.update({"date_end": False})
|
||||||
for rec in self.filtered(lambda ln: ln.is_auto_renew and ln.date_start):
|
for rec in self.filtered(lambda ln: ln.is_auto_renew and ln.date_start):
|
||||||
rec.date_end = self.env["contract.line"]._get_first_date_end(
|
rec.date_end = self.env["contract.line"]._get_first_date_end(
|
||||||
rec.date_start, rec._get_auto_renew_rule_type(), rec.auto_renew_interval
|
rec.date_start, rec.auto_renew_rule_type, rec.auto_renew_interval
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_auto_renew_rule_type(self):
|
|
||||||
"""monthly last day don't make sense for auto_renew_rule_type"""
|
|
||||||
self.ensure_one()
|
|
||||||
if self.auto_renew_rule_type == "monthlylastday":
|
|
||||||
return "monthly"
|
|
||||||
return self.auto_renew_rule_type
|
|
||||||
|
|||||||
Reference in New Issue
Block a user