On 26 Jan 06:51, sunny14...@gmail.com wrote:
> 
> Hi Cédric,
> Thank you very much for your help. I am sharing the code which i am trying. 
> it may give more understanding.
>  
> Following are the three fields in my model.
> on change of appartment i am tryting to set flat_numbers.
> 
> But flat_numbers appears to be empty even if i return return 
> [('101',101),('201',201)].
> 
> Please let me know what i am doing wrong here.
> 
> appartment = fields.Many2One('apt.model','Apt')
> 
> flat_numbers = fields.Selection([ ],
>         'Flat Numbers',states={
>             'invisible': ~Eval('appartment'),
>             }, on_change_with=['appartment'],
>         depends=['appartment'])
> 
> def on_change_with_flat_numbers(self):
>          return [('101',101),('201',201)]

on_change_with is to change the actual value of the field [1].
What you are looking for is selection_change_with [2].

[1] 
http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=on_change_with#trytond.model.fields.Field.on_change_with
[2] 
http://doc.tryton.org/3.0/trytond/doc/ref/models/fields.html?highlight=selection_change_with#trytond.model.fields.Selection.selection_change_with


PS: Please don't top-post on this mailing list, see
http://groups.tryton.org/netiquette
-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgpAkcM2bDg2Q.pgp
Description: PGP signature

Reply via email to