[MIG] pos_usability_akretion: migrate to v18
This commit is contained in:
@@ -2,4 +2,3 @@ from . import product
|
||||
from . import pos_category
|
||||
from . import pos_payment_method
|
||||
from . import pos_order
|
||||
from . import pos_session
|
||||
|
||||
@@ -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 <alexis.delattre@akretion.com>
|
||||
# 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)])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2024 Akretion France (http://www.akretion.com/)
|
||||
# Copyright 2024 Akretion France (https://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
@@ -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 <alexis.delattre@akretion.com>
|
||||
# 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)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Copyright 2023 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
@@ -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 <alexis.delattre@akretion.com>
|
||||
# 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)
|
||||
|
||||
Reference in New Issue
Block a user