Skip to content
Snippets Groups Projects
Commit b64f9bfe authored by Pedram (PEBR)'s avatar Pedram (PEBR)
Browse files

[FIX] pos_loyalty: prevent loading a product twice


Before this commit, if a product was set to be available in the PoS,
and also existed in a reward, it was loaded to the PoS twice. This
caused issues in _loadProductProduct during the assigning of pricelist
items, and could result in missing pricelist information for a product.

opw-3487702

closes odoo/odoo#134835

Signed-off-by: default avatarJoseph Caburnay (jcb) <jcb@odoo.com>
parent fb1b607f
Branches
Tags
No related merge requests found
......@@ -58,9 +58,12 @@ class PosSession(models.Model):
def _get_pos_ui_product_product(self, params):
result = super()._get_pos_ui_product_product(params)
self = self.with_context(**params['context'])
rewards = self.config_id._get_program_ids().reward_ids
products = rewards.discount_line_product_id | rewards.reward_product_ids
products = self.env['product.product'].search_read([('id', 'in', products.ids)], fields=params['search_params']['fields'])
# Only load products that are not already in the result
products = list(set(products.ids) - set(product['id'] for product in result))
products = self.env['product.product'].search_read([('id', 'in', products)], fields=params['search_params']['fields'])
self._process_pos_ui_product_product(products)
result.extend(products)
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment