【问题标题】:How to write fields in Odoo with XMLRPC?如何使用 XMLRPC 在 Odoo 中编写字段?
【发布时间】:2021-12-05 05:13:06
【问题描述】:

我想用 write 方法覆盖 account_invoice 中的一行发票。 代码:

 def modifyInvoice(id):

    invoiceLines = [(1,id,{
    'account_id': 636, 
    'name': "iPod2", 
    'quantity': 155,                                                         
    'price_unit': 17, 
    'product_id': 1})]

    vals = {
            'invoice_line_ids' : invoiceLines,
    }
    Invoice = call(url, "object", "execute", DB, uid, PASS, 'account.invoice', 'write', 
    vals)
    print('invoice ...', Invoice)

这里是错误: rgs, **kwargs)\nTypeError: write() 缺少 1 个必需的位置参数:'vals'\n','message':“write() 缺少 1 个必需的位置参数:'vals'”,'arguments': [" write() 缺少 1 个必需的位置参数:'vals'"], 'exception_type': 'internal_error'}}

我需要帮助!

【问题讨论】:

    标签: python xml rpc xml-rpc odoo-11


    【解决方案1】:

    这是因为您没有传递要更新的发票 ID。 在这一行中,将其作为 this 传递

    Invoice = call(url, "object", "execute", DB, uid, PASS, 'account.invoice', 'write', [[invoice_id],vals])
    

    查看这些文档:Odoo XMLRPC

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-30
      相关资源
      最近更新 更多