Hi,
I have data with a many2many relation between 2 models. Simplified model is :
Class property(orm.Model):
_name = 'property'
_columns = {
'value_ids': fields.many2many(
'value', 'property_value', 'property_id', 'value_id', _('Values'))
}
Class value(orm.Model):
_name = 'value'
_columns = {
'property_ids': fields.many2many(
'property', 'property_value', 'value_id', 'property_id', _('Properties')),
'field1': fields.char(_('Field 1')),
'field2': fields.char(_('Field 2'))
}
class dummy(orm.Model):
_name = 'dummy'
_columns = {
'case_study_ids': fields.one2many(
'property', 'dummy_id', string=_('Properties'))}
Until here, everything works fine. Now, on my dummy model form view I have a button who launch a wizard who makes some process over values for a specific property (id passed in context). This wizard first shows values associated to property and allows modifications on them. Then, the internal process is done.
class property_process_wizard(orm.TransientModel):
_name = 'property.process.wizard'
def get_value_ids(self, cr, uid, ids, field_name, arg, context=None):
property_id = context.get('property_id', False)
if not property_id:
return dict([(id, []) for id in ids])value_obj = self.pool.get('value')
value_ids = value_obj.search(cr, uid, vals = [('property_id', '=', property_id)])
return dict([(id, value_ids) for id in ids])
_columns = {
'value_ids': fields.function(get_value_ids, type='one2many',
obj='value'),}
Here is my problem. The field function is not computed when the wizard is launched. Is there a way to force field computation on wizard launching?
Best regards,