diff --git a/pos_usability_akretion/__manifest__.py b/pos_usability_akretion/__manifest__.py index 74fd1ee..30ca9a8 100644 --- a/pos_usability_akretion/__manifest__.py +++ b/pos_usability_akretion/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright 2014-2021 Akretion France (http://www.akretion.com/) +# Copyright 2014-2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "POS Usability", - "version": "16.0.1.0.0", + "version": "18.0.1.0.0", "category": "Point of sale", "license": "AGPL-3", "summary": "Misc usability improvement for point of sale", @@ -24,16 +24,15 @@ Akretion: """, "author": "Akretion", - "website": "http://www.akretion.com", + "website": "https://github.com/akretion/odoo-usability", "depends": ["point_of_sale"], "data": [ - "report/pos.xml", + # "report/pos.xml", # TODO mig if needed "views/report_pos_order.xml", "views/pos_category.xml", "views/pos_session.xml", "views/pos_payment_method.xml", "views/pos_order.xml", - "views/product.xml", ], - "installable": False, + "installable": True, } diff --git a/pos_usability_akretion/models/__init__.py b/pos_usability_akretion/models/__init__.py index 47c8027..a9120db 100644 --- a/pos_usability_akretion/models/__init__.py +++ b/pos_usability_akretion/models/__init__.py @@ -2,4 +2,3 @@ from . import product from . import pos_category from . import pos_payment_method from . import pos_order -from . import pos_session diff --git a/pos_usability_akretion/models/pos_category.py b/pos_usability_akretion/models/pos_category.py index 518c671..e9c590a 100644 --- a/pos_usability_akretion/models/pos_category.py +++ b/pos_usability_akretion/models/pos_category.py @@ -1,4 +1,4 @@ -# Copyright 2017-2021 Akretion France (http://www.akretion.com/) +# Copyright 2017-2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -13,16 +13,7 @@ class PosCategory(models.Model): help="The number of products under this point of sale category " "(children categories included)") - # inspired by the code of odoo/addons/product/models/product_category.py def _compute_product_count(self): - read_group_res = self.env['product.template'].read_group( - [('pos_categ_id', 'child_of', self.ids)], - ['pos_categ_id'], ['pos_categ_id']) - group_data = dict( - (data['pos_categ_id'][0], data['pos_categ_id_count']) for data - in read_group_res) - for pos_categ in self: - product_count = 0 - for sub_categ_id in pos_categ.search([('id', 'child_of', pos_categ.ids)]).ids: - product_count += group_data.get(sub_categ_id, 0) - pos_categ.product_count = product_count + pto = self.env['product.template'] + for categ in self: + categ.product_count = pto.search_count([('pos_categ_ids', 'in', categ.id)]) diff --git a/pos_usability_akretion/models/pos_order.py b/pos_usability_akretion/models/pos_order.py index 5191b36..75d02d4 100644 --- a/pos_usability_akretion/models/pos_order.py +++ b/pos_usability_akretion/models/pos_order.py @@ -1,4 +1,4 @@ -# Copyright 2024 Akretion France (http://www.akretion.com/) +# Copyright 2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/pos_usability_akretion/models/pos_payment_method.py b/pos_usability_akretion/models/pos_payment_method.py index 41114d1..c767ed9 100644 --- a/pos_usability_akretion/models/pos_payment_method.py +++ b/pos_usability_akretion/models/pos_payment_method.py @@ -1,4 +1,4 @@ -# Copyright 2021 Akretion France (http://www.akretion.com/) +# Copyright 2021-2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -8,9 +8,7 @@ from odoo import fields, models class PosPaymentMethod(models.Model): _inherit = 'pos.payment.method' _check_company_auto = True - _order = 'sequence, id' outstanding_account_id = fields.Many2one(check_company=True) receivable_account_id = fields.Many2one(check_company=True) journal_id = fields.Many2one(check_company=True) - sequence = fields.Integer(default=10) diff --git a/pos_usability_akretion/models/pos_session.py b/pos_usability_akretion/models/pos_session.py deleted file mode 100644 index 73dbe8d..0000000 --- a/pos_usability_akretion/models/pos_session.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 Akretion France (http://www.akretion.com/) -# @author: Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import models - - -class PosSession(models.Model): - _inherit = 'pos.session' - - def _loader_params_pos_payment_method(self): - res = super()._loader_params_pos_payment_method() - res['search_params']['order'] = "sequence, id" - return res diff --git a/pos_usability_akretion/models/product.py b/pos_usability_akretion/models/product.py index b56211d..584387d 100644 --- a/pos_usability_akretion/models/product.py +++ b/pos_usability_akretion/models/product.py @@ -1,4 +1,4 @@ -# Copyright 2017-2021 Akretion France (http://www.akretion.com/) +# Copyright 2017-2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -10,4 +10,3 @@ class ProductTemplate(models.Model): available_in_pos = fields.Boolean(tracking=True, default=True) to_weight = fields.Boolean(tracking=True) - pos_categ_id = fields.Many2one(tracking=True) diff --git a/pos_usability_akretion/views/pos_category.xml b/pos_usability_akretion/views/pos_category.xml index 34a17ed..c34e8a1 100644 --- a/pos_usability_akretion/views/pos_category.xml +++ b/pos_usability_akretion/views/pos_category.xml @@ -1,7 +1,7 @@ @@ -20,7 +20,7 @@ name="%(product.product_template_action_all)d" icon="fa-th-list" type="action" - context="{'search_default_pos_categ_id': active_id}"> + context="{'search_default_pos_categ_ids': id}">
Products diff --git a/pos_usability_akretion/views/pos_order.xml b/pos_usability_akretion/views/pos_order.xml index 4155cc2..18a1dba 100644 --- a/pos_usability_akretion/views/pos_order.xml +++ b/pos_usability_akretion/views/pos_order.xml @@ -1,31 +1,20 @@ - - pos.order - - - - - - - - - pos.order - - - + + + diff --git a/pos_usability_akretion/views/pos_payment_method.xml b/pos_usability_akretion/views/pos_payment_method.xml index 6d2381c..c064508 100644 --- a/pos_usability_akretion/views/pos_payment_method.xml +++ b/pos_usability_akretion/views/pos_payment_method.xml @@ -1,28 +1,18 @@ - - pos.payment.method - - - - - - - - pos.payment.method - - + + diff --git a/pos_usability_akretion/views/pos_session.xml b/pos_usability_akretion/views/pos_session.xml index 1d5beef..45a0f60 100644 --- a/pos_usability_akretion/views/pos_session.xml +++ b/pos_usability_akretion/views/pos_session.xml @@ -1,7 +1,7 @@ @@ -13,19 +13,19 @@ - pos.session - - - - state == 'opened' - + pos.session + + + + state == 'opened' + diff --git a/pos_usability_akretion/views/product.xml b/pos_usability_akretion/views/product.xml deleted file mode 100644 index 20b09c5..0000000 --- a/pos_usability_akretion/views/product.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - usability.pos.product.template - product.template - - - - 1 - - -
- -
-
-
-
- - - pos_usability.product.template.search - product.template - - - - - - - - - -
diff --git a/pos_usability_akretion/views/report_pos_order.xml b/pos_usability_akretion/views/report_pos_order.xml index 665ff80..f5394cc 100644 --- a/pos_usability_akretion/views/report_pos_order.xml +++ b/pos_usability_akretion/views/report_pos_order.xml @@ -1,7 +1,6 @@ -