python 2.7 - How to get an id in a many2many field? -


does can explain going on sql statement. here code chunk.

for in self.pool.get('sale.order').browse(cr,uid,so_id,context):     _logger.info("\n\n\t\t\t sale order id %d"%(so.id))      confirmed_by = so.confirmed_by.id     _logger.info("\n\n\t\t\tconfirmed %s"%(str(confirmed_by)))      rg_id = cr.execute("select rg.id res_users ru,res_groups rg,res_groups_users_rel rgr                             ru.id = rgr.uid , rgr.gid = rg.id , ru.id = "+str(confirmed_by)+" , rg.name 'project second user'")     _logger.info("\n\n\t\t\tres groups ids %s"%(rg_id)) 

my confirmed returns id don't know why rg_id returns none when executed. when used in pgadmin query works fine.

any appreciated.

this how manage solve none issue:

cr.execute("select rg.id res_users ru,res_groups rg,res_groups_users_rel rgr                  ru.id = rgr.uid , rgr.gid = rg.id , ru.id = "+str(confirmed_by)+" , rg.name 'project second user'") rg_id = cr.fetchall() 

now, rg_id returning either id table res_groups or [] if there no record found.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -