data = [{'account_type': u'account_type', 'balance': 3484382.4899999998, 'type': 'report', 'name': u'Assets', 'level': 1}, {'account_type': u'liquidity', 'balance': 87301.78, 'type': 'account', 'name': u'100101 Cash', 'level': 4}, {'account_type': u'liquidity', 'balance': 257350.98, 'type': 'account', 'name': u'100201 HDFC Bank', 'level': 4}]
@api.multi
def account_fun():
for item in data:
return item['balance']
我打电话使用计算函数,并获得预期的单例错误。但我希望将数据中的所有余额逐个存储到数据库中。在odoo中的account.account表中。在odoo帐户树视图中预期的单身错误
balance = field.Float(string="Balance",compute="account_fun")#creating new balance field.
我该怎么办that.and必须显示在列表视图中余额字段。谢谢,
这里只获取列表视图(每行)的值,但我需要不同的值在行中。像3484382,87301.78 – ShivaGuntuku
这就是为什么我首先提到,我不明白你想要设置什么平衡。如果平衡字段是功能性的,那么它应该如何计算,您需要指定该点。但是,如上所述,您绝不会在字典列表中获取数据。 –