From 33d33c083599a07a6f1e6134bbb07cb4fd0d5fbd Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Wed, 24 Jul 2024 14:48:08 +0500 Subject: [PATCH] [MIG] pos_picking_delayed: Migration to 16.0 --- pos_picking_delayed/models/__init__.py | 1 + pos_picking_delayed/models/res_config_settings.py | 13 +++++++++++++ pos_picking_delayed/tests/test_module.py | 6 ++---- pos_picking_delayed/views/view_pos_config.xml | 11 +++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 pos_picking_delayed/models/res_config_settings.py diff --git a/pos_picking_delayed/models/__init__.py b/pos_picking_delayed/models/__init__.py index 234b311eae..3d75627c44 100644 --- a/pos_picking_delayed/models/__init__.py +++ b/pos_picking_delayed/models/__init__.py @@ -1,2 +1,3 @@ from . import pos_config from . import pos_order +from . import res_config_settings diff --git a/pos_picking_delayed/models/res_config_settings.py b/pos_picking_delayed/models/res_config_settings.py new file mode 100644 index 0000000000..28671f1d69 --- /dev/null +++ b/pos_picking_delayed/models/res_config_settings.py @@ -0,0 +1,13 @@ +# Copyright 2024 Eugene Molotov (https://github.com/em230418) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + picking_creation_delayed = fields.Boolean( + related="pos_config_id.picking_creation_delayed", readonly=False + ) diff --git a/pos_picking_delayed/tests/test_module.py b/pos_picking_delayed/tests/test_module.py index 60c0139a19..cef9033173 100644 --- a/pos_picking_delayed/tests/test_module.py +++ b/pos_picking_delayed/tests/test_module.py @@ -42,7 +42,7 @@ def setUp(self): def test_01_picking_delayed_enabled(self): # Enable feature self.pos_config.picking_creation_delayed = True - self.pos_config.open_session_cb() + self.pos_config.open_ui() order = self._create_order() @@ -61,7 +61,7 @@ def test_01_picking_delayed_enabled(self): def test_02_picking_delayed_disabled(self): # Disable feature self.pos_config.picking_creation_delayed = False - self.pos_config.open_session_cb() + self.pos_config.open_ui() order = self._create_order() @@ -80,7 +80,6 @@ def test_02_picking_delayed_disabled(self): def _create_order(self): # Create order account_id = self.env.user.partner_id.property_account_receivable_id - statement_id = self.pos_config.current_session_id.statement_ids[0] payment_methods = self.pos_config.current_session_id.payment_method_ids order_data = { "id": "0006-001-0010", @@ -114,7 +113,6 @@ def _create_order(self): "amount": 0.9, "name": fields.Datetime.now(), "account_id": account_id.id, - "statement_id": statement_id.id, "payment_method_id": payment_methods.filtered( lambda pm: pm.is_cash_count and not pm.split_transactions diff --git a/pos_picking_delayed/views/view_pos_config.xml b/pos_picking_delayed/views/view_pos_config.xml index 38114a3ae1..e1635130f8 100644 --- a/pos_picking_delayed/views/view_pos_config.xml +++ b/pos_picking_delayed/views/view_pos_config.xml @@ -3,12 +3,15 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).--> - - pos.config - + + res.config.settings.view.form.inherit.pos.picking.delayed + res.config.settings + - +