~vauxoo/addons-vauxoo/8.0-import_tax_tariff-dev-yani-rev-2

« back to all changes in this revision

Viewing changes to project_conf/model/project.py

[MERGE] deprecated used of state in project in module project_conf

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        '''
39
39
        context = context or {}
40
40
        #Dont send context to dont get language of user in read method
41
 
        #@ids in v8 is not a dictionary
42
 
        #@stage deprecated in v8 by odoo
43
 
        #~ if ids.get('stage_id'): #comment while is migrate to v8 this module
44
 
        if {}.get('stage_id'):
45
 
            type = self.pool.get('project.task.type').read(cr, uid, ids['stage_id'][0], ['name'])
46
 
            if type.get('name', False) == 'Backlog':
47
 
                self.send_mail_task(cr,uid,ids,'template_send_email_task_new',context)
48
 
            elif type.get('name', False) == 'Testing Leader':
49
 
                self.send_mail_task(cr,uid,ids,'template_send_email_task_end',context)
 
41
        if ids.stage_id:
 
42
            type = ids.stage_id.name or ''
 
43
            if type == 'Backlog':
 
44
                self.send_mail_task(cr, uid, ids, 'template_send_email_task_new', context)
 
45
            elif type == 'Testing Leader':
 
46
                self.send_mail_task(cr, uid, ids, 'template_send_email_task_end', context)
50
47
            
51
 
    def send_mail_task(self,cr,uid,ids,template,context=None):
 
48
    def send_mail_task(self, cr, uid, ids, template, context=None):
52
49
        imd_obj = self.pool.get('ir.model.data')
53
50
        template_ids = imd_obj.search(
54
51
            cr, uid, [('model', '=', 'email.template'), ('name', '=', template)])
55
52
        if template_ids:
56
53
            res_id = imd_obj.read(
57
54
                cr, uid, template_ids, ['res_id'])[0]['res_id']
58
 
 
59
 
            followers = self.read(cr, uid, ids.get('id'), [
 
55
            ids = [ids.id]
 
56
            followers = self.read(cr, uid, ids[0], [
60
57
                                  'message_follower_ids'])['message_follower_ids']
61
58
 
62
 
            ids = [ids.get('id')]
63
59
            body_html = self.pool.get('email.template').read(
64
60
                cr, uid, res_id, ['body_html']).get('body_html')
65
61
            context.update({'default_template_id': res_id,