diff --git a/base_recurrence/models/recurrence_mixin.py b/base_recurrence/models/recurrence_mixin.py index 56b5d8a325..a1269c0105 100644 --- a/base_recurrence/models/recurrence_mixin.py +++ b/base_recurrence/models/recurrence_mixin.py @@ -69,8 +69,8 @@ def _get_next_recurrency_date(self): def _update_recurrency_date(self): """ - Update the last recurrency date from the next recurrency date, - then compute the new next recurrency date. + Update the last recurrency date from the next recurrency date, + then compute the new next recurrency date. """ for record in self: record.update( diff --git a/base_recurrence/tests/test_recurrence.py b/base_recurrence/tests/test_recurrence.py index 46567ee70e..c5cb18ec94 100644 --- a/base_recurrence/tests/test_recurrence.py +++ b/base_recurrence/tests/test_recurrence.py @@ -36,7 +36,8 @@ def test_recurrence_now(self): record._set_next_recurrency_date(from_now=True) self.assertEqual( - fields.Datetime.to_datetime("2022-07-18"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-07-18"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -56,7 +57,8 @@ def test_recurrence(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-07-18"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-07-18"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -76,7 +78,8 @@ def test_recurrence_daily(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-07-12"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-07-12"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -96,7 +99,8 @@ def test_recurrence_monthly(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-08-11"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-08-11"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -116,7 +120,8 @@ def test_recurrence_monthlylastday(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-08-31"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-08-31"), + record.next_recurrency_date, ) @freeze_time("2022-01-11") @@ -136,7 +141,8 @@ def test_recurrence_monthlylastday_february(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-02-28"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-02-28"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -156,7 +162,8 @@ def test_recurrence_quarterly(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-10-01"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-10-01"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -176,7 +183,8 @@ def test_recurrence_semsterly(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2023-01-01"), record.next_recurrency_date, + fields.Datetime.to_datetime("2023-01-01"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -196,7 +204,8 @@ def test_recurrence_yearly(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2023-07-11"), record.next_recurrency_date, + fields.Datetime.to_datetime("2023-07-11"), + record.next_recurrency_date, ) @freeze_time("2022-07-11") @@ -216,13 +225,16 @@ def test_update_recurrence_yearly(self): record._set_next_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2022-07-10"), record.next_recurrency_date, + fields.Datetime.to_datetime("2022-07-10"), + record.next_recurrency_date, ) record._update_recurrency_date() self.assertEqual( - fields.Datetime.to_datetime("2023-07-10"), record.next_recurrency_date, + fields.Datetime.to_datetime("2023-07-10"), + record.next_recurrency_date, ) self.assertEqual( - fields.Datetime.to_datetime("2022-07-10"), record.last_recurrency_date, + fields.Datetime.to_datetime("2022-07-10"), + record.last_recurrency_date, ) diff --git a/setup/base_recurrence/odoo/addons/base_recurrence b/setup/base_recurrence/odoo/addons/base_recurrence new file mode 120000 index 0000000000..73fb5a4c15 --- /dev/null +++ b/setup/base_recurrence/odoo/addons/base_recurrence @@ -0,0 +1 @@ +../../../../base_recurrence \ No newline at end of file diff --git a/setup/base_recurrence/setup.py b/setup/base_recurrence/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/base_recurrence/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)