~syleam/openobject-addons/trunk-l10n_fr

« back to all changes in this revision

Viewing changes to event_project/wizard/event_task.py

  • Committer: qdp
  • Date: 2008-10-28 16:29:45 UTC
  • mto: (1776.1.1 addons)
  • mto: This revision was merged to the branch mainline in revision 1778.
  • Revision ID: qdp-launchpad@tinyerp.com-20081028162945-hk81vldgjt0y0cq3
*splitted event into 2 modules (added event_project) in order to remove the dependancy to project
*small bugfix

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
import wizard
 
3
import pooler
 
4
 
 
5
def _event_tasks(self, cr, uid, data, context):
 
6
    event_id = data['id']
 
7
    cr.execute('''SELECT project_id FROM event_event WHERE id = %d '''% (event_id, ))
 
8
    res = cr.fetchone()
 
9
    if not res[0]:
 
10
        raise wizard.except_wizard('Error !', 'No project defined for this event.\nYou can create one with the retro-planning button !')
 
11
    value = {
 
12
        'domain': [('project_id', '=', res[0])],
 
13
        'name': 'Tasks',
 
14
        'view_type': 'form',
 
15
        'view_mode': 'tree,form,calendar',
 
16
        'res_model': 'project.task',
 
17
        'context': { },
 
18
        'type': 'ir.actions.act_window'
 
19
    }
 
20
    return value
 
21
 
 
22
class wizard_event_tasks(wizard.interface):
 
23
    states = {
 
24
        'init': {
 
25
            'actions': [],
 
26
            'result': {
 
27
                'type': 'action',
 
28
                'action': _event_tasks,
 
29
                'state': 'end'
 
30
            }
 
31
        },
 
32
    }
 
33
wizard_event_tasks("wizard_event_tasks")
 
34
 
 
35
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
36