From 5ee13d4cbdd49930ded75e1f6a78274e6a4f0948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Fri, 6 Dec 2019 09:19:18 +0100 Subject: [PATCH] [REF] contract: rename misnamed methods --- contract/models/contract_line.py | 14 +++++++------- contract/tests/test_contract.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py index 3178f240..344ebebd 100644 --- a/contract/models/contract_line.py +++ b/contract/models/contract_line.py @@ -356,7 +356,7 @@ class ContractLine(models.Model): ) @api.model - def _compute_first_recurring_next_date( + def _get_recurring_next_date( self, date_start, recurring_invoicing_type, @@ -374,7 +374,7 @@ class ContractLine(models.Model): ) @api.model - def compute_first_date_end( + def _get_first_date_end( self, date_start, auto_renew_rule_type, auto_renew_interval ): return ( @@ -396,7 +396,7 @@ class ContractLine(models.Model): auto_renew""" for rec in self.filtered('is_auto_renew'): if rec.date_start: - rec.date_end = self.compute_first_date_end( + rec.date_end = self._get_first_date_end( rec.date_start, rec.auto_renew_rule_type, rec.auto_renew_interval, @@ -410,7 +410,7 @@ class ContractLine(models.Model): ) def _onchange_date_start(self): 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.recurring_invoicing_type, rec.recurring_rule_type, @@ -651,7 +651,7 @@ class ContractLine(models.Model): ) ) 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, rec.recurring_invoicing_type, rec.recurring_rule_type, @@ -712,7 +712,7 @@ class ContractLine(models.Model): ): self.ensure_one() if not recurring_next_date: - recurring_next_date = self._compute_first_recurring_next_date( + recurring_next_date = self._get_recurring_next_date( date_start, self.recurring_invoicing_type, self.recurring_rule_type, @@ -1023,7 +1023,7 @@ class ContractLine(models.Model): def _get_renewal_dates(self): self.ensure_one() 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 ) return date_start, date_end diff --git a/contract/tests/test_contract.py b/contract/tests/test_contract.py index 76ea4144..42a10761 100644 --- a/contract/tests/test_contract.py +++ b/contract/tests/test_contract.py @@ -537,7 +537,7 @@ class TestContract(TestContractBase): '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 Combination format { @@ -606,7 +606,7 @@ class TestContract(TestContractBase): for recurring_next_date, combination in combinations: self.assertEqual( recurring_next_date, - contract_line_env._compute_first_recurring_next_date( + contract_line_env._get_recurring_next_date( *combination ), error_message(*combination),