~openerp-commiter/openobject-addons/extra-6.0

« back to all changes in this revision

Viewing changes to zarafa/wizard/wizard_zarafa_contacts.py

  • Committer: Fabien Pinckaers
  • Date: 2009-02-06 10:25:35 UTC
  • mfrom: (3547.1.3 trunk-extra-addons)
  • Revision ID: fp@tinyerp.com-20090206102535-1eykxxd9d8uwb8cv
Adding Sednacom Zarafa Module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#coding: utf-8
 
3
#
 
4
# (c) 2008 Sednacom <http://www.sednacom.fr>
 
5
#
 
6
# authors :
 
7
#  - Brice < brice@sednacom.fr >
 
8
#
 
9
#
 
10
# This program is free software; you can redistribute it and/or modify
 
11
# it under the terms of the GNU General Public License as published by
 
12
# the Free Software Foundation; either version 2 of the License, or
 
13
# (at your option) any later version.
 
14
#
 
15
# This program is distributed in the hope that it will be useful,
 
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
# GNU General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU General Public License
 
21
# along with this program; if not, write to the Free Software
 
22
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
23
 
 
24
import wizard
 
25
import pooler
 
26
 
 
27
init_form_desc = """<?xml version="1.0" ?>
 
28
<form string="Zarafa">
 
29
    <label string="Import contacts (Zarafa)" />
 
30
</form>
 
31
"""
 
32
 
 
33
end_form_desc = """<?xml version="1.0" ?>
 
34
<form string="Zarafa">
 
35
    <label string="Import OK !" />
 
36
</form>
 
37
"""
 
38
 
 
39
class wizard_zarafa_contact_import( wizard.interface ):
 
40
 
 
41
    def _do_import( wiz, cr, uid, data, context ):
 
42
        pooloo = pooler.get_pool(cr.dbname)
 
43
        obj = pooloo.get('zarafa.contact')
 
44
 
 
45
        obj._import(cr, uid, context)
 
46
 
 
47
        return {}
 
48
 
 
49
    states = {
 
50
        'init' : {
 
51
            'actions' : [ ],
 
52
            'result' : {
 
53
                'type' : 'form' ,
 
54
                'arch': init_form_desc ,
 
55
                'fields': {} ,
 
56
                'state': [ ( 'doit', 'Import' ), ],
 
57
                }
 
58
            },
 
59
        'doit' : {
 
60
            'actions' : [_do_import, ],
 
61
            'result' : {
 
62
                'type' : 'state' ,
 
63
                'state': 'done' ,
 
64
                }
 
65
            },
 
66
        'done' : {
 
67
            'actions' : [  ],
 
68
            'result' : {
 
69
                'type' : 'form' ,
 
70
                'arch': end_form_desc ,
 
71
                'fields': {} ,
 
72
                'state': [( 'end', 'Ok' ),  ],
 
73
            },
 
74
        },
 
75
    }
 
76
 
 
77
wizard_zarafa_contact_import( 'zarafa.contact.import' )