[FIX] pos_loyalty: consider falsy query case

When limited_products_amout is 0, query is an
empty list. In this case, we do not need to
modify the result further, so we return it
as is.

Part-of: odoo/odoo#84719
This commit is contained in:
Eleftherios Kritsotakis
2022-06-03 16:39:49 +02:00
committed by Joseph Caburnay
parent e58f864fd7
commit 891bd99299
+3
View File
@@ -74,6 +74,9 @@ class PosSession(models.Model):
query = self.env['loyalty.card']._search(
[('program_id', '=', self.config_id.loyalty_program_id.id), ('partner_id', 'in', partner_ids)]
)
# query can be falsy
if not query:
return result
query_str, params = query.select('id', 'partner_id', 'points')
self.env.cr.execute(query_str, params)
for res in self.env.cr.dictfetchall():