return result.keys()
def _save_state(self, cr, uid, task_id, field_name, field_value, arg, context=None):
- stage_obj = self.pool.get('project.task.type')
- stage_ids = stage_obj.search(cr, uid, [('state', '=', field_value)], context=context)
+ stage_ids = self.pool.get('project.task.type').search(cr, uid, [('state', '=', field_value)], context=context)
if stage_ids:
self.write(cr, uid, task_id, {'type_id': stage_ids[0]}, context=context)
else:
- cr.execute("""update project_task set state=%s where id=%s""", (field_value, task_id, ))
+ cr.execute("""UPDATE project_task SET state=%s WHERE id=%s""", (field_value, task_id, ))
return True
_columns = {
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."),
'type_id': fields.many2one('project.task.type', 'Stage'),
'state': fields.function(_get_state, fnct_inv=_save_state, type='selection', selection=_TASK_STATE, string="State", readonly=True,
- store = {
+ store = {
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['type_id'], 10),
'project.task.type': (_get_stage, ['state'], 10)
- }, help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\
- \n If the task is over, the states is set to \'Done\'.'),
+ }, help='If the task is created the state is \'Draft\'.\
+ \n If the task is started, the state becomes \'In Progress\'.\
+ \n If review is needed the task is in \'Pending\' state.\
+ \n If the task is over, the states is set to \'Done\'.'),
'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready To Pull')], 'Kanban State',
help="A task's kanban state indicates special situations affecting it:\n"
" * Normal is the default situation\n"
new_stage = vals.get('type_id')
vals_reset_kstate = dict(vals, kanban_state='normal')
for t in self.browse(cr, uid, ids, context=context):
+ #TO FIX:Kanban view doesn't raise warning
+# stages = [stage.id for stage in t.project_id.type_ids]
+# if new_stage not in stages:
+# raise osv.except_osv(_('Warning !'), _('Stage is not defined in the project.'))
write_vals = vals_reset_kstate if t.type_id != new_stage else vals
super(task,self).write(cr, uid, [t.id], write_vals, context=context)
result = True
<record id="project_tt_specification" model="project.task.type">
<field name="sequence">1</field>
<field name="name">Design</field>
+ <field name="state">draft</field>
<field name="project_default" eval="1"/>
</record>
<record id="project_tt_development" model="project.task.type">
<field name="sequence">2</field>
<field name="name">Development</field>
+ <field name="state">open</field>
<field name="project_default" eval="1"/>
</record>
<record id="project_tt_testing" model="project.task.type">
<field name="sequence">3</field>
<field name="name">Testing</field>
+ <field name="state">pending</field>
<field name="project_default" eval="1"/>
</record>
<record id="project_tt_merge" model="project.task.type">
<field name="sequence">4</field>
<field name="name">Deployment</field>
+ <field name="state">done</field>
<field name="project_default" eval="1"/>
</record>
</data>
return result.keys()
def _save_state(self, cr, uid, issue_id, field_name, field_value, arg, context=None):
- stage_obj = self.pool.get('project.task.type')
- stage_ids = stage_obj.search(cr, uid, [('state', '=', field_value)], context=context)
+ stage_ids = self.pool.get('project.task.type').search(cr, uid, [('state', '=', field_value)], context=context)
if stage_ids:
self.write(cr, uid, [issue_id], {'type_id': stage_ids[0]}, context=context)
else:
- cr.execute("""update project_issue set state=%s where id=%s""", (field_value, issue_id, ))
+ cr.execute("""UPDATE project_issue SET state=%s WHERE id=%s""", (field_value, issue_id, ))
return True
_columns = {
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Description'),
'state': fields.function(_get_state, fnct_inv=_save_state, type='selection', selection=_ISSUE_STATE, string="State", readonly=True,
- store = {
+ store = {
'project.issue': (lambda self, cr, uid, ids, c={}: ids, ['type_id'], 10),
'project.task.type': (_get_stage, ['state'], 10)
- }, help='The state is set to \'Draft\', when a case is created.\
- \nIf the case is in progress the state is set to \'Open\'.\
- \nWhen the case is over, the state is set to \'Done\'.\
- \nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
+ }, help='The state is set to \'Draft\', when a case is created.\
+ \nIf the case is in progress the state is set to \'Open\'.\
+ \nWhen the case is over, the state is set to \'Done\'.\
+ \nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'email_from': fields.char('Email', size=128, help="These people will receive email.", select=1),
'email_cc': fields.char('Watchers Emails', size=256, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'date_open': fields.datetime('Opened', readonly=True,select=True),