diff --git a/product_contract/models/sale_order_line.py b/product_contract/models/sale_order_line.py index 2d3386bf..8386477a 100644 --- a/product_contract/models/sale_order_line.py +++ b/product_contract/models/sale_order_line.py @@ -107,7 +107,7 @@ class SaleOrderLine(models.Model): self.date_start or fields.Date.today(), self.recurring_invoicing_type, self.recurring_rule_type, - int(self.product_uom_qty), + 1, ) termination_notice_interval = ( self.product_id.termination_notice_interval diff --git a/product_contract/tests/test_sale_order.py b/product_contract/tests/test_sale_order.py index 33180659..2cbd86b9 100644 --- a/product_contract/tests/test_sale_order.py +++ b/product_contract/tests/test_sale_order.py @@ -42,6 +42,7 @@ class TestSaleOrder(TransactionCase): { 'is_contract': True, 'default_qty': 12, + 'recurring_rule_type': "monthlylastday", 'contract_template_id': self.contract_template1.id, } ) @@ -103,6 +104,10 @@ class TestSaleOrder(TransactionCase): self.order_line1.contract_id.contract_template_id, 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): """It should count contracts as many different contract template used