[FIX] point_of_sale: fix error on reading multiple pos.session

Fixup for https://github.com/odoo/odoo/pull/69933

Standard deployment is not affected, because the computed fields is used in form
only, so `self==session` there, but it may be not the case with customization

Thanks @mahmoudfakhereldin for pointing the problem

closes odoo/odoo#73584

X-original-commit: 0a57e10accfa12dae5fea5bb8cb65b90bdf6e839
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
This commit is contained in:
Ivan Yelizariev
2021-07-12 14:45:23 +00:00
parent 4b3dc07b52
commit 5ed4559f6e
+1 -1
View File
@@ -111,7 +111,7 @@ class PosSession(models.Model):
cash_payment_method = session.payment_method_ids.filtered('is_cash_count')[:1]
if cash_payment_method:
total_cash_payment = 0.0
result = self.env['pos.payment'].read_group([('session_id', '=', self.id), ('payment_method_id', '=', cash_payment_method.id)], ['amount'], ['session_id'])
result = self.env['pos.payment'].read_group([('session_id', '=', session.id), ('payment_method_id', '=', cash_payment_method.id)], ['amount'], ['session_id'])
if result:
total_cash_payment = result[0]['amount']
session.cash_register_total_entry_encoding = session.cash_register_id.total_entry_encoding + (