python - OpenERP - onchange method for fields in different page of view? -
it seems onchange method works on current visible fields. if use fill other fields in other pages of view, not anything. example have view many pages. information needs filled in first page, fields filled correctly. there 1 field need fill in other page, when choose partner_id
in page. example in view this:
... <page string="page1"> <field name=partner_id on_change="onchange_partner(partner_id)" <field name="field1"/> <field name="field2"/> </page> <page string="page2"> <field name="field3"/> </page> ...
field1
, field2
filled. how fill field3 or impossible, because system not save database using onchange method?
my onchange method looks this:
def onchange_partner(self, cr, uid, ids, partner_id, context=none): res = {} if partner_id: obj = self.pool.get('res.partner').browse(cr, uid, partner_id) res['field1'] = obj.field1 res['field2'] = obj.field2 res['field3'] = obj.field3 # value isn't being filled return {'value': res}
so how fill field3
?
its not that. change value. might not getting value in field3 because record fetching not have value of field3. , answer question it works. try this,
def onchange_partner(self, cr, uid, ids, partner_id, context=none): res = {} if partner_id: obj = self.pool.get('res.partner').browse(cr, uid, partner_id) res['field1'] = obj.field1 res['field2'] = obj.field2 res['field3'] = 'hello' # field type must char or if not give #value accordingly, prove values filled on onchange. return {'value': res}
hope you.
Comments
Post a Comment