Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
6038 Weergaven

I have been working on openerp module development .Today I faced some difficulties while returning dictionary values to a many2one field. I did this thing successfully before but this time I am having some keyerror when try to load openerp server.I checked that my query is working fine and is bringing the exact ids and names but on returning I am getting issue. I am using query to fetch the ids and trying to return them.Here is my code:

def myfunc_name(self,cr,uid,ids,context=None):

domain = [ ]

cr.execute ( ' select id , name from product_category where parent_id is NULL ' )

res = cr.fetchall ( )

for pid,name in res:

         domain.append ( ( pid ) )

         return { ' value ' : { ' categ_temps ' : [ ( ' id ' , ' in ' , domain ) ] } }

 

Please point me my mistake or guide me so that I can get my work done soon. Regards n Thanks

 

Avatar
Annuleer
Beste antwoord

Your return dictionary is wrong.

If you want to return domain you should return like this: `{ 'domain' : { 'categ_temps' : [ ( 'id' , 'in' , domain ) ] } }

If you want to return value you should return like this: `{ 'value' : { 'categ_temps' : [ ( 'id' , 'in' , domain ) ] } }

You may get more information regarding onchange event: https://doc.openerp.com/6.0/developer/2_6_views_events/events/events/#on-change

You should also know that there is an issue with readonly fields used by the onchange-method. See this bug report:https://bugs.launchpad.net/openobject-client/+bug/378824

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
feb. 23
2381
2
aug. 19
4581
0
aug. 18
4748
3
mrt. 24
11651
0
apr. 21
2768