|
|
@ -159,6 +159,24 @@ class TestContract(TestContractBase): |
|
|
|
self.contract.partner_id.user_id, self.invoice_monthly.user_id |
|
|
|
) |
|
|
|
|
|
|
|
def test_contract_recurring_next_date(self): |
|
|
|
recurring_next_date = to_date('2018-01-15') |
|
|
|
self.assertEqual( |
|
|
|
self.contract.recurring_next_date, recurring_next_date |
|
|
|
) |
|
|
|
contract_line = self.acct_line.copy( |
|
|
|
{'recurring_next_date': '2018-01-14'} |
|
|
|
) |
|
|
|
recurring_next_date = to_date('2018-01-14') |
|
|
|
self.assertEqual( |
|
|
|
self.contract.recurring_next_date, recurring_next_date |
|
|
|
) |
|
|
|
contract_line.cancel() |
|
|
|
recurring_next_date = to_date('2018-01-15') |
|
|
|
self.assertEqual( |
|
|
|
self.contract.recurring_next_date, recurring_next_date |
|
|
|
) |
|
|
|
|
|
|
|
def test_contract_daily(self): |
|
|
|
recurring_next_date = to_date('2018-02-23') |
|
|
|
last_date_invoiced = to_date('2018-02-22') |
|
|
@ -1299,6 +1317,36 @@ class TestContract(TestContractBase): |
|
|
|
self.assertEqual(first, to_date('2018-03-01')) |
|
|
|
self.assertEqual(last, to_date('2018-03-15')) |
|
|
|
|
|
|
|
def test_get_invoiced_period_monthly_pre_paid_2(self): |
|
|
|
self.acct_line.date_start = '2018-01-05' |
|
|
|
self.acct_line.recurring_invoicing_type = 'pre-paid' |
|
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
|
self.acct_line._onchange_date_start() |
|
|
|
self.contract.recurring_create_invoice() |
|
|
|
first, last = self.acct_line._get_invoiced_period() |
|
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
|
first, last = self.acct_line._get_invoiced_period() |
|
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
|
self.assertEqual(last, to_date('2018-07-04')) |
|
|
|
|
|
|
|
def test_get_invoiced_period_monthly_post_paid_2(self): |
|
|
|
self.acct_line.date_start = '2018-01-05' |
|
|
|
self.acct_line.recurring_invoicing_type = 'post-paid' |
|
|
|
self.acct_line.recurring_rule_type = 'monthly' |
|
|
|
self.acct_line.date_end = '2018-08-15' |
|
|
|
self.acct_line._onchange_date_start() |
|
|
|
self.contract.recurring_create_invoice() |
|
|
|
first, last = self.acct_line._get_invoiced_period() |
|
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
|
self.assertEqual(last, to_date('2018-03-04')) |
|
|
|
self.acct_line.recurring_next_date = '2018-06-05' |
|
|
|
first, last = self.acct_line._get_invoiced_period() |
|
|
|
self.assertEqual(first, to_date('2018-02-05')) |
|
|
|
self.assertEqual(last, to_date('2018-06-04')) |
|
|
|
|
|
|
|
def test_get_invoiced_period_monthly_post_paid(self): |
|
|
|
self.acct_line.date_start = '2018-01-05' |
|
|
|
self.acct_line.recurring_invoicing_type = 'post-paid' |
|
|
|