diff --git a/sale_start_end_dates/__manifest__.py b/sale_start_end_dates/__manifest__.py index 6f003efb7d7..a963cf8e91c 100644 --- a/sale_start_end_dates/__manifest__.py +++ b/sale_start_end_dates/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Sale Start End Dates", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "category": "Sales", "license": "AGPL-3", "summary": "Adds start date and end date on sale order lines", diff --git a/sale_start_end_dates/models/sale_order.py b/sale_start_end_dates/models/sale_order.py index 3cda0109e3f..2803b37231e 100644 --- a/sale_start_end_dates/models/sale_order.py +++ b/sale_start_end_dates/models/sale_order.py @@ -160,12 +160,8 @@ def start_end_dates_product_id_change(self): if self.product_id.must_have_dates: if self.order_id.default_start_date: self.start_date = self.order_id.default_start_date - else: - self.start_date = False if self.order_id.default_end_date: self.end_date = self.order_id.default_end_date - else: - self.end_date = False else: self.start_date = False self.end_date = False diff --git a/sale_start_end_dates/tests/test_sale_start_end_dates.py b/sale_start_end_dates/tests/test_sale_start_end_dates.py index 6eff08c5ae0..fec6a520fb6 100644 --- a/sale_start_end_dates/tests/test_sale_start_end_dates.py +++ b/sale_start_end_dates/tests/test_sale_start_end_dates.py @@ -67,6 +67,8 @@ def test_start_end_dates_product_id_change(self): self.so.order_line.start_end_dates_product_id_change() self.so.order_line.start_date_change() self.so.order_line.end_date_change() + self.product_id.must_have_dates = False + self.so.order_line.start_end_dates_product_id_change() def test_start_end_dates_product_id(self): self.product_id.must_have_dates = False @@ -112,3 +114,13 @@ def test_inverse_number_of_days(self): self.assertEqual( self.so.order_line[0].start_date, self.so.order_line[0].end_date ) + self.so.order_line[0].number_of_days = -1 + self.assertEqual(self.so.order_line[0].number_of_days, 1) + + def test_prepare_invoice_line(self): + invoice_line_vals = self.so.order_line._prepare_invoice_line() + self.assertEqual(invoice_line_vals["product_id"], self.product_id.id) + self.assertEqual( + invoice_line_vals["start_date"], self.so.order_line[0].start_date + ) + self.assertEqual(invoice_line_vals["end_date"], self.so.order_line[0].end_date)