2

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,

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58
Unknown
  • 401
  • 4
  • 15

1 Answers1

3

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')))
Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58
Vishnu VaNnErI
  • 931
  • 6
  • 18
  • thank you for your answer, but I don't no why I get **False** when I print **transaction.reference** – Unknown Apr 02 '20 at 12:22
  • 1
    Reference will be null that's why, which code you applied?. – Vishnu VaNnErI Apr 02 '20 at 13:54
  • from the first method, and I get **transaction reference** from the second method ***references = order.transaction_ids.mapped('reference') print(references[0])*** – Unknown Apr 03 '20 at 16:27