~project-core-editors/project-service/trunk

« back to all changes in this revision

Viewing changes to project_issue_service/project_issue.py

  • Committer: Guewen Baconnier
  • Author(s): Daniel Reis
  • Date: 2013-01-03 11:34:54 UTC
  • mfrom: (19.1.2 project-service-sequences)
  • Revision ID: guewen.baconnier@camptocamp.com-20130103113454-ov1q8obbla7abrdx
[ADD] Reference sequences for Issues, configurable by Category

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from datetime import datetime, timedelta
24
24
import time
25
25
 
26
 
#FUTURE: create a module to assign working calendars per team
27
 
#class crm_case_section(osv.osv):
28
 
#    _inherit = "crm.case.section"
29
 
#    _columns = {
30
 
#        'resource_calendar_id' : fields.many2one('resource.calendar', 'Working Time',\
31
 
#            help="Timetable working hours to calculate issue open time", ),
32
 
#    }
33
 
#crm_case_section()
34
 
 
35
26
 
36
27
class project_issue(osv.osv):
37
28
    _inherit = 'project.issue'
39
30
    #added fields:
40
31
        'functional_block_id': fields.many2one('project.functional_block', 'Component', help = "Component (system, module, function) to be adressed"),
41
32
        'assigned_to': fields.related('task_id', 'user_id', string = 'Task Assigned to', type="many2one", relation="res.users", store=True, help='This is the current user to whom the related task was assigned'),
42
 
        'ref': fields.char('Code', size=10, readonly=True, select=True, help="Issue sequence number"),
43
33
        'tasks': fields.one2many('project.task', 'issue_id', 'Related tasks', help="Task history for the issue"),
44
34
        'create_uid': fields.many2one('res.users', 'Created by', help = "Person who reported the issue"),
45
35
    #modified fields:
46
36
        'categ_id': fields.many2one('crm.case.categ', 'Category', required=True, 
47
 
            domain="[('object_id.model', '=', 'project.issue'),('parent_id','!=',None)]",
 
37
            domain="[('object_id.model','=','project.issue')]",
48
38
            help="Only categories with a parent will be selectable in the Issues form."),
49
39
    }
50
 
    
51
 
    def create(self, cr, uid, vals, context={}):
52
 
        """Issue sequence"""
53
 
        vals['ref'] = self.pool.get('ir.sequence').next_by_code(cr, uid, 'project.issue')
54
 
        return super(project_issue, self).create(cr, uid, vals, context)        
55
40
 
56
41
    def case_open(self, cr, uid, ids, *args):
57
42
        """Open Issue preserving the assigned user_id.
176
161
 
177
162
project_issue()
178
163
    
179
 
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
 
b'\\ No newline at end of file'
 
164
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: