mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[REF] contract: rename misnamed methods
This commit is contained in:
committed by
Francisco Ivan Anton Prieto
parent
c3c0ffaac1
commit
87babeba9f
@@ -356,7 +356,7 @@ class ContractLine(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _compute_first_recurring_next_date(
|
def _get_recurring_next_date(
|
||||||
self,
|
self,
|
||||||
date_start,
|
date_start,
|
||||||
recurring_invoicing_type,
|
recurring_invoicing_type,
|
||||||
@@ -374,7 +374,7 @@ class ContractLine(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def compute_first_date_end(
|
def _get_first_date_end(
|
||||||
self, date_start, auto_renew_rule_type, auto_renew_interval
|
self, date_start, auto_renew_rule_type, auto_renew_interval
|
||||||
):
|
):
|
||||||
return (
|
return (
|
||||||
@@ -396,7 +396,7 @@ class ContractLine(models.Model):
|
|||||||
auto_renew"""
|
auto_renew"""
|
||||||
for rec in self.filtered('is_auto_renew'):
|
for rec in self.filtered('is_auto_renew'):
|
||||||
if rec.date_start:
|
if rec.date_start:
|
||||||
rec.date_end = self.compute_first_date_end(
|
rec.date_end = self._get_first_date_end(
|
||||||
rec.date_start,
|
rec.date_start,
|
||||||
rec.auto_renew_rule_type,
|
rec.auto_renew_rule_type,
|
||||||
rec.auto_renew_interval,
|
rec.auto_renew_interval,
|
||||||
@@ -410,7 +410,7 @@ class ContractLine(models.Model):
|
|||||||
)
|
)
|
||||||
def _onchange_date_start(self):
|
def _onchange_date_start(self):
|
||||||
for rec in self.filtered('date_start'):
|
for rec in self.filtered('date_start'):
|
||||||
rec.recurring_next_date = self._compute_first_recurring_next_date(
|
rec.recurring_next_date = self._get_recurring_next_date(
|
||||||
rec.date_start,
|
rec.date_start,
|
||||||
rec.recurring_invoicing_type,
|
rec.recurring_invoicing_type,
|
||||||
rec.recurring_rule_type,
|
rec.recurring_rule_type,
|
||||||
@@ -651,7 +651,7 @@ class ContractLine(models.Model):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
new_date_start = rec.date_start + delay_delta
|
new_date_start = rec.date_start + delay_delta
|
||||||
rec.recurring_next_date = self._compute_first_recurring_next_date(
|
rec.recurring_next_date = self._get_recurring_next_date(
|
||||||
new_date_start,
|
new_date_start,
|
||||||
rec.recurring_invoicing_type,
|
rec.recurring_invoicing_type,
|
||||||
rec.recurring_rule_type,
|
rec.recurring_rule_type,
|
||||||
@@ -712,7 +712,7 @@ class ContractLine(models.Model):
|
|||||||
):
|
):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if not recurring_next_date:
|
if not recurring_next_date:
|
||||||
recurring_next_date = self._compute_first_recurring_next_date(
|
recurring_next_date = self._get_recurring_next_date(
|
||||||
date_start,
|
date_start,
|
||||||
self.recurring_invoicing_type,
|
self.recurring_invoicing_type,
|
||||||
self.recurring_rule_type,
|
self.recurring_rule_type,
|
||||||
@@ -1023,7 +1023,7 @@ class ContractLine(models.Model):
|
|||||||
def _get_renewal_dates(self):
|
def _get_renewal_dates(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
date_start = self.date_end + relativedelta(days=1)
|
date_start = self.date_end + relativedelta(days=1)
|
||||||
date_end = self.compute_first_date_end(
|
date_end = self._get_first_date_end(
|
||||||
date_start, self.auto_renew_rule_type, self.auto_renew_interval
|
date_start, self.auto_renew_rule_type, self.auto_renew_interval
|
||||||
)
|
)
|
||||||
return date_start, date_end
|
return date_start, date_end
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ class TestContract(TestContractBase):
|
|||||||
'There was an error and the view couldn\'t be opened.',
|
'There was an error and the view couldn\'t be opened.',
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_compute_first_recurring_next_date(self):
|
def test_get_recurring_next_date(self):
|
||||||
"""Test different combination to compute recurring_next_date
|
"""Test different combination to compute recurring_next_date
|
||||||
Combination format
|
Combination format
|
||||||
{
|
{
|
||||||
@@ -606,7 +606,7 @@ class TestContract(TestContractBase):
|
|||||||
for recurring_next_date, combination in combinations:
|
for recurring_next_date, combination in combinations:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
recurring_next_date,
|
recurring_next_date,
|
||||||
contract_line_env._compute_first_recurring_next_date(
|
contract_line_env._get_recurring_next_date(
|
||||||
*combination
|
*combination
|
||||||
),
|
),
|
||||||
error_message(*combination),
|
error_message(*combination),
|
||||||
|
|||||||
Reference in New Issue
Block a user