在Odoo11中,我可以通过这种方式获取交易参考
transaction = request.website.sale_get_order().payment_tx_id
transaction.reference
但在 Odoo13 中,payment_tx_id
字段已从销售订单中删除,
字段Many2one (payment_tx_id) 到 Many2many (transaction_ids)类型从 Odoo12 更改。
尝试使用以下代码:
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')))