如何在 Odoo 12 中使用 Python XML-RPC 注册付款 [英] How to register payment using Python XML-RPC in Odoo 12
本文介绍了如何在 Odoo 12 中使用 Python XML-RPC 注册付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先我创建了函数:
def invoiceRegisterPayment(self,register_payment_row):
confirm_result = self.ODOO_OBJECT.execute_kw(
self.DATA,
self.UID,
self.PASS,
'account.payment',
'action_validate_invoice_payment',
register_payment_row)
return confirm_result
然后我传递了以下参数:
Then I passed the following parameters:
register_payment_row = [
[payment_id],
{
"active_id":invoice_id,
"active_ids":[invoice_id],
"active_model": "account.invoice",
"default_invoice_ids":[[4,invoice_id,None]],
"journal_type":"sale",
"lang":"en_US",
"search_disable_custom_filters": True,
"type": "out_invoice",
"tz": False,
"uid": 2
} ]
但它显示以下错误:仅应调用此方法来处理单个发票的付款."
But it shows the following error: "This method should only be called to process a single invoice's payment."
这是 register_payment_row 的打印:
This is the print of register_payment_row:
[[67], {'active_id': 119, 'active_ids': [119], 'active_model': 'account.invoice', 'default_invoice_ids': [4, 119, None], 'journal_type': 'sale', 'lang': 'en_US', 'search_disable_custom_filters': True, 'type': 'out_invoice', 'tz': False, 'uid': 2}]
推荐答案
请尝试以下数据结构并传递给创建方法 account.payment 模型.
Please try the following data structure and pass to create method account.payment model.
{ invoice_ids: [ [ 4, "Invoice Id", 'None' ] ],
default_invoice_ids: [ [ 4, "Invoice Id", 'None' ] ],
amount: 'Amount',
payment_date: '2019-05-21 02:55:52',
payment_type: 'inbound',
has_invoices: true,
currency_id: 1,
journal_id: 6,
payment_method_id: 1,
partner_id: 226,
partner_type: 'customer',
communication: 'INV/2019/0141/44',
name: 'INV/2019/0141/44' }
这篇关于如何在 Odoo 12 中使用 Python XML-RPC 注册付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文