Skip to content
Snippets Groups Projects
Commit 029ee8dc authored by Antoine Prieels's avatar Antoine Prieels
Browse files

[FIX] point_of_sale: Lost payment info


Payment information for terminal transactions (payment_status,
transaction_id & card_type) was lost when going back to the floor
plan in pos_restaurant. Validated transactions were then considered as
not processed yet.

closes odoo/odoo#43550

Signed-off-by: default avatarpimodoo <pimodoo@users.noreply.github.com>
parent 7588e3a2
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ class PosOrder(models.Model):
'payment_method_id': ui_paymentline['payment_method_id'],
'card_type': ui_paymentline.get('card_type'),
'transaction_id': ui_paymentline.get('transaction_id'),
'payment_status': ui_paymentline.get('payment_status'),
'pos_order_id': order.id,
}
......
......@@ -26,6 +26,7 @@ class PosPayment(models.Model):
company_id = fields.Many2one('res.company', string='Company', related='pos_order_id.company_id')
card_type = fields.Char('Type of card used')
transaction_id = fields.Char('Payment Transaction ID')
payment_status = fields.Char('Payment Status')
@api.model
def name_get(self):
......
......@@ -87,6 +87,17 @@ class PosOrder(models.Model):
for order_id, order_lines in groupby(extended_order_lines, key=lambda x:x[2]['order_id']):
next(order for order in orders if order['id'] == order_id[0])['lines'] = list(order_lines)
def _get_fields_for_payment_lines(self):
return [
'id',
'amount',
'pos_order_id',
'payment_method_id',
'card_type',
'transaction_id',
'payment_status'
]
def _get_payment_lines(self, orders):
"""Add account_bank_statement_lines to the orders.
......@@ -97,12 +108,7 @@ class PosOrder(models.Model):
"""
payment_lines = self.env['pos.payment'].search_read(
domain = [('pos_order_id', 'in', [po['id'] for po in orders])],
fields = [
'id',
'amount',
'pos_order_id',
'payment_method_id',
])
fields = self._get_fields_for_payment_lines())
extended_payment_lines = []
for payment_line in payment_lines:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment