~unifield-team/unifield-addons/uf-2527-addons

« back to all changes in this revision

Viewing changes to hr_timesheet_invoice/wizard/account_analytic_profit.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
4
#
 
5
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
 
6
#
 
7
# WARNING: This program as such is intended to be used by professional
 
8
# programmers who take the whole responsability of assessing all potential
 
9
# consequences resulting from its eventual inadequacies and bugs
 
10
# End users who are looking for a ready-to-use solution with commercial
 
11
# garantees and support are strongly adviced to contract a Free Software
 
12
# Service Company
 
13
#
 
14
# This program is Free Software; you can redistribute it and/or
 
15
# modify it under the terms of the GNU General Public License
 
16
# as published by the Free Software Foundation; either version 2
 
17
# of the License, or (at your option) any later version.
 
18
#
 
19
# This program is distributed in the hope that it will be useful,
 
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
# GNU General Public License for more details.
 
23
#
 
24
# You should have received a copy of the GNU General Public License
 
25
# along with this program; if not, write to the Free Software
 
26
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
27
#
 
28
##############################################################################
 
29
 
 
30
import wizard
 
31
import datetime
 
32
 
 
33
form='''<?xml version="1.0"?>
 
34
<form string="Choose">
 
35
        <field name="date_from"/>
 
36
        <field name="date_to"/>
 
37
        <field name="journal_ids" colspan="3"/>
 
38
        <field name="employee_ids" colspan="3"/>
 
39
</form>'''
 
40
 
 
41
class wizard_report(wizard.interface):
 
42
        def _date_from(*a):
 
43
                return datetime.datetime.today().strftime('%Y-%m-1')
 
44
        def _date_to(*a):
 
45
                return datetime.datetime.today().strftime('%Y-%m-%d')
 
46
 
 
47
        fields={
 
48
                'date_from':{
 
49
                        'string':'From',
 
50
                        'type':'date',
 
51
                        'required':True,
 
52
                        'default':_date_from,
 
53
                },
 
54
                'date_to':{
 
55
                        'string':'To',
 
56
                        'type':'date',
 
57
                        'required':True,
 
58
                        'default':_date_to,
 
59
                },
 
60
                'journal_ids':{
 
61
                        'string':'Journal',
 
62
                        'type':'many2many',
 
63
                        'relation':'account.analytic.journal',
 
64
                        'required':True,
 
65
                },
 
66
                'employee_ids':{
 
67
                        'string':'Employee',
 
68
                        'type':'many2many',
 
69
                        'relation':'res.users',
 
70
                        'required':True,
 
71
                },
 
72
        }
 
73
 
 
74
        states={
 
75
                'init':{
 
76
                        'actions':[],
 
77
                        'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel'), ('report', 'Print')]}
 
78
                },
 
79
                'report':{
 
80
                        'actions':[],
 
81
                        'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'}
 
82
                }
 
83
        }
 
84
wizard_report('account.analytic.profit')