2

在Odoo11中,我可以通过这种方式获取交易参考

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

但在 Odoo13 中,payment_tx_id字段已从销售订单中删除,

4

1 回答 1

3

字段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')))
于 2020-04-02T05:33:52.003 回答