I want to get the opportunity state in the BOQ projects because I have fields in BOQ want to be shown only in quotation state so I need to get the opportunity state in the BOQ project ,
Now I have this method to return the opportunity state but I have an issue with ids is that must be boq_project_id ? how can I get the boq_project_id because that method rasie ana error :
2015-03-04 10:08:16,893 2372 ERROR EXD-SA openerp.sql_db: bad query: SELECT boq_projects."opportunity_id",boq_projects.id FROM "boq_projects" WHERE boq_projects.id IN ('lang', 'crm_stage', 'tz', 'uid') ORDER BY id.
If I replace the ids with any boq_project id such as : 260 then every thing working good and method return the state successfully.
Could anyone tell me what is the error in my method ?
class boq_projects(osv.osv):
_name = "boq.projects"
_description = "BoQ Projects"
def _opportunity_state(self, cr, uid, ids, context=None):
reads = self.read(cr, uid, ids, ['opportunity_id'], context)
opp_id = reads['opportunity_id'][0]
print opp_id, '@@@@@@@@@@@@@@@@@@@'
lead_obj = self.pool.get('crm.lead')
lead = lead_obj.read(cr, uid, opp_id, ['state'])
print lead,'@@@@@@@@@@@@@@@@@@@'
return lead['state']
_columns = {
.
.
.
.
'boq_state' : fields.char('state'),
}
_defaults = {
'boq_state': _opportunity_state
}
THANKS IN ADVANCE