How I can get transaction reference in Odoo13

Viewed 114

In Odoo11, I can get transaction reference by this way

transaction = request.website.sale_get_order().payment_tx_id
transaction.reference

But in Odoo13, payment_tx_id field has removed from sales order,

1 Answers

Field Many2one (payment_tx_id) to Many2many (transaction_ids) type changed from Odoo12.

Try with following code:

order = request.website.sale_get_order()

#if you need to get last transaction
transaction = order.get_portal_last_transaction()
reference = transaction.reference



#if you need all reference to listed
reference =  str(', '.join(order.transaction_ids.mapped('reference')))
Related