[FIX] pos_loyalty: properly load loyalty_points for all partners
Before this commit, the loyalty_points field, neccessary to implement the loyalty functionality in PoS in offline mode, was only loaded properly for the partners at the start of a PoS session. After this commit, the loyalty_points are loaded properly for every partner throughout the duration of the session, including those that are loaded in the background or fetched when using the search bar, which was not the case before. Part-of: odoo/odoo#84719
This commit is contained in:
committed by
Joseph Caburnay
parent
602acc4801
commit
b0ea01ff1e
@@ -58,6 +58,13 @@ class PosSession(models.Model):
|
||||
|
||||
def _get_pos_ui_res_partner(self, params):
|
||||
result = super()._get_pos_ui_res_partner(params)
|
||||
return self._load_pos_ui_loyalty_points(result)
|
||||
|
||||
def get_pos_ui_res_partner_by_params(self, custom_search_params):
|
||||
partners = super().get_pos_ui_res_partner_by_params(custom_search_params)
|
||||
return self._load_pos_ui_loyalty_points(partners)
|
||||
|
||||
def _load_pos_ui_loyalty_points(self, result):
|
||||
# In order to make loyalty programs work offline we load the partner's point into
|
||||
# a non-existant field 'loyalty_points'.
|
||||
if self.config_id.loyalty_program_id:
|
||||
|
||||
Reference in New Issue
Block a user