如何在Odoo13中获取交易参考
在Odoo11中,我可以通过这种方式获取事务引用如何在Odoo13中获取交易参考,odoo,odoo-11,odoo-13,Odoo,Odoo 11,Odoo 13,在Odoo11中,我可以通过这种方式获取事务引用 transaction = request.website.sale_get_order().payment_tx_id transaction.reference 但在Odoo13中,payment\u tx\u id字段已从销售订单中删除,字段manyOne(payment\u tx\u id)改为Many2many(transaction\u id)类型已从Odoo12更改 请尝试使用以下代码: order = request.websi
transaction = request.website.sale_get_order().payment_tx_id
transaction.reference
但在Odoo13中,payment\u tx\u id
字段已从销售订单中删除,字段manyOne(payment\u tx\u id)改为Many2many(transaction\u id)类型已从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')))
谢谢您的回答,但我不知道打印事务时为什么会出现False。referenceReference将为null这就是为什么,您应用了哪种代码?。从第一个方法,我从第二个方法获取事务引用references=order.transaction_id.mapped('reference')print(引用[0])