更新使用不同字段函数的函数字段

时间:2015-05-27 12:20:32

标签: openerp odoo

我有一个问题,因为一个月更新功能字段'结果'使用不同的字段函数' field2' (没有问题更新)?

_name = 'x'
'field1': fields.integer(readonly=True),
'field2': fields.function(count_x_id_in_y, type='integer',
          store={'y': (get_x_id_from_y, ['x_id'], 10)}),
'result': fields.function(add, type='integer',
          store={'x': (lambda self, cr, uid, ids, c={}: ids, ['field1','field2'], 10)}),

def add(self, cr, uid, ids, field_name, args, context=None):
    res = {}
    for record in self.browse(cr, uid, ids, context=context):
        res[record.id] =  record.field1 + record.field2
    return res

0 个答案:

没有答案