[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -6,20 +6,23 @@ from odoo import fields, models
class PosCategory(models.Model):
_inherit = 'pos.category'
_inherit = "pos.category"
product_count = fields.Integer(
'# Products', compute='_compute_product_count',
"# Products",
compute="_compute_product_count",
help="The number of products under this point of sale category "
"(does not consider the children categories)")
"(does not consider the children categories)",
)
# inspired by the code of odoo/addons/product/models/product.py
def _compute_product_count(self):
read_group_res = self.env['product.template'].read_group(
[('pos_categ_id', 'in', 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)
read_group_res = self.env["product.template"].read_group(
[("pos_categ_id", "in", self.ids)], ["pos_categ_id"], ["pos_categ_id"]
)
group_data = {
data["pos_categ_id"][0]: data["pos_categ_id_count"]
for data in read_group_res
}
for pos_categ in self:
pos_categ.product_count = group_data.get(pos_categ.id, 0)

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class PosPaymentMethod(models.Model):
_inherit = 'pos.payment.method'
_inherit = "pos.payment.method"
_check_company_auto = True
cash_journal_id = fields.Many2one(check_company=True)

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
_inherit = "product.template"
available_in_pos = fields.Boolean(tracking=True)
pos_categ_id = fields.Many2one(tracking=True)