To Override the base.stage method in project module and Parameter of the stage search taken from the lead and also section_id if set, stages must belong to this section or be a default stage; if not set, stages must be default stages in project module in openerp. use this given code in .py file in openerp.
def stagefind(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None):
if isinstance(cases, (int, long)):
cases = self.browse(cr, uid, cases, context=context)
# collect all section_ids
section_ids = []
if section_id:
section_ids.append(section_id)
for task in cases:
if task.project_id:
section_ids.append(task.project_id.id)
search_domain = []
if section_ids:
search_domain = [('|')] * (len(section_ids)-1)
for section_id in section_ids:
search_domain.append(('project_ids', '=', section_id))
search_domain += list(domain)
# perform search, return the first found
stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context)
if stage_ids:
return stage_ids[0]
return False
0 Comment(s)