50
52
<field name="todate"/>
53
57
def _get_months(sel, cr, uid, context):
63
'emp_ids': {'string':'Employees', 'type':'many2many', 'relation':'hr.employee'},
64
'month': {'string':'Month','type':'selection', 'selection':_get_months},
65
'year':{'string':'Year','type':'integer'},
66
'fromdate': {'string':'From', 'type':'date'},
67
'todate': {'string':'To', 'type':'date'},
68
'active1':{'string':'Month Wise','type':'boolean'},
69
'active2':{'string':'Date Wise','type':'boolean'}
68
'emp_ids': {'string': 'Employees', 'type': 'many2many', 'relation': 'hr.employee'},
69
'month': {'string': 'Month', 'type': 'selection', 'selection': _get_months},
70
'year': {'string': 'Year', 'type': 'integer'},
71
'fromdate': {'string': 'From', 'type': 'date'},
72
'todate': {'string': 'To', 'type': 'date'},
73
'active1': {'string': 'Month Wise', 'type': 'boolean'},
74
'active2': {'string': 'Date Wise', 'type': 'boolean'}
73
class hr_holidays_report(wizard.interface):
78
class hr_holidays_report(osv.osv_memory):
74
80
def year_get(self, cr, uid, data, context):
75
p=int(time.strftime('%Y'))
77
def _riase_error(self, cr, uid, data, context):
79
if not form['emp_ids'][0][2] :
80
raise wizard.except_wizard('Error', 'You must select Employee(s) For report !')
81
p = int(time.strftime('%Y'))
84
def _raise_error(self, cr, uid, data, context):
86
if not form['emp_ids'][0][2]:
88
'Error', 'You must select Employee(s) for report !')
82
89
if form['active1'] and form['active2']:
83
raise wizard.except_wizard('TyepError', 'You must select only one type For report !')
91
'TyepError', 'You must select only one type for report !')
84
92
if form['active1']:
86
94
if not form['month']:
87
raise wizard.except_wizard('MonthError', 'You must select month For month-wise report !')
96
'MonthError', 'You must select month for month-wise report !')
90
97
elif form['active2']:
92
99
if not form['fromdate'] or not form['todate']:
93
raise wizard.except_wizard('DateError', 'You must select Dates For date-wise report !')
100
raise osv.except_osv(
101
'DateError', 'You must select Dates for date-wise report !')
99
d1[2]=d1[2].split(' ')
100
d2[2]=d2[2].split(' ')
101
a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0]))
102
b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0]))
104
raise wizard.except_wizard('DateError', 'You must select Dates proparly !')
107
d1[2] = d1[2].split(' ')
108
d2[2] = d2[2].split(' ')
109
a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0]))
110
b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0]))
112
raise osv.except_osv(
113
'DateError', 'You must select Dates properly !')
106
raise wizard.except_wizard('typeError', 'You must select Type !')
115
raise osv.except_osv('typeError', 'You must select Type !')
116
return {'year': temp}
110
119
'actions': [year_get],
111
'result': {'type':'form', 'arch':form1, 'fields':field1, 'state' : [('print', 'Ok'),('end', 'Cancel')]}
120
'result': {'type': 'form', 'arch': form1, 'fields': field1, 'state': [('print', 'Ok'), ('end', 'Cancel')]}
114
'actions': [_riase_error],
115
'result': {'type':'print', 'report':'hr.holiday.req.report','state':'end'}
123
'actions': [_raise_error],
124
'result': {'type': 'print', 'report': 'hr.holiday.req.report', 'state': 'end'}
119
127
hr_holidays_report('hr_holiday_req')
120
129
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: