Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Odoo13中获取交易参考_Odoo_Odoo 11_Odoo 13 - Fatal编程技术网

如何在Odoo13中获取交易参考

如何在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

在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.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])