|
@ -1160,8 +1160,17 @@ class TestContract(TestContractBase): |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_cancel(self): |
|
|
def test_cancel(self): |
|
|
|
|
|
self.acct_line.write( |
|
|
|
|
|
{ |
|
|
|
|
|
'date_end': self.today + relativedelta(months=5), |
|
|
|
|
|
'is_auto_renew': True, |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
self.acct_line.cancel() |
|
|
self.acct_line.cancel() |
|
|
self.assertTrue(self.acct_line.is_canceled) |
|
|
self.assertTrue(self.acct_line.is_canceled) |
|
|
|
|
|
self.assertFalse(self.acct_line.is_auto_renew) |
|
|
|
|
|
with self.assertRaises(ValidationError): |
|
|
|
|
|
self.acct_line.is_auto_renew = True |
|
|
self.acct_line.uncancel(self.today) |
|
|
self.acct_line.uncancel(self.today) |
|
|
self.assertFalse(self.acct_line.is_canceled) |
|
|
self.assertFalse(self.acct_line.is_canceled) |
|
|
|
|
|
|
|
@ -1330,21 +1339,24 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.recurring_rule_type = 'monthlylastday' |
|
|
self.acct_line.recurring_rule_type = 'monthlylastday' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(last, to_date('2018-01-31')) |
|
|
self.assertEqual(last, to_date('2018-01-31')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-02-01')) |
|
|
self.assertEqual(first, to_date('2018-02-01')) |
|
|
self.assertEqual(last, to_date('2018-02-28')) |
|
|
self.assertEqual(last, to_date('2018-02-28')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1359,14 +1371,16 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1380,14 +1394,16 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1400,21 +1416,24 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(last, to_date('2018-02-04')) |
|
|
self.assertEqual(last, to_date('2018-02-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1427,21 +1446,24 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line.date_end = '2018-03-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(last, to_date('2018-02-04')) |
|
|
self.assertEqual(last, to_date('2018-02-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1454,21 +1476,24 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.recurring_rule_type = 'yearly' |
|
|
self.acct_line.recurring_rule_type = 'yearly' |
|
|
self.acct_line.date_end = '2020-03-15' |
|
|
self.acct_line.date_end = '2020-03-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(last, to_date('2019-01-04')) |
|
|
self.assertEqual(last, to_date('2019-01-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2019-01-05')) |
|
|
self.assertEqual(first, to_date('2019-01-05')) |
|
|
self.assertEqual(last, to_date('2020-01-04')) |
|
|
self.assertEqual(last, to_date('2020-01-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
@ -1481,21 +1506,24 @@ class TestContract(TestContractBase): |
|
|
self.acct_line.recurring_rule_type = 'yearly' |
|
|
self.acct_line.recurring_rule_type = 'yearly' |
|
|
self.acct_line.date_end = '2020-03-15' |
|
|
self.acct_line.date_end = '2020-03-15' |
|
|
self.acct_line._onchange_date_start() |
|
|
self.acct_line._onchange_date_start() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(first, to_date('2018-01-05')) |
|
|
self.assertEqual(last, to_date('2019-01-04')) |
|
|
self.assertEqual(last, to_date('2019-01-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|
self.assertEqual(first, to_date('2019-01-05')) |
|
|
self.assertEqual(first, to_date('2019-01-05')) |
|
|
self.assertEqual(last, to_date('2020-01-04')) |
|
|
self.assertEqual(last, to_date('2020-01-04')) |
|
|
self.contract.recurring_create_invoice() |
|
|
self.contract.recurring_create_invoice() |
|
|
first, last, recurring_next_date = self.acct_line._get_period_to_invoice( |
|
|
|
|
|
|
|
|
first, last, recurring_next_date = \ |
|
|
|
|
|
self.acct_line._get_period_to_invoice( |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.last_date_invoiced, |
|
|
self.acct_line.recurring_next_date, |
|
|
self.acct_line.recurring_next_date, |
|
|
) |
|
|
) |
|
|