Skip to content

Commit

Permalink
[IMP] sale_start_end_dates: pre-commit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
vancouver29 committed Jan 6, 2023
1 parent 0ecd34d commit f3bb874
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sale_start_end_dates/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions sale_start_end_dates/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _inverse_number_of_days(self):
number_of_days=line.number_of_days,
)
line.number_of_days = 1
if line.start_date:
if line.start_date and not line.end_date:
line.end_date = line.start_date + relativedelta(
days=line.number_of_days - 1
)
Expand Down Expand Up @@ -160,12 +160,12 @@ 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
# 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.end_date = False
else:
self.start_date = False
self.end_date = False
8 changes: 8 additions & 0 deletions sale_start_end_dates/tests/test_sale_start_end_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,3 +114,9 @@ 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)
6 changes: 6 additions & 0 deletions setup/sale_start_end_dates/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit f3bb874

Please sign in to comment.