Browse Source

[FIX] - Fix recurring_next_date

pull/208/head
sbejaoui 6 years ago
committed by Thomas Binsfeld
parent
commit
133dd1e42b
  1. 2
      product_contract/models/sale_order_line.py
  2. 5
      product_contract/tests/test_sale_order.py

2
product_contract/models/sale_order_line.py

@ -107,7 +107,7 @@ class SaleOrderLine(models.Model):
self.date_start or fields.Date.today(), self.date_start or fields.Date.today(),
self.recurring_invoicing_type, self.recurring_invoicing_type,
self.recurring_rule_type, self.recurring_rule_type,
int(self.product_uom_qty),
1,
) )
termination_notice_interval = ( termination_notice_interval = (
self.product_id.termination_notice_interval self.product_id.termination_notice_interval

5
product_contract/tests/test_sale_order.py

@ -42,6 +42,7 @@ class TestSaleOrder(TransactionCase):
{ {
'is_contract': True, 'is_contract': True,
'default_qty': 12, 'default_qty': 12,
'recurring_rule_type': "monthlylastday",
'contract_template_id': self.contract_template1.id, 'contract_template_id': self.contract_template1.id,
} }
) )
@ -103,6 +104,10 @@ class TestSaleOrder(TransactionCase):
self.order_line1.contract_id.contract_template_id, self.order_line1.contract_id.contract_template_id,
self.contract_template1, self.contract_template1,
) )
contract_line = self.order_line1.contract_id.recurring_invoice_line_ids
self.assertEqual(contract_line.date_start, Date.to_date('2018-01-01'))
self.assertEqual(contract_line.date_end, Date.to_date('2018-12-31'))
self.assertEqual(contract_line.recurring_next_date, Date.to_date('2018-01-31'))
def test_sale_contract_count(self): def test_sale_contract_count(self):
"""It should count contracts as many different contract template used """It should count contracts as many different contract template used

Loading…
Cancel
Save