From 77536505afba501d3ead332800a5aaa0b547e586 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 19 Dec 2019 12:44:15 +0100 Subject: [PATCH] [12.0][IMP] - Add failing test for wrong invoicing date after contract line stop --- contract/tests/test_contract.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contract/tests/test_contract.py b/contract/tests/test_contract.py index e406a45e..f6ba9e15 100644 --- a/contract/tests/test_contract.py +++ b/contract/tests/test_contract.py @@ -2280,3 +2280,19 @@ class TestContract(TestContractBase): self.assertTrue(self.acct_line.recurring_next_date) self.acct_line.stop(self.acct_line.last_date_invoiced) self.assertFalse(self.acct_line.recurring_next_date) + + def test_stop_and_update_recurring_invoice_date(self): + self.acct_line.write( + { + 'date_start': '2019-01-01', + 'date_end': '2019-12-31', + 'recurring_next_date': '2020-01-01', + 'recurring_invoicing_type': 'post-paid', + 'recurring_rule_type': 'yearly', + } + ) + self.acct_line.stop(to_date('2019-05-31')) + self.assertEqual(self.acct_line.date_end, to_date('2019-05-31')) + self.assertEqual( + self.acct_line.recurring_next_date, to_date('2019-06-01') + )