[IMP] - Add failing test for forecast generation of auto renewal contract lines

If a contract line is set to auto renew the forecast should continue  after the
date end and stop at the company forecast period
This commit is contained in:
sbejaoui
2020-01-07 12:06:14 +01:00
parent a52e1fe46d
commit 3e529d0037

View File

@@ -260,3 +260,27 @@ class TestContractLineForecastPeriod(TestContractBase):
Date.to_date("2020-01-01"),
),
)
@mute_logger("odoo.addons.queue_job.models.base")
def test_forecast_period_for_auto_renew_contract(self):
"""If a contract line is set to auto renew the forecast should continue
after the date end and stop at the company forecast period"""
# Set the company forecast period to three years
self.acct_line.contract_id.company_id.contract_forecast_interval = 36
self.acct_line.write(
{
'date_start': Date.today(),
'recurring_next_date': Date.today(),
'date_end': Date.today() + relativedelta(years=1),
'recurring_rule_type': "monthlylastday",
'last_date_invoiced': False,
'recurring_invoicing_type': 'pre-paid',
'is_auto_renew': False,
}
)
self.assertTrue(self.acct_line.forecast_period_ids)
self.assertEqual(len(self.acct_line.forecast_period_ids), 13)
self.acct_line.write({'is_auto_renew': True})
self.assertTrue(self.acct_line.forecast_period_ids)
self.assertEqual(len(self.acct_line.forecast_period_ids), 37)