Merge lp:~openerp-community/openerp-hr/6.1-modules-from-other-projects into lp:openerp-hr/6.1
- 6.1-modules-from-other-projects
- Merge into 6.1
Status: | Merged |
---|---|
Merged at revision: | 315 |
Proposed branch: | lp:~openerp-community/openerp-hr/6.1-modules-from-other-projects |
Merge into: | lp:openerp-hr/6.1 |
Diff against target: |
8428 lines (+2563/-3106) 85 files modified
hr_change_password/__init__.py (+5/-8) hr_change_password/__openerp__.py (+9/-9) hr_change_password/wizard/__init__.py (+5/-6) hr_change_password/wizard/change_passwd_wizard.py (+47/-45) hr_contract_available/__init__.py (+6/-8) hr_contract_available/__openerp__.py (+14/-15) hr_contract_available/hr_contract_available.py (+31/-26) hr_contract_timesheet/__init__.py (+6/-9) hr_contract_timesheet/__openerp__.py (+14/-15) hr_contract_timesheet/hr_contract_timesheet.py (+15/-12) hr_expense_line_tax/__init__.py (+5/-5) hr_expense_line_tax/__openerp__.py (+18/-19) hr_expense_line_tax/hr_expense_line_tax.py (+49/-29) hr_holidays_cci/__init__.py (+0/-26) hr_holidays_cci/__terp__.py (+0/-40) hr_holidays_cci/hr.py (+0/-127) hr_holidays_cci/hr_holidays_report.xml (+0/-25) hr_holidays_cci/hr_holidays_wizard.xml (+0/-14) hr_holidays_cci/hr_view.xml (+0/-36) hr_holidays_cci/i18n/fr_BE.po (+0/-35) hr_holidays_cci/i18n/sv.po (+0/-28) hr_holidays_cci/report/__init__.py (+0/-24) hr_holidays_cci/report/holidays_summary.xsl (+0/-232) hr_holidays_cci/report/holidays_summary_report.py (+0/-228) hr_holidays_cci/wizard/__init__.py (+0/-24) hr_holidays_cci/wizard/holidays_summary.py (+0/-101) hr_holidays_evaluation/__init__.py (+6/-6) hr_holidays_evaluation/__openerp__.py (+18/-18) hr_holidays_evaluation/hr_holidays_evaluation.py (+35/-30) hr_holidays_request/__init__.py (+5/-6) hr_holidays_request/__openerp__.py (+14/-15) hr_holidays_request/hr_holidays_request.py (+331/-291) hr_holidays_request/report/__init__.py (+5/-6) hr_holidays_request/report/hr_holiday_report.py (+58/-53) hr_holidays_request/report/hr_holiday_report_form.py (+51/-43) hr_holidays_request/wizard/__init__.py (+6/-7) hr_holidays_request/wizard/hr_holiday.py (+60/-52) hr_holidays_type/__init__.py (+3/-3) hr_holidays_type/__openerp__.py (+11/-13) hr_holidays_type/hr_holidays_type.py (+112/-84) hr_interview/__init__.py (+4/-5) hr_interview/__openerp__.py (+7/-7) hr_interview/hr_interview.py (+178/-166) hr_interview/report/candidate_summary.py (+18/-15) hr_interview/wizard/__init__.py (+5/-5) hr_interview/wizard/wiz_schedule.py (+54/-45) hr_interview/wizard/wizard_send_interview_mail.py (+30/-25) hr_payroll_declare/__init__.py (+5/-6) hr_payroll_declare/__openerp__.py (+4/-4) hr_payroll_declare/hr_payroll_declare.py (+70/-73) hr_performance/__init__.py (+7/-7) hr_performance/__openerp__.py (+15/-10) hr_performance/hr_performance.py (+192/-180) hr_performance/report/__init__.py (+7/-6) hr_performance/report/hr_performance_report.py (+16/-17) hr_planned_leaves/__init__.py (+2/-3) hr_planned_leaves/__openerp__.py (+8/-8) hr_planned_leaves/report/__init__.py (+2/-3) hr_planned_leaves/report/hr_planned_leaves.py (+118/-90) hr_planned_leaves/wizard/__init__.py (+2/-3) hr_planned_leaves/wizard/hr_planned_leaves_wizard.py (+30/-26) hr_security_ext/__init__.py (+24/-0) hr_security_ext/__openerp__.py (+50/-0) hr_security_ext/hr.py (+40/-0) hr_security_ext/hr_view.xml (+19/-0) hr_security_ext/reis_base.py (+149/-0) hr_security_ext/security/hr_security.xml (+30/-0) hr_security_ext/security/ir.model.access.csv (+1/-0) hr_skill/__init__.py (+8/-10) hr_skill/__openerp__.py (+29/-17) hr_skill/hr_skill.py (+89/-95) hr_skill/hrskill.py (+46/-45) hr_skill/report/__init__.py (+7/-9) hr_skill/report/employeereport.py (+41/-33) hr_skill/report/langreport.py (+98/-86) hr_skill/report/skillreport.py (+46/-38) hr_skill/wizard/__init__.py (+0/-25) hr_skill/wizard/datewise.py (+0/-54) hr_skill/wizard/lang_wiz.py (+0/-60) hr_skill/wizard/skill.py (+0/-49) hr_timesheet_ical/__init__.py (+5/-6) hr_timesheet_ical/__openerp__.py (+14/-15) hr_timesheet_ical/wizard/__init__.py (+5/-6) hr_timesheet_ical/wizard/urllib2.py (+71/-27) hr_timesheet_ical/wizard/wizard_ical.py (+78/-54) |
To merge this branch: | bzr merge lp:~openerp-community/openerp-hr/6.1-modules-from-other-projects |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Reis | Approve | ||
Omar (Pexego) | Abstain | ||
Joao Alfredo Gama Batista | code review | Approve | |
Maxime Chambreuil (http://www.savoirfairelinux.com) | code review | Approve | |
Review via email: mp+186935@code.launchpad.net |
Commit message
Description of the change
[IMP] Moved and cleaned up hr_* modules out of lp:openobject-addons/extra-trunk
To post a comment you must log in.
- 312. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[FIX] PEP8
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) : | # |
review:
Approve
(code review)
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) : | # |
review:
Approve
(code review)
- 313. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Replace wizard.interface by osv.osv_memory
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
Hello Omar,
Thanks for your review. I made the requested changes.
Revision history for this message
Daniel Reis (dreis-pt) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'hr_change_password/__init__.py' |
2 | --- hr_change_password/__init__.py 2009-11-04 06:22:37 +0000 |
3 | +++ hr_change_password/__init__.py 2013-12-23 20:13:10 +0000 |
4 | @@ -1,7 +1,7 @@ |
5 | # -*- encoding: utf-8 -*- |
6 | -############################################################################## |
7 | -# |
8 | -# OpenERP, Open Source Management Solution |
9 | +# |
10 | +# |
11 | +# OpenERP, Open Source Management Solution |
12 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
13 | # $Id$ |
14 | # |
15 | @@ -18,9 +18,6 @@ |
16 | # You should have received a copy of the GNU General Public License |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | # |
19 | -############################################################################## |
20 | - |
21 | -import wizard |
22 | - |
23 | +# |
24 | +from . import wizard |
25 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
26 | - |
27 | |
28 | === renamed file 'hr_change_password/__terp__.py' => 'hr_change_password/__openerp__.py' |
29 | --- hr_change_password/__terp__.py 2009-11-04 06:22:37 +0000 |
30 | +++ hr_change_password/__openerp__.py 2013-12-23 20:13:10 +0000 |
31 | @@ -1,7 +1,7 @@ |
32 | # -*- encoding: utf-8 -*- |
33 | -############################################################################## |
34 | -# |
35 | -# OpenERP, Open Source Management Solution |
36 | +# |
37 | +# |
38 | +# OpenERP, Open Source Management Solution |
39 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
40 | # $Id$ |
41 | # |
42 | @@ -18,15 +18,15 @@ |
43 | # You should have received a copy of the GNU General Public License |
44 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
45 | # |
46 | -############################################################################## |
47 | +# |
48 | |
49 | |
50 | { |
51 | - "name" : "Human Resources/Change password", |
52 | - "version" : "1.1", |
53 | - "author" : "Tiny", |
54 | - "category" : "Generic Modules/Human Resources", |
55 | - "website" : "http://www.openerp.com", |
56 | + "name": "Human Resources/Change password", |
57 | + "version": "1.1", |
58 | + "author": "Tiny", |
59 | + "category": "Generic Modules/Human Resources", |
60 | + "website": "http://www.openerp.com", |
61 | "description": """ |
62 | Module for human resource management. You can manage: |
63 | * Change the password of user |
64 | |
65 | === modified file 'hr_change_password/wizard/__init__.py' |
66 | --- hr_change_password/wizard/__init__.py 2009-11-04 06:22:37 +0000 |
67 | +++ hr_change_password/wizard/__init__.py 2013-12-23 20:13:10 +0000 |
68 | @@ -1,8 +1,8 @@ |
69 | #!/usr/bin/env python |
70 | #-*- coding:utf-8 -*- |
71 | -############################################################################## |
72 | -# |
73 | -# OpenERP, Open Source Management Solution |
74 | +# |
75 | +# |
76 | +# OpenERP, Open Source Management Solution |
77 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
78 | # d$ |
79 | # |
80 | @@ -19,6 +19,5 @@ |
81 | # You should have received a copy of the GNU General Public License |
82 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
83 | # |
84 | -############################################################################## |
85 | - |
86 | -import change_passwd_wizard |
87 | +# |
88 | +from . import change_passwd_wizard |
89 | |
90 | === modified file 'hr_change_password/wizard/change_passwd_wizard.py' |
91 | --- hr_change_password/wizard/change_passwd_wizard.py 2009-11-04 06:22:37 +0000 |
92 | +++ hr_change_password/wizard/change_passwd_wizard.py 2013-12-23 20:13:10 +0000 |
93 | @@ -1,7 +1,7 @@ |
94 | # -*- encoding: utf-8 -*- |
95 | -############################################################################## |
96 | -# |
97 | -# OpenERP, Open Source Management Solution |
98 | +# |
99 | +# |
100 | +# OpenERP, Open Source Management Solution |
101 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
102 | # $Id$ |
103 | # |
104 | @@ -18,57 +18,59 @@ |
105 | # You should have received a copy of the GNU General Public License |
106 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
107 | # |
108 | -############################################################################## |
109 | +# |
110 | |
111 | -from osv import osv |
112 | -from osv import fields |
113 | -import wizard |
114 | +from osv import osv, fields |
115 | import pooler |
116 | |
117 | -class change_passwd(wizard.interface): |
118 | - ''' |
119 | - OpenERP Wizard |
120 | - ''' |
121 | - form = '''<?xml version="1.0"?> |
122 | - <form string="Confirm Passwords"> |
123 | - <field name="user" attrs="{'readonly':[('check','!=',1)]}"/> |
124 | - <field name="oldpwd" password="True"/> |
125 | - <field name="newpwd" password="True"/> |
126 | - <field name="confirmpwd" password="True"/> |
127 | - </form>''' |
128 | - |
129 | - fields = { |
130 | - 'user': dict(string=u'User', type='many2one', relation='res.users', required=True), |
131 | + |
132 | +class change_passwd(osv.osv_memory): |
133 | + |
134 | + ''' |
135 | + OpenERP Wizard |
136 | + ''' |
137 | + form = '''<?xml version="1.0"?> |
138 | + <form string="Confirm Passwords"> |
139 | + <field name="user" attrs="{'readonly':[('check','!=',1)]}"/> |
140 | + <field name="oldpwd" password="True"/> |
141 | + <field name="newpwd" password="True"/> |
142 | + <field name="confirmpwd" password="True"/> |
143 | + </form>''' |
144 | + |
145 | + fields = { |
146 | + 'user': dict(string=u'User', type='many2one', relation='res.users', required=True), |
147 | 'oldpwd': {'string': 'Old Password', 'type': 'char'}, |
148 | 'newpwd': {'string': 'New Password', 'type': 'char'}, |
149 | 'confirmpwd': {'string': 'Confirm Password', 'type': 'char'}, |
150 | 'check': dict(string='Check', type='boolean', invisible=True) |
151 | } |
152 | |
153 | - def _get_value(self, cr, uid, data, context): |
154 | - if uid == 1: |
155 | - data['form']['check'] = 1 |
156 | - else: |
157 | - data['form']['check'] = 0 |
158 | - data['form']['user'] = uid |
159 | - return data['form'] |
160 | - |
161 | - |
162 | - def _check_password(self, cr, uid, data, context): |
163 | - if data['form']['newpwd'] == data['form']['confirmpwd']: |
164 | - pool_obj = pooler.get_pool(cr.dbname) |
165 | - obj_change = pool_obj.get('res.users') |
166 | - pwd = obj_change.read(cr, uid, [data['form']['user']],['password']) |
167 | - if data['form']['oldpwd'] == pwd[0]['password']: |
168 | - obj_change.write(cr, uid, [data['form']['user']], {'password':data['form']['newpwd']}) |
169 | - else: |
170 | - raise osv.except_osv(_('Verification Error !'), _('Your Old Password is not verified.')) |
171 | - else: |
172 | - raise osv.except_osv(_('Verification Error !'), _('New Password and Confirm password does not match.')) |
173 | - |
174 | - return {} |
175 | - |
176 | - states = { |
177 | + def _get_value(self, cr, uid, data, context): |
178 | + if uid == 1: |
179 | + data['form']['check'] = 1 |
180 | + else: |
181 | + data['form']['check'] = 0 |
182 | + data['form']['user'] = uid |
183 | + return data['form'] |
184 | + |
185 | + def _check_password(self, cr, uid, data, context): |
186 | + if data['form']['newpwd'] == data['form']['confirmpwd']: |
187 | + pool_obj = pooler.get_pool(cr.dbname) |
188 | + obj_change = pool_obj.get('res.users') |
189 | + pwd = obj_change.read( |
190 | + cr, uid, [data['form']['user']], ['password']) |
191 | + if data['form']['oldpwd'] == pwd[0]['password']: |
192 | + obj_change.write( |
193 | + cr, uid, [data['form']['user']], {'password': data['form']['newpwd']}) |
194 | + else: |
195 | + raise osv.except_osv( |
196 | + _('Verification Error !'), _('Your Old Password is not verified.')) |
197 | + else: |
198 | + raise osv.except_osv(_('Verification Error !'), _( |
199 | + 'New Password and Confirm password do not match.')) |
200 | + return {} |
201 | + |
202 | + states = { |
203 | 'init': { |
204 | 'actions': [_get_value], |
205 | 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('process', 'Change'))}, |
206 | |
207 | === modified file 'hr_contract_available/__init__.py' |
208 | --- hr_contract_available/__init__.py 2009-10-15 11:25:40 +0000 |
209 | +++ hr_contract_available/__init__.py 2013-12-23 20:13:10 +0000 |
210 | @@ -1,6 +1,6 @@ |
211 | # -*- encoding: utf-8 -*- |
212 | -############################################################################## |
213 | -# |
214 | +# |
215 | +# |
216 | # OpenERP, Open Source Management Solution |
217 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
218 | # |
219 | @@ -15,10 +15,8 @@ |
220 | # GNU Affero General Public License for more details. |
221 | # |
222 | # You should have received a copy of the GNU Affero General Public License |
223 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
224 | -# |
225 | -############################################################################## |
226 | - |
227 | -import hr_contract_available |
228 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
229 | +# |
230 | +# |
231 | +from . import hr_contract_available |
232 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
233 | - |
234 | |
235 | === renamed file 'hr_contract_available/__terp__.py' => 'hr_contract_available/__openerp__.py' |
236 | --- hr_contract_available/__terp__.py 2009-11-25 06:35:25 +0000 |
237 | +++ hr_contract_available/__openerp__.py 2013-12-23 20:13:10 +0000 |
238 | @@ -1,6 +1,6 @@ |
239 | # -*- encoding: utf-8 -*- |
240 | -############################################################################## |
241 | -# |
242 | +# |
243 | +# |
244 | # OpenERP, Open Source Management Solution |
245 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
246 | # |
247 | @@ -15,17 +15,17 @@ |
248 | # GNU Affero General Public License for more details. |
249 | # |
250 | # You should have received a copy of the GNU Affero General Public License |
251 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
252 | -# |
253 | -############################################################################## |
254 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
255 | +# |
256 | +# |
257 | |
258 | { |
259 | - "name" : "Human Resources Contracts - Human Ressources Reservations Management", |
260 | - "version" : "0.1", |
261 | - "author" : "Tiny", |
262 | - "category" : "Generic Modules/Human Resources", |
263 | - "website" : "http://www.openerp.com", |
264 | - "depends" : ["hr_contract"], |
265 | + "name": "Human Resources Contracts - Human Ressources Reservations Management", |
266 | + "version": "0.1", |
267 | + "author": "Tiny", |
268 | + "category": "Generic Modules/Human Resources", |
269 | + "website": "http://www.openerp.com", |
270 | + "depends": ["hr_contract"], |
271 | "module": "", |
272 | "description": """ |
273 | This module is a reservation system on employees. |
274 | @@ -34,11 +34,10 @@ |
275 | defined period. This module is used to track availability and |
276 | reservations on human ressources. |
277 | """, |
278 | - "init_xml" : [], |
279 | - "demo_xml" : [], |
280 | - "update_xml" : ["security/ir.model.access.csv","hr_contract_available_view.xml"], |
281 | + "init_xml": [], |
282 | + "demo_xml": [], |
283 | + "update_xml": ["security/ir.model.access.csv", "hr_contract_available_view.xml"], |
284 | "active": False, |
285 | "installable": True |
286 | } |
287 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
288 | - |
289 | |
290 | === modified file 'hr_contract_available/hr_contract_available.py' |
291 | --- hr_contract_available/hr_contract_available.py 2009-10-15 11:25:40 +0000 |
292 | +++ hr_contract_available/hr_contract_available.py 2013-12-23 20:13:10 +0000 |
293 | @@ -1,6 +1,6 @@ |
294 | # -*- encoding: utf-8 -*- |
295 | -############################################################################## |
296 | -# |
297 | +# |
298 | +# |
299 | # OpenERP, Open Source Management Solution |
300 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
301 | # |
302 | @@ -15,15 +15,16 @@ |
303 | # GNU Affero General Public License for more details. |
304 | # |
305 | # You should have received a copy of the GNU Affero General Public License |
306 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
307 | -# |
308 | -############################################################################## |
309 | - |
310 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
311 | +# |
312 | +# |
313 | from osv import fields, osv |
314 | import time |
315 | |
316 | + |
317 | class hr_employee(osv.osv): |
318 | _inherit = "hr.employee" |
319 | + |
320 | def _get_state(self, cr, uid, ids, name, args, context): |
321 | result = {} |
322 | t = time.strftime('%Y-%m-%d') |
323 | @@ -31,56 +32,60 @@ |
324 | result[emp.id] = 'no' |
325 | |
326 | for alloc in emp.allocation_ids: |
327 | - if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t): |
328 | + if ((not alloc.date_end) or (alloc.date_end >= t)) and (alloc.date_start <= t): |
329 | result[emp.id] = alloc.state |
330 | return result |
331 | + |
332 | def _get_date_end(self, cr, uid, ids, name, args, context): |
333 | result = {} |
334 | for emp in self.browse(cr, uid, ids, context): |
335 | result[emp.id] = False |
336 | - if len( emp.allocation_ids): |
337 | + if len(emp.allocation_ids): |
338 | result[emp.id] = emp.allocation_ids[-1].date_end or False |
339 | return result |
340 | + |
341 | def _get_department_id(self, cr, uid, ids, name, args, context): |
342 | result = {} |
343 | t = time.strftime('%Y-%m-%d') |
344 | for emp in self.browse(cr, uid, ids, context): |
345 | result[emp.id] = False |
346 | for alloc in emp.allocation_ids: |
347 | - if ((not alloc.date_end) or (alloc.date_end>=t)) and (alloc.date_start<=t): |
348 | + if ((not alloc.date_end) or (alloc.date_end >= t)) and (alloc.date_start <= t): |
349 | result[emp.id] = alloc.department_id.id |
350 | return result |
351 | + |
352 | _columns = { |
353 | - 'allocation_ids' : fields.one2many('hr.allocation', 'employee_id', 'Allocations'), |
354 | - 'allocation_state': fields.function(_get_state, |
355 | - method=True, |
356 | - type='selection', |
357 | - selection=[('no','/'),('unavailable','Unavailable'),('ondemand','On demand'),('available','Available')], |
358 | - string='Current Availability'), |
359 | + 'allocation_ids': fields.one2many('hr.allocation', 'employee_id', 'Allocations'), |
360 | + 'allocation_state': fields.function(_get_state, method=True, type='selection', |
361 | + selection=[('no', '/'), |
362 | + ('unavailable', 'Unavailable'), |
363 | + ('ondemand', 'On demand'), |
364 | + ('available', 'Available')], |
365 | + string='Current Availability'), |
366 | 'allocation_department_id': fields.function(_get_department_id, method=True, type='many2one', relation='res.company', string='Current Department'), |
367 | 'allocation_date_end': fields.function(_get_date_end, method=True, type='date', string='Availability Date') |
368 | } |
369 | hr_employee() |
370 | |
371 | + |
372 | class hr_allocation(osv.osv): |
373 | _name = 'hr.allocation' |
374 | _description = 'Allocations' |
375 | _columns = { |
376 | - 'name' : fields.char('Allocation Name', size=30, required=True), |
377 | - 'employee_id' : fields.many2one('hr.employee', 'Employee', required=True), |
378 | - 'department_id' : fields.many2one('res.company', 'Department', required=True), |
379 | - 'function' : fields.many2one('res.partner.function', 'Function'), |
380 | - 'date_start' : fields.date('Start Date', required=True), |
381 | - 'date_end' : fields.date('End Date', help="Keep empty for unlimited allocation."), |
382 | - 'state' : fields.selection([('unavailable','Unavailable'),('ondemand','On demand'),('available','Available')], 'State', required=True), |
383 | + 'name': fields.char('Allocation Name', size=30, required=True), |
384 | + 'employee_id': fields.many2one('hr.employee', 'Employee', required=True), |
385 | + 'department_id': fields.many2one('res.company', 'Department', required=True), |
386 | + 'function': fields.many2one('res.partner.function', 'Function'), |
387 | + 'date_start': fields.date('Start Date', required=True), |
388 | + 'date_end': fields.date('End Date', help="Keep empty for unlimited allocation."), |
389 | + 'state': fields.selection([('unavailable', 'Unavailable'), ('ondemand', 'On demand'), ('available', 'Available')], 'State', required=True), |
390 | } |
391 | _order = 'date_start' |
392 | _defaults = { |
393 | - 'date_start' : lambda *a : time.strftime("%Y-%m-%d"), |
394 | - 'state' : lambda *a : 'ondemand', |
395 | - 'department_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id |
396 | + 'date_start': lambda *a: time.strftime("%Y-%m-%d"), |
397 | + 'state': lambda *a: 'ondemand', |
398 | + 'department_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id |
399 | } |
400 | hr_allocation() |
401 | |
402 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
403 | - |
404 | |
405 | === modified file 'hr_contract_timesheet/__init__.py' |
406 | --- hr_contract_timesheet/__init__.py 2009-10-15 11:25:40 +0000 |
407 | +++ hr_contract_timesheet/__init__.py 2013-12-23 20:13:10 +0000 |
408 | @@ -1,6 +1,6 @@ |
409 | # -*- encoding: utf-8 -*- |
410 | -############################################################################## |
411 | -# |
412 | +# |
413 | +# |
414 | # OpenERP, Open Source Management Solution |
415 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
416 | # |
417 | @@ -15,11 +15,8 @@ |
418 | # GNU Affero General Public License for more details. |
419 | # |
420 | # You should have received a copy of the GNU Affero General Public License |
421 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
422 | -# |
423 | -############################################################################## |
424 | - |
425 | - |
426 | -import hr_contract_timesheet |
427 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
428 | +# |
429 | +# |
430 | +from . import hr_contract_timesheet |
431 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
432 | - |
433 | |
434 | === renamed file 'hr_contract_timesheet/__terp__.py' => 'hr_contract_timesheet/__openerp__.py' |
435 | --- hr_contract_timesheet/__terp__.py 2009-10-15 11:25:40 +0000 |
436 | +++ hr_contract_timesheet/__openerp__.py 2013-12-23 20:13:10 +0000 |
437 | @@ -1,6 +1,6 @@ |
438 | # -*- encoding: utf-8 -*- |
439 | -############################################################################## |
440 | -# |
441 | +# |
442 | +# |
443 | # OpenERP, Open Source Management Solution |
444 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
445 | # |
446 | @@ -15,28 +15,27 @@ |
447 | # GNU Affero General Public License for more details. |
448 | # |
449 | # You should have received a copy of the GNU Affero General Public License |
450 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
451 | -# |
452 | -############################################################################## |
453 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
454 | +# |
455 | +# |
456 | |
457 | { |
458 | - "name" : "Human Resources Timesheets on contracts", |
459 | - "version" : "0.1", |
460 | - "author" : "Tiny", |
461 | - "category" : "Generic Modules/Human Resources", |
462 | - "website" : "http://www.openerp.com", |
463 | - "depends" : ["hr_contract","hr_timesheet"], |
464 | + "name": "Human Resources Timesheets on contracts", |
465 | + "version": "0.1", |
466 | + "author": "Tiny", |
467 | + "category": "Generic Modules/Human Resources", |
468 | + "website": "http://www.openerp.com", |
469 | + "depends": ["hr_contract", "hr_timesheet"], |
470 | "module": "", |
471 | "description": """ |
472 | Compute the cost of an employee for his timesheets according |
473 | to his contract definitions. If no contract are defined, it |
474 | uses the product costs linked to the employee. |
475 | """, |
476 | - "init_xml" : [], |
477 | - "demo_xml" : [], |
478 | - "update_xml" : [], |
479 | + "init_xml": [], |
480 | + "demo_xml": [], |
481 | + "update_xml": [], |
482 | "active": False, |
483 | "installable": True |
484 | } |
485 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
486 | - |
487 | |
488 | === modified file 'hr_contract_timesheet/hr_contract_timesheet.py' |
489 | --- hr_contract_timesheet/hr_contract_timesheet.py 2010-10-19 07:17:52 +0000 |
490 | +++ hr_contract_timesheet/hr_contract_timesheet.py 2013-12-23 20:13:10 +0000 |
491 | @@ -1,6 +1,6 @@ |
492 | # -*- encoding: utf-8 -*- |
493 | -############################################################################## |
494 | -# |
495 | +# |
496 | +# |
497 | # OpenERP, Open Source Management Solution |
498 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
499 | # |
500 | @@ -15,26 +15,28 @@ |
501 | # GNU Affero General Public License for more details. |
502 | # |
503 | # You should have received a copy of the GNU Affero General Public License |
504 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
505 | -# |
506 | -############################################################################## |
507 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
508 | +# |
509 | +# |
510 | |
511 | +import time |
512 | from osv import fields, osv |
513 | -import time |
514 | + |
515 | |
516 | class hr_timesheet(osv.osv): |
517 | _name = "hr.analytic.timesheet" |
518 | _inherit = "hr.analytic.timesheet" |
519 | - |
520 | + |
521 | def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, user_id=False, date=False, context={}): |
522 | if not date: |
523 | date = time.strftime('%Y-%m-%d') |
524 | if not user_id: |
525 | user_id = uid |
526 | |
527 | - res = super(hr_timesheet, self).on_change_unit_amount(cr, uid, id, prod_id, unit_amount, unit, context) |
528 | + res = super(hr_timesheet, self).on_change_unit_amount( |
529 | + cr, uid, id, prod_id, unit_amount, unit, context) |
530 | if user_id: |
531 | - sql_req= ''' |
532 | + sql_req = ''' |
533 | SELECT -c.wage * cwt.factor_type / p.factor_days as hourlywage |
534 | FROM hr_contract c |
535 | LEFT JOIN hr_employee emp on (c.employee_id=emp.id) |
536 | @@ -47,13 +49,14 @@ |
537 | LIMIT 1 |
538 | ''' |
539 | |
540 | - cr.execute(sql_req, (user_id,date,date)) |
541 | + cr.execute(sql_req, (user_id, date, date)) |
542 | contract_info = cr.dictfetchone() |
543 | if res and contract_info: |
544 | - res['value']['amount'] = contract_info['hourlywage'] * unit_amount |
545 | + res['value']['amount'] = contract_info[ |
546 | + 'hourlywage'] * unit_amount |
547 | |
548 | return res |
549 | + |
550 | hr_timesheet() |
551 | |
552 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
553 | - |
554 | |
555 | === modified file 'hr_expense_line_tax/__init__.py' |
556 | --- hr_expense_line_tax/__init__.py 2011-02-13 23:55:44 +0000 |
557 | +++ hr_expense_line_tax/__init__.py 2013-12-23 20:13:10 +0000 |
558 | @@ -1,6 +1,6 @@ |
559 | # -*- encoding: utf-8 -*- |
560 | -############################################################################## |
561 | -# |
562 | +# |
563 | +# |
564 | # OpenERP, Open Source Management Solution |
565 | # Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
566 | # |
567 | @@ -15,8 +15,8 @@ |
568 | # GNU General Public License for more details. |
569 | # |
570 | # You should have received a copy of the GNU General Public License |
571 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
572 | -# |
573 | -############################################################################## |
574 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
575 | +# |
576 | +# |
577 | import hr_expense_line_tax |
578 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
579 | |
580 | === modified file 'hr_expense_line_tax/__openerp__.py' |
581 | --- hr_expense_line_tax/__openerp__.py 2011-02-13 23:55:44 +0000 |
582 | +++ hr_expense_line_tax/__openerp__.py 2013-12-23 20:13:10 +0000 |
583 | @@ -1,6 +1,6 @@ |
584 | # -*- encoding: utf-8 -*- |
585 | -############################################################################## |
586 | -# |
587 | +# |
588 | +# |
589 | # OpenERP, Open Source Management Solution |
590 | # Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
591 | # |
592 | @@ -15,28 +15,27 @@ |
593 | # GNU General Public License for more details. |
594 | # |
595 | # You should have received a copy of the GNU General Public License |
596 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
597 | -# |
598 | -############################################################################## |
599 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
600 | +# |
601 | +# |
602 | { |
603 | - "name" : "Tax on expense line", |
604 | - "version" : "1.0", |
605 | - "author" : "Savoir-faire Linux", |
606 | - "website" : "http://www.savoirfairelinux.com", |
607 | - "category" : "Human Resources", |
608 | + "name": "Tax on expense line", |
609 | + "version": "1.0", |
610 | + "author": "Savoir-faire Linux", |
611 | + "website": "http://www.savoirfairelinux.com", |
612 | + "category": "Human Resources", |
613 | "description": """ |
614 | This module adds a tax field on the expense line and set the taxes of |
615 | - the employee invoice based on this tax, discarding the ones set on the |
616 | + the employee invoice based on this tax, discarding the ones set on the |
617 | product. |
618 | """, |
619 | - "depends" : ['hr_expense'], |
620 | - "init_xml" : [], |
621 | - "update_xml" : [ |
622 | - 'hr_expense.xml', |
623 | + "depends": ['hr_expense'], |
624 | + "init_xml": [], |
625 | + "update_xml": [ |
626 | + 'hr_expense.xml', |
627 | ], |
628 | - "demo_xml" : [], |
629 | - "installable" : True, |
630 | - "certificate" : '' |
631 | + "demo_xml": [], |
632 | + "installable": True, |
633 | + "certificate": '' |
634 | } |
635 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
636 | - |
637 | |
638 | === modified file 'hr_expense_line_tax/hr_expense_line_tax.py' |
639 | --- hr_expense_line_tax/hr_expense_line_tax.py 2011-03-04 05:19:21 +0000 |
640 | +++ hr_expense_line_tax/hr_expense_line_tax.py 2013-12-23 20:13:10 +0000 |
641 | @@ -1,6 +1,6 @@ |
642 | # -*- encoding: utf-8 -*- |
643 | -############################################################################## |
644 | -# |
645 | +# |
646 | +# |
647 | # OpenERP, Open Source Management Solution |
648 | # Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
649 | # |
650 | @@ -15,43 +15,52 @@ |
651 | # GNU General Public License for more details. |
652 | # |
653 | # You should have received a copy of the GNU General Public License |
654 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
655 | -# |
656 | -############################################################################## |
657 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
658 | +# |
659 | +# |
660 | |
661 | import netsvc |
662 | logger = netsvc.Logger() |
663 | from osv import osv, fields |
664 | from tools.translate import _ |
665 | |
666 | + |
667 | class hr_expense_line(osv.osv): |
668 | _inherit = 'hr.expense.line' |
669 | _columns = { |
670 | - 'tax_id': fields.many2one('account.tax', 'Tax', domain=[('type_tax_use','=','purchase')]), |
671 | + 'tax_id': fields.many2one('account.tax', 'Tax', domain=[('type_tax_use', '=', 'purchase')]), |
672 | } |
673 | - |
674 | + |
675 | def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, tax_id, context=None): |
676 | res = {} |
677 | - logger.notifyChannel("",netsvc.LOG_INFO,"This is new OnChange") |
678 | + logger.notifyChannel("", netsvc.LOG_INFO, "This is new OnChange") |
679 | if product_id: |
680 | - product = self.pool.get('product.product').browse(cr, uid, product_id, context=context) |
681 | + product = self.pool.get('product.product').browse( |
682 | + cr, uid, product_id, context=context) |
683 | res['name'] = product.name |
684 | - amount_unit = product.price_get('standard_price', context=context)[product.id] |
685 | + amount_unit = product.price_get( |
686 | + 'standard_price', context=context)[product.id] |
687 | res['unit_amount'] = amount_unit |
688 | if not uom_id: |
689 | res['uom_id'] = product.uom_id.id |
690 | - logger.notifyChannel("",netsvc.LOG_INFO,"tax_id = " + str(tax_id)) |
691 | + logger.notifyChannel( |
692 | + "", netsvc.LOG_INFO, "tax_id = " + str(tax_id)) |
693 | if not tax_id: |
694 | - logger.notifyChannel("",netsvc.LOG_INFO,"tax_id = " + str(tax_id)) |
695 | + logger.notifyChannel( |
696 | + "", netsvc.LOG_INFO, "tax_id = " + str(tax_id)) |
697 | if product.supplier_taxes_id: |
698 | - logger.notifyChannel("",netsvc.LOG_INFO,"product_name = " + product.name) |
699 | - logger.notifyChannel("",netsvc.LOG_INFO,"product_id = " + product.name) |
700 | - logger.notifyChannel("",netsvc.LOG_INFO,"supplier_taxes = " + str(len(product.supplier_taxes_id))) |
701 | + logger.notifyChannel( |
702 | + "", netsvc.LOG_INFO, "product_name = " + product.name) |
703 | + logger.notifyChannel( |
704 | + "", netsvc.LOG_INFO, "product_id = " + product.name) |
705 | + logger.notifyChannel( |
706 | + "", netsvc.LOG_INFO, "supplier_taxes = " + str(len(product.supplier_taxes_id))) |
707 | res['tax_id'] = product.supplier_taxes_id[0].id |
708 | return {'value': res} |
709 | |
710 | hr_expense_line() |
711 | |
712 | + |
713 | class hr_expense_expense(osv.osv): |
714 | _inherit = 'hr.expense.expense' |
715 | |
716 | @@ -67,17 +76,19 @@ |
717 | for l in exp.line_ids: |
718 | tax_id = [] |
719 | if l.tax_id: |
720 | - tax_id = [l.tax_id.id] |
721 | + tax_id = [l.tax_id.id] |
722 | if l.product_id: |
723 | if not tax_id: |
724 | - tax_id=[x.id for x in l.product_id.supplier_taxes_id] |
725 | + tax_id = [x.id for x in l.product_id.supplier_taxes_id] |
726 | acc = l.product_id.product_tmpl_id.property_account_expense |
727 | if not acc: |
728 | acc = l.product_id.categ_id.property_account_expense_categ |
729 | else: |
730 | - acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') |
731 | + acc = property_obj.get( |
732 | + cr, uid, 'property_account_expense_categ', 'product.category') |
733 | if not acc: |
734 | - raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`')) |
735 | + raise osv.except_osv( |
736 | + _('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`')) |
737 | |
738 | lines.append((0, False, { |
739 | 'name': l.name, |
740 | @@ -90,9 +101,11 @@ |
741 | 'account_analytic_id': l.analytic_account.id, |
742 | })) |
743 | if not exp.employee_id.address_home_id: |
744 | - raise osv.except_osv(_('Error !'), _('The employee must have a Home address.')) |
745 | + raise osv.except_osv( |
746 | + _('Error !'), _('The employee must have a Home address.')) |
747 | if not exp.employee_id.address_home_id.partner_id: |
748 | - raise osv.except_osv(_('Error !'), _("The employee's home address must have a partner linked.")) |
749 | + raise osv.except_osv( |
750 | + _('Error !'), _("The employee's home address must have a partner linked.")) |
751 | acc = exp.employee_id.address_home_id.partner_id.property_account_payable.id |
752 | payment_term_id = exp.employee_id.address_home_id.partner_id.property_payment_term.id |
753 | inv = { |
754 | @@ -110,28 +123,35 @@ |
755 | 'fiscal_position': exp.employee_id.address_home_id.partner_id.property_account_position.id |
756 | } |
757 | if payment_term_id: |
758 | - to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], payment_term_id, None) |
759 | + to_update = invoice_obj.onchange_payment_term_date_invoice( |
760 | + cr, uid, [], payment_term_id, None) |
761 | if to_update: |
762 | inv.update(to_update['value']) |
763 | journal = False |
764 | if exp.journal_id: |
765 | - inv['journal_id']=exp.journal_id.id |
766 | + inv['journal_id'] = exp.journal_id.id |
767 | journal = exp.journal_id |
768 | else: |
769 | - journal_id = invoice_obj._get_journal(cr, uid, context={'type': 'in_invoice'}) |
770 | + journal_id = invoice_obj._get_journal( |
771 | + cr, uid, context={'type': 'in_invoice'}) |
772 | if journal_id: |
773 | inv['journal_id'] = journal_id |
774 | journal = account_journal.browse(cr, uid, journal_id) |
775 | if journal and not journal.analytic_journal_id: |
776 | - analytic_journal_ids = analytic_journal_obj.search(cr, uid, [('type','=','purchase')]) |
777 | + analytic_journal_ids = analytic_journal_obj.search( |
778 | + cr, uid, [('type', '=', 'purchase')]) |
779 | if analytic_journal_ids: |
780 | - account_journal.write(cr, uid, [journal.id],{'analytic_journal_id':analytic_journal_ids[0]}) |
781 | + account_journal.write(cr, uid, [journal.id], { |
782 | + 'analytic_journal_id': analytic_journal_ids[0]}) |
783 | inv_id = invoice_obj.create(cr, uid, inv, {'type': 'in_invoice'}) |
784 | - invoice_obj.button_compute(cr, uid, [inv_id], {'type': 'in_invoice'}, set_total=True) |
785 | + invoice_obj.button_compute( |
786 | + cr, uid, [inv_id], {'type': 'in_invoice'}, set_total=True) |
787 | wf_service = netsvc.LocalService("workflow") |
788 | - wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr) |
789 | + wf_service.trg_validate( |
790 | + uid, 'account.invoice', inv_id, 'invoice_open', cr) |
791 | |
792 | - self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'}) |
793 | + self.write(cr, uid, [exp.id], { |
794 | + 'invoice_id': inv_id, 'state': 'invoiced'}) |
795 | res = inv_id |
796 | return res |
797 | |
798 | |
799 | === removed directory 'hr_holidays_cci' |
800 | === removed file 'hr_holidays_cci/__init__.py' |
801 | --- hr_holidays_cci/__init__.py 2009-10-15 11:25:40 +0000 |
802 | +++ hr_holidays_cci/__init__.py 1970-01-01 00:00:00 +0000 |
803 | @@ -1,26 +0,0 @@ |
804 | -# -*- encoding: utf-8 -*- |
805 | -############################################################################## |
806 | -# |
807 | -# OpenERP, Open Source Management Solution |
808 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
809 | -# |
810 | -# This program is free software: you can redistribute it and/or modify |
811 | -# it under the terms of the GNU Affero General Public License as |
812 | -# published by the Free Software Foundation, either version 3 of the |
813 | -# License, or (at your option) any later version. |
814 | -# |
815 | -# This program is distributed in the hope that it will be useful, |
816 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
817 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
818 | -# GNU Affero General Public License for more details. |
819 | -# |
820 | -# You should have received a copy of the GNU Affero General Public License |
821 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
822 | -# |
823 | -############################################################################## |
824 | - |
825 | -import hr |
826 | -import wizard |
827 | -import report |
828 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
829 | - |
830 | |
831 | === removed file 'hr_holidays_cci/__terp__.py' |
832 | --- hr_holidays_cci/__terp__.py 2010-05-05 13:41:27 +0000 |
833 | +++ hr_holidays_cci/__terp__.py 1970-01-01 00:00:00 +0000 |
834 | @@ -1,40 +0,0 @@ |
835 | -# -*- encoding: utf-8 -*- |
836 | -############################################################################## |
837 | -# |
838 | -# OpenERP, Open Source Management Solution |
839 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
840 | -# |
841 | -# This program is free software: you can redistribute it and/or modify |
842 | -# it under the terms of the GNU Affero General Public License as |
843 | -# published by the Free Software Foundation, either version 3 of the |
844 | -# License, or (at your option) any later version. |
845 | -# |
846 | -# This program is distributed in the hope that it will be useful, |
847 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
848 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
849 | -# GNU Affero General Public License for more details. |
850 | -# |
851 | -# You should have received a copy of the GNU Affero General Public License |
852 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
853 | -# |
854 | -############################################################################## |
855 | - |
856 | -{ |
857 | - "name" : "Human Resources: Holidays management", |
858 | - "version" : "0.1", |
859 | - "author" : "Tiny", |
860 | - "category" : "Generic Modules/Human Resources", |
861 | - "website" : "http://www.openerp.com/", |
862 | - "description": """Human Ressources: Holidays summary printing functionality |
863 | - |
864 | - |
865 | -NOTICE: This Module is Deprecated. Please install hr_holidays in order to have latest functionalities.""", |
866 | - "depends" : ["hr_holidays",], |
867 | - "init_xml" : [], |
868 | - "demo_xml" : [], |
869 | - "update_xml" : ["hr_view.xml","hr_holidays_report.xml","hr_holidays_wizard.xml",], |
870 | - "active": False, |
871 | - "installable": False |
872 | -} |
873 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
874 | - |
875 | |
876 | === removed file 'hr_holidays_cci/hr.py' |
877 | --- hr_holidays_cci/hr.py 2008-07-23 14:24:53 +0000 |
878 | +++ hr_holidays_cci/hr.py 1970-01-01 00:00:00 +0000 |
879 | @@ -1,127 +0,0 @@ |
880 | -# -*- encoding: utf-8 -*- |
881 | -################################################################################## |
882 | -# |
883 | -# Copyright (c) 2005-2006 Axelor SARL. (http://www.axelor.com) All Rights Reserved. |
884 | -# |
885 | -# $Id: hr.py 4656 2006-11-24 09:58:42Z Cyp $ |
886 | -# |
887 | -# WARNING: This program as such is intended to be used by professional |
888 | -# programmers who take the whole responsability of assessing all potential |
889 | -# consequences resulting from its eventual inadequacies and bugs |
890 | -# End users who are looking for a ready-to-use solution with commercial |
891 | -# garantees and support are strongly adviced to contract a Free Software |
892 | -# Service Company |
893 | -# |
894 | -# This program is Free Software; you can redistribute it and/or |
895 | -# modify it under the terms of the GNU General Public License |
896 | -# as published by the Free Software Foundation; either version 2 |
897 | -# of the License, or (at your option) any later version. |
898 | -# |
899 | -# This program is distributed in the hope that it will be useful, |
900 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
901 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
902 | -# GNU General Public License for more details. |
903 | -# |
904 | -# You should have received a copy of the GNU General Public License |
905 | -# along with this program; if not, write to the Free Software |
906 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
907 | -# |
908 | -############################################################################## |
909 | - |
910 | -from mx import DateTime |
911 | -import time |
912 | -import pooler |
913 | -import netsvc |
914 | -from osv import fields, osv |
915 | - |
916 | -def _employee_get(obj,cr,uid,context={}): |
917 | - ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
918 | - if ids: |
919 | - return ids[0] |
920 | - return False |
921 | - |
922 | -class hr_holidays(osv.osv): |
923 | - _name = "hr.holidays" |
924 | - _inherit = 'hr.holidays' |
925 | - _description = "Holidays" |
926 | - _columns = { |
927 | - 'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}), |
928 | - 'state': fields.selection([('draft', 'draft'), ('confirm', 'Confirmed'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
929 | - 'date_from' : fields.datetime('Vacation start day', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
930 | - 'date_to' : fields.datetime('Vacation end day', readonly=True, states={'draft':[('readonly',False)]}), |
931 | - 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status", readonly=True, states={'draft':[('readonly',False)]}), |
932 | - 'employee_id' : fields.many2one('hr.employee', 'Employee', select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}), |
933 | - 'user_id':fields.many2one('res.users', 'Employee_id', states={'draft':[('readonly',False)]}, relate=True, select=True, readonly=True), |
934 | - 'manager_id' : fields.many2one('hr.employee', 'Holiday manager', invisible=False, readonly=True), |
935 | - 'notes' : fields.text('Notes'), |
936 | - } |
937 | - _defaults = { |
938 | - 'employee_id' : _employee_get , |
939 | - 'state' : lambda *a: 'draft', |
940 | - 'user_id': lambda obj, cr, uid, context: uid |
941 | - } |
942 | - _order = 'date_from desc' |
943 | - def set_to_draft(self, cr, uid, ids, *args): |
944 | - #for exp in self.browse(cr, uid, ids): |
945 | - self.write(cr, uid, ids, { |
946 | - 'state':'draft' |
947 | - }) |
948 | - wf_service = netsvc.LocalService("workflow") |
949 | - wf_service.trg_create(uid, 'hr.holidays', ids[0], cr) |
950 | - return True |
951 | - |
952 | - def holidays_validate(self, cr, uid, ids, *args): |
953 | - #for exp in self.browse(cr, uid, ids): |
954 | - ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
955 | - self.write(cr, uid, ids, { |
956 | - 'state':'validate', |
957 | - 'manager_id':ids2[0] |
958 | - }) |
959 | - return True |
960 | - |
961 | - def holidays_confirm(self, cr, uid, ids, *args): |
962 | - #for exp in self.browse(cr, uid, ids): |
963 | - self.write(cr, uid, ids, { |
964 | - 'state':'confirm' |
965 | - }) |
966 | - return True |
967 | - |
968 | - def holidays_refuse(self, cr, uid, ids, *args): |
969 | - #for exp in self.browse(cr, uid, ids): |
970 | - ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
971 | - self.write(cr, uid, ids, { |
972 | - 'state':'refuse', |
973 | - 'manager_id':ids2[0] |
974 | - }) |
975 | - return True |
976 | - |
977 | - def holidays_cancel(self, cr, uid, ids, *args): |
978 | - #for exp in self.browse(cr, uid, ids): |
979 | - self.write(cr, uid, ids, { |
980 | - 'state':'cancel' |
981 | - }) |
982 | - return True |
983 | - |
984 | - def holidays_draft(self, cr, uid, ids, *args): |
985 | - #for exp in self.browse(cr, uid, ids): |
986 | - self.write(cr, uid, ids, { |
987 | - 'state':'draft' |
988 | - }) |
989 | - return True |
990 | - |
991 | -hr_holidays() |
992 | - |
993 | -class hr_holidays_status(osv.osv): |
994 | - _name = "hr.holidays.status" |
995 | - _inherit = 'hr.holidays.status' |
996 | - _description = "Holidays Status" |
997 | - _columns = { |
998 | - 'color_name' : fields.selection([('red', 'Red'), ('green', 'Green'), ('blue','Blue'), ('yellow', 'Yellow'), ('magenta', 'Magenta'),('cyan', 'Cyan'),('black', 'Black'),('pink', 'Pink'),('brown', 'Brown'),('indigo', 'Indigo'),('lightcoral', 'Light Coral'),('lightsteelblue', 'Light Steel Blue')],'Color of the status', required=True), |
999 | - } |
1000 | - _defaults = { |
1001 | - 'color_name': lambda *args: 'red', |
1002 | - } |
1003 | -hr_holidays_status() |
1004 | - |
1005 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1006 | - |
1007 | |
1008 | === removed file 'hr_holidays_cci/hr_holidays_report.xml' |
1009 | --- hr_holidays_cci/hr_holidays_report.xml 2008-09-12 22:59:35 +0000 |
1010 | +++ hr_holidays_cci/hr_holidays_report.xml 1970-01-01 00:00:00 +0000 |
1011 | @@ -1,25 +0,0 @@ |
1012 | -<?xml version="1.0"?> |
1013 | -<openerp> |
1014 | - <data> |
1015 | - <report id="report_holidays_summary" |
1016 | - string="Summary Of Holidays" |
1017 | - model="hr.holidays" |
1018 | - name="hr.holidays.holidays_summary" |
1019 | - xsl="hr_holidays_cci/report/holidays_summary.xsl" |
1020 | - auto="False" |
1021 | - menu="False"/> |
1022 | - |
1023 | - <!--<wizard id="wizard_hr_holidays_summary" |
1024 | - string="Summary Of Holidays" |
1025 | - model="hr.holidays" |
1026 | - name="hr.holidays.holidays_summary" |
1027 | - menu="False"/> |
1028 | - |
1029 | - <menuitem |
1030 | - name="Human Resources/Holidays Request/Print Summary Of Holidays" |
1031 | - action="wizard_hr_holidays_summary" |
1032 | - type="wizard" |
1033 | - id="menu_wizard_hr_holidays_summary"/>--> |
1034 | - |
1035 | - </data> |
1036 | -</openerp> |
1037 | |
1038 | === removed file 'hr_holidays_cci/hr_holidays_wizard.xml' |
1039 | --- hr_holidays_cci/hr_holidays_wizard.xml 2008-09-12 22:59:35 +0000 |
1040 | +++ hr_holidays_cci/hr_holidays_wizard.xml 1970-01-01 00:00:00 +0000 |
1041 | @@ -1,14 +0,0 @@ |
1042 | -<?xml version="1.0" ?> |
1043 | -<openerp> |
1044 | - <data> |
1045 | - <wizard string="Print Summary of Holidays" |
1046 | - model="hr.holidays" |
1047 | - name="hr.holidays.summary" |
1048 | - id="holidays_summary"/> |
1049 | - |
1050 | - <menuitem name="Print Summary of Holidays" parent="hr.menu_hr_reporting" |
1051 | - action="holidays_summary" |
1052 | - type="wizard" |
1053 | - id="menu_holidays_summary"/> |
1054 | - </data> |
1055 | -</openerp> |
1056 | |
1057 | === removed file 'hr_holidays_cci/hr_view.xml' |
1058 | --- hr_holidays_cci/hr_view.xml 2008-09-12 22:59:35 +0000 |
1059 | +++ hr_holidays_cci/hr_view.xml 1970-01-01 00:00:00 +0000 |
1060 | @@ -1,36 +0,0 @@ |
1061 | -<?xml version="1.0" ?> |
1062 | -<openerp> |
1063 | - <data> |
1064 | - <record model="ir.ui.view" id="edit_holiday_status1"> |
1065 | - <field name="name">hr.holidays.status.form</field> |
1066 | - <field name="model">hr.holidays.status</field> |
1067 | - <field name="inherit_id" ref="hr.edit_holiday_status"/> |
1068 | - <field name="type">form</field> |
1069 | - <field name="arch" type="xml"> |
1070 | - <form string="Define holiday status"> |
1071 | - <field name="color_name" colspan="3" /> |
1072 | - <label string="Make sure that no colors are repeated." colspan="1" /> |
1073 | - </form> |
1074 | - </field> |
1075 | - </record> |
1076 | - <record model="ir.ui.view" id="view_holiday_status1"> |
1077 | - <field name="name">hr.holidays.status.tree</field> |
1078 | - <field name="model">hr.holidays.status</field> |
1079 | - <field name="type">tree</field> |
1080 | - <field name="arch" type="xml"> |
1081 | - <tree string="Holiday status"> |
1082 | - <field name="name"/> |
1083 | - <field name="color_name" /> |
1084 | - </tree> |
1085 | - </field> |
1086 | - </record> |
1087 | - <record model="ir.actions.act_window" id="open_view_holiday_status1"> |
1088 | - <field name="type">ir.actions.act_window</field> |
1089 | - <field name="res_model">hr.holidays.status</field> |
1090 | - <field name="view_type">form</field> |
1091 | - <field name="view_mode">tree,form</field> |
1092 | - <field name="view_id" ref="view_holiday_status1" /> |
1093 | - </record> |
1094 | - <menuitem name="Holiday Status" parent="hr.menu_hr_configuration" id="menu_open_view_holiday_status1" action="open_view_holiday_status1" groups="base.group_admin"/> |
1095 | - </data> |
1096 | -</openerp> |
1097 | |
1098 | === removed directory 'hr_holidays_cci/i18n' |
1099 | === removed file 'hr_holidays_cci/i18n/fr_BE.po' |
1100 | --- hr_holidays_cci/i18n/fr_BE.po 2009-12-10 11:23:25 +0000 |
1101 | +++ hr_holidays_cci/i18n/fr_BE.po 1970-01-01 00:00:00 +0000 |
1102 | @@ -1,35 +0,0 @@ |
1103 | -# Translation of OpenERP Server. |
1104 | -# This file contains the translation of the following modules: |
1105 | -# * hr_holidays_cci |
1106 | -# |
1107 | -msgid "" |
1108 | -msgstr "" |
1109 | -"Project-Id-Version: OpenERP Server 5.0.6\n" |
1110 | -"Report-Msgid-Bugs-To: support@openerp.com\n" |
1111 | -"POT-Creation-Date: 2009-12-10 11:00:31+0000\n" |
1112 | -"PO-Revision-Date: 2009-12-10 11:00:31+0000\n" |
1113 | -"Last-Translator: <>\n" |
1114 | -"Language-Team: \n" |
1115 | -"MIME-Version: 1.0\n" |
1116 | -"Content-Type: text/plain; charset=UTF-8\n" |
1117 | -"Content-Transfer-Encoding: \n" |
1118 | -"Plural-Forms: \n" |
1119 | - |
1120 | -#. module: hr_holidays_cci |
1121 | -#: model:ir.module.module,description:hr_holidays_cci.module_meta_information |
1122 | -msgid "Human Ressources: Holidays summary printing functionality \n" |
1123 | -"\n" |
1124 | -"\n" |
1125 | -"NOTICE: This Module is Deprecated. Please install hr_holidays in order to have latest functionalities." |
1126 | -msgstr "" |
1127 | - |
1128 | -#. module: hr_holidays_cci |
1129 | -#: model:ir.module.module,shortdesc:hr_holidays_cci.module_meta_information |
1130 | -msgid "Human Resources: Holidays management" |
1131 | -msgstr "" |
1132 | - |
1133 | -#. module: hr_holidays_cci |
1134 | -#: field:hr.holidays,holiday_status:0 |
1135 | -msgid "Holiday's Status" |
1136 | -msgstr "" |
1137 | - |
1138 | |
1139 | === removed file 'hr_holidays_cci/i18n/sv.po' |
1140 | --- hr_holidays_cci/i18n/sv.po 2010-11-22 16:27:37 +0000 |
1141 | +++ hr_holidays_cci/i18n/sv.po 1970-01-01 00:00:00 +0000 |
1142 | @@ -1,28 +0,0 @@ |
1143 | -# Translation of OpenERP Server. |
1144 | -# This file contains the translation of the following modules: |
1145 | -# * hr_holidays_cci |
1146 | -# |
1147 | -msgid "" |
1148 | -msgstr "" |
1149 | -"Project-Id-Version: OpenERP Server 5.0.14\n" |
1150 | -"Report-Msgid-Bugs-To: support@openerp.com\n" |
1151 | -"POT-Creation-Date: 2010-11-22 10:19:32+0000\n" |
1152 | -"PO-Revision-Date: 2010-11-22 10:19:32+0000\n" |
1153 | -"Last-Translator: <>\n" |
1154 | -"Language-Team: \n" |
1155 | -"MIME-Version: 1.0\n" |
1156 | -"Content-Type: text/plain; charset=UTF-8\n" |
1157 | -"Content-Transfer-Encoding: \n" |
1158 | -"Plural-Forms: \n" |
1159 | - |
1160 | -#. module: hr_holidays_cci |
1161 | -#: model:ir.module.module,description:hr_holidays_cci.module_meta_information |
1162 | -msgid "Human Ressources: Holidays summary printing functionality \n" |
1163 | -"\n" |
1164 | -"\n" |
1165 | -"NOTICE: This Module is Deprecated. Please install hr_holidays in order to have latest functionalities." |
1166 | -msgstr "Human Ressources: Holidays summary printing functionality \n" |
1167 | -"\n" |
1168 | -"\n" |
1169 | -"NOTICE: This Module is Deprecated. Please install hr_holidays in order to have latest functionalities." |
1170 | - |
1171 | |
1172 | === removed directory 'hr_holidays_cci/report' |
1173 | === removed file 'hr_holidays_cci/report/__init__.py' |
1174 | --- hr_holidays_cci/report/__init__.py 2009-10-15 11:25:40 +0000 |
1175 | +++ hr_holidays_cci/report/__init__.py 1970-01-01 00:00:00 +0000 |
1176 | @@ -1,24 +0,0 @@ |
1177 | -# -*- encoding: utf-8 -*- |
1178 | -############################################################################## |
1179 | -# |
1180 | -# OpenERP, Open Source Management Solution |
1181 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1182 | -# |
1183 | -# This program is free software: you can redistribute it and/or modify |
1184 | -# it under the terms of the GNU Affero General Public License as |
1185 | -# published by the Free Software Foundation, either version 3 of the |
1186 | -# License, or (at your option) any later version. |
1187 | -# |
1188 | -# This program is distributed in the hope that it will be useful, |
1189 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1190 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1191 | -# GNU Affero General Public License for more details. |
1192 | -# |
1193 | -# You should have received a copy of the GNU Affero General Public License |
1194 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1195 | -# |
1196 | -############################################################################## |
1197 | - |
1198 | -import holidays_summary_report |
1199 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1200 | - |
1201 | |
1202 | === removed file 'hr_holidays_cci/report/holidays_summary.xsl' |
1203 | --- hr_holidays_cci/report/holidays_summary.xsl 2008-01-04 08:52:07 +0000 |
1204 | +++ hr_holidays_cci/report/holidays_summary.xsl 1970-01-01 00:00:00 +0000 |
1205 | @@ -1,232 +0,0 @@ |
1206 | -<?xml version="1.0" encoding="utf-8"?> |
1207 | -<xsl:stylesheet version="1.0" |
1208 | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
1209 | - xmlns:fo="http://www.w3.org/1999/XSL/Format"> |
1210 | - |
1211 | - <xsl:template match="/"> |
1212 | - <xsl:call-template name="rml" /> |
1213 | - </xsl:template> |
1214 | - |
1215 | - <xsl:template name="rml"> |
1216 | - <document filename="example.pdf"> |
1217 | - <template pageSize="74.7cm,30cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20"> |
1218 | - <pageTemplate id="first"> |
1219 | - <frame id="col1" x1="2.0cm" y1="2.5cm" width="70.7cm" height="25cm"/> |
1220 | - </pageTemplate> |
1221 | - </template> |
1222 | - |
1223 | - <stylesheet> |
1224 | - <paraStyle name="normal" fontName="Helvetica" fontSize="8" alignment="left" /> |
1225 | - <paraStyle name="normal-title" fontName="Helvetica" fontSize="6" /> |
1226 | - <paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" /> |
1227 | - <paraStyle name="dept" fontName="Helvetica-Bold" fontSize="11" alignment="left" /> |
1228 | - <paraStyle name="employee" fontName="Helvetica-Bold" fontSize="10" textColor="black" /> |
1229 | - <paraStyle name="glande" textColor="red" /> |
1230 | - <paraStyle name="normal_people" textColor="green" /> |
1231 | - <paraStyle name="esclave" textColor="blue" /> |
1232 | - <blockTableStyle id="products"> |
1233 | - <blockAlignment value="CENTER" start="1,0" stop="-1,-1"/> |
1234 | - <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" /> |
1235 | - <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/> |
1236 | - <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/> |
1237 | - <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/> |
1238 | - <blockFont name="Helvetica-Bold" size="10" start="0,-1" stop="-1,-1"/> |
1239 | - <blockValign value="TOP"/> |
1240 | - </blockTableStyle> |
1241 | - <blockTableStyle id="legend"> |
1242 | - <blockAlignment value="LEFT" start="1,0" stop="-1,-1" /> |
1243 | - <blockFont name="Helvetica" size="8" start="0,-1" stop="-1,-1"/> |
1244 | - <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" /> |
1245 | - <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/> |
1246 | - <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/> |
1247 | - <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/> |
1248 | - <blockBackground colorName="#FFFFFF" start="0,0" stop="-1,-1"/> |
1249 | - <xsl:for-each select="/report/legend"> |
1250 | - <blockBackground> |
1251 | - <xsl:attribute name="colorName"> |
1252 | - <xsl:value-of select="attribute::color" /> |
1253 | - </xsl:attribute> |
1254 | - <xsl:attribute name="start"> |
1255 | - <xsl:text>0,</xsl:text> |
1256 | - <xsl:value-of select="attribute::row" /> |
1257 | - </xsl:attribute> |
1258 | - <xsl:attribute name="stop"> |
1259 | - <xsl:text>0,</xsl:text> |
1260 | - <xsl:value-of select="attribute::row" /> |
1261 | - </xsl:attribute> |
1262 | - </blockBackground> |
1263 | - </xsl:for-each> |
1264 | - <blockValign value="TOP"/> |
1265 | - </blockTableStyle> |
1266 | - <blockTableStyle id="month"> |
1267 | - <blockAlignment value="CENTER" start="1,0" stop="-1,-1" /> |
1268 | - <blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/> |
1269 | - <blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/> |
1270 | - <blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/> |
1271 | - <blockBackground colorName="#FFFFFF" start="1,0" stop="-2,1"/> |
1272 | - <xsl:for-each select="/report/days/dayy[@name='Sat' or @name='Sun']"> |
1273 | - <xsl:variable name="col" select="attribute::cell" /> |
1274 | - <blockBackground> |
1275 | - <xsl:attribute name="colorName">lightgrey</xsl:attribute> |
1276 | - <xsl:attribute name="start"> |
1277 | - <xsl:value-of select="$col" /> |
1278 | - <xsl:text>,0</xsl:text> |
1279 | - </xsl:attribute> |
1280 | - <xsl:attribute name="stop"> |
1281 | - <xsl:value-of select="$col" /> |
1282 | - <xsl:text>,-1</xsl:text> |
1283 | - </xsl:attribute> |
1284 | - </blockBackground> |
1285 | - </xsl:for-each> |
1286 | - <xsl:for-each select="/report/info"> |
1287 | - <xsl:variable name="val" select="attribute::val" /> |
1288 | - <xsl:variable name="col" select="attribute::number" /> |
1289 | - <xsl:variable name="row" select="attribute::id" /> |
1290 | - <xsl:for-each select="/report/legend"> |
1291 | - <xsl:variable name="val_id" select="attribute::id" /> |
1292 | - <xsl:variable name="color" select="attribute::color" /> |
1293 | - <xsl:if test="$val_id = $val "> |
1294 | - <blockBackground> |
1295 | - <xsl:attribute name="colorName"><xsl:value-of select="$color" /></xsl:attribute> |
1296 | - <xsl:attribute name="start"> |
1297 | - <xsl:value-of select="$col" /> |
1298 | - <xsl:text>,</xsl:text> |
1299 | - <xsl:value-of select="$row + 1" /> |
1300 | - </xsl:attribute> |
1301 | - <xsl:attribute name="stop"> |
1302 | - <xsl:value-of select="$col" /> |
1303 | - <xsl:text>,</xsl:text> |
1304 | - <xsl:value-of select="$row + 1" /> |
1305 | - </xsl:attribute> |
1306 | - </blockBackground> |
1307 | - </xsl:if> |
1308 | - </xsl:for-each> |
1309 | - </xsl:for-each> |
1310 | - <xsl:for-each select="report/employee"> |
1311 | - <xsl:variable name="dept" select="attribute::id" /> |
1312 | - <xsl:variable name="row" select="attribute::row" /> |
1313 | - <xsl:if test="$dept = 1"> |
1314 | - <blockBackground> |
1315 | - <xsl:attribute name="colorName">lightgrey</xsl:attribute> |
1316 | - <xsl:attribute name="start"> |
1317 | - <xsl:text>0,</xsl:text> |
1318 | - <xsl:value-of select="$row +1" /> |
1319 | - </xsl:attribute> |
1320 | - <xsl:attribute name="stop"> |
1321 | - <xsl:text>0,</xsl:text> |
1322 | - <xsl:value-of select="$row +1" /> |
1323 | - </xsl:attribute> |
1324 | - </blockBackground> |
1325 | - </xsl:if> |
1326 | - </xsl:for-each> |
1327 | - <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" /> |
1328 | - <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/> |
1329 | - <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/> |
1330 | - <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/> |
1331 | - <blockValign value="TOP"/> |
1332 | - </blockTableStyle> |
1333 | - |
1334 | - </stylesheet> |
1335 | - |
1336 | - <story> |
1337 | - <xsl:call-template name="story"/> |
1338 | - </story> |
1339 | - </document> |
1340 | - </xsl:template> |
1341 | - |
1342 | - <xsl:template name="story"> |
1343 | - <para style="title" t="1">Holidays Summary</para> |
1344 | - <spacer length="1cm" /> |
1345 | - <xsl:variable name="cols_legend"> |
1346 | - <xsl:text>1.2cm,7.0cm</xsl:text> |
1347 | - </xsl:variable> |
1348 | - <blockTable> |
1349 | - <xsl:attribute name="style">products</xsl:attribute> |
1350 | - <xsl:attribute name="colWidths"><xsl:value-of select="report/cols_months"/></xsl:attribute> |
1351 | - <tr> |
1352 | - <td>Month</td> |
1353 | - <xsl:for-each select="report/months"> |
1354 | - <td> |
1355 | - <xsl:value-of select="attribute::name" /> |
1356 | - </td> |
1357 | - </xsl:for-each> |
1358 | - </tr> |
1359 | - </blockTable> |
1360 | - |
1361 | - <blockTable> |
1362 | - <xsl:attribute name="style">month</xsl:attribute> |
1363 | - <xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute> |
1364 | - <tr> |
1365 | - <td> </td> |
1366 | - <xsl:for-each select="report/days/dayy"> |
1367 | - <td> |
1368 | - <xsl:value-of select="attribute::name" /> |
1369 | - </td> |
1370 | - </xsl:for-each> |
1371 | - </tr> |
1372 | - <tr> |
1373 | - <td><para> |
1374 | - <xsl:attribute name="style">employee</xsl:attribute> |
1375 | - Employee Name |
1376 | - </para> |
1377 | - </td> |
1378 | - <xsl:for-each select="report/days/dayy"> |
1379 | - <td> |
1380 | - <xsl:value-of select="attribute::number" /> |
1381 | - </td> |
1382 | - </xsl:for-each> |
1383 | - </tr> |
1384 | - <xsl:apply-templates select="report/employee"/> |
1385 | - <xsl:for-each select="report/employee"> |
1386 | - <xsl:variable name="id" select="attribute::id"/> |
1387 | - |
1388 | - <tr> |
1389 | - <td t="1"> |
1390 | - <para> |
1391 | - <xsl:choose> |
1392 | - <xsl:when test="$id = 1"> |
1393 | - <xsl:attribute name="style">dept</xsl:attribute> |
1394 | - </xsl:when> |
1395 | - <xsl:otherwise> |
1396 | - <xsl:attribute name="style">normal</xsl:attribute> |
1397 | - </xsl:otherwise> |
1398 | - </xsl:choose> |
1399 | - <xsl:value-of select="attribute::name"/> |
1400 | - </para> |
1401 | - </td> |
1402 | - <xsl:for-each select="//report/days/dayy"> |
1403 | - <xsl:variable name="cell" select="attribute::cell" /> |
1404 | - <td></td> |
1405 | - </xsl:for-each> |
1406 | - </tr> |
1407 | - </xsl:for-each> |
1408 | - |
1409 | - </blockTable> |
1410 | - <spacer length="1cm" /> |
1411 | - <blockTable> |
1412 | - <xsl:attribute name="style">legend</xsl:attribute> |
1413 | - <xsl:attribute name="colWidths"><xsl:value-of select="$cols_legend"/></xsl:attribute> |
1414 | - <tr> |
1415 | - <td>Color</td> |
1416 | - <td>Holiday Type</td> |
1417 | - |
1418 | - </tr> |
1419 | - <xsl:for-each select="report/legend"> |
1420 | - <tr> |
1421 | - <td> |
1422 | - <para> |
1423 | - <xsl:attribute name="style">normal</xsl:attribute> |
1424 | - <xsl:value-of select="attribute::row"/> |
1425 | - </para> |
1426 | - </td> |
1427 | - <td> |
1428 | - <para> |
1429 | - <xsl:attribute name="style">normal</xsl:attribute> |
1430 | - <xsl:value-of select="attribute::name"/> |
1431 | - </para> |
1432 | - </td> |
1433 | - </tr> |
1434 | - </xsl:for-each> |
1435 | - </blockTable> |
1436 | - </xsl:template> |
1437 | -</xsl:stylesheet> |
1438 | |
1439 | === removed file 'hr_holidays_cci/report/holidays_summary_report.py' |
1440 | --- hr_holidays_cci/report/holidays_summary_report.py 2010-07-06 06:47:27 +0000 |
1441 | +++ hr_holidays_cci/report/holidays_summary_report.py 1970-01-01 00:00:00 +0000 |
1442 | @@ -1,228 +0,0 @@ |
1443 | -# -*- encoding: utf-8 -*- |
1444 | -############################################################################## |
1445 | -# |
1446 | -# OpenERP, Open Source Management Solution |
1447 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1448 | -# |
1449 | -# This program is free software: you can redistribute it and/or modify |
1450 | -# it under the terms of the GNU Affero General Public License as |
1451 | -# published by the Free Software Foundation, either version 3 of the |
1452 | -# License, or (at your option) any later version. |
1453 | -# |
1454 | -# This program is distributed in the hope that it will be useful, |
1455 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1456 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1457 | -# GNU Affero General Public License for more details. |
1458 | -# |
1459 | -# You should have received a copy of the GNU Affero General Public License |
1460 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1461 | -# |
1462 | -############################################################################## |
1463 | - |
1464 | -import datetime |
1465 | -import time |
1466 | - |
1467 | -from osv import fields, osv |
1468 | -from report.interface import report_rml |
1469 | -from report.interface import toxml |
1470 | - |
1471 | -import pooler |
1472 | - |
1473 | - |
1474 | -def lengthmonth(year, month): |
1475 | - if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): |
1476 | - return 29 |
1477 | - return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] |
1478 | - |
1479 | -def strToDate(dt): |
1480 | - dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10])) |
1481 | - return dt_date |
1482 | - |
1483 | -def emp_create_xml(self,cr,uid,dept,row_id,empid,name,som,eom): |
1484 | - |
1485 | - dayDiff=eom-som |
1486 | - display={} |
1487 | - if dept==0: |
1488 | - p_id=pooler.get_pool(cr.dbname).get('hr.holidays').search(cr,uid,[('employee_id','=',empid)]) |
1489 | - |
1490 | - ids_date = pooler.get_pool(cr.dbname).get('hr.holidays').read(cr,uid,p_id,['date_from','date_to','holiday_status','state']) |
1491 | - |
1492 | - for index in range(1,dayDiff.days+2): |
1493 | - diff=index-1 |
1494 | - current=som+datetime.timedelta(diff) |
1495 | - |
1496 | - for item in ids_date: |
1497 | - # print current,"from",item['date_from'],"to",item['date_to'] |
1498 | - if current >= strToDate(item['date_from']) and current <= strToDate(item['date_to']): |
1499 | - if item['state']=='confirm' or item['state']=='validate': |
1500 | - display[index]=item['holiday_status'][0] |
1501 | - else: |
1502 | - display[index]=' ' |
1503 | - break |
1504 | - else: |
1505 | - display[index]=' ' |
1506 | - |
1507 | - else: |
1508 | - |
1509 | - for index in range(1,dayDiff.days+2): |
1510 | - display[index]=' ' |
1511 | - |
1512 | - xml = ''' |
1513 | - <time-element index="%d"> |
1514 | - <value>%s</value> |
1515 | - </time-element> |
1516 | - ''' |
1517 | - time_xml = ([xml % (index, value) for index,value in display.iteritems()]) |
1518 | - data_xml=['<info id="%d" number="%d" val="%s" />' % (row_id,x,display[x]) for x in range(1,len(display)+1) ] |
1519 | - |
1520 | - # Computing the xml |
1521 | - xml = ''' |
1522 | - %s |
1523 | - <employee row="%d" id="%d" name="%s"> |
1524 | - %s |
1525 | - </employee> |
1526 | - ''' % (data_xml,row_id,dept, toxml(name), '\n'.join(time_xml)) |
1527 | - |
1528 | - return xml |
1529 | - |
1530 | -class report_custom(report_rml): |
1531 | - def create_xml(self, cr, uid, ids,data, context): |
1532 | - depts=[] |
1533 | - emp_id={} |
1534 | - |
1535 | - # Computing the dates (start of month: som, and end of month: eom) |
1536 | - cr.execute("select id,name,color_name from hr_holidays_status order by id") |
1537 | - legend=cr.fetchall() |
1538 | - |
1539 | - today=datetime.datetime.today() |
1540 | - |
1541 | - first_date=data['form']['date_from'] |
1542 | - last_date=data['form']['date_to'] |
1543 | - |
1544 | - som = strToDate(first_date) |
1545 | - eom = strToDate(last_date) |
1546 | - |
1547 | - day_diff=eom-som |
1548 | - |
1549 | - date_xml=[] |
1550 | - for l in range(0,len(legend)): |
1551 | - date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],legend[l][1],legend[l][2])] |
1552 | - |
1553 | - date_xml += ['<date month="%s" year="%d" />' % (som.strftime('%B'), som.year),'<days>'] |
1554 | - |
1555 | - cell=1 |
1556 | - if day_diff.days>=30: |
1557 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] |
1558 | - else: |
1559 | - if day_diff.days>=(lengthmonth(som.year, som.month)-som.day): |
1560 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, lengthmonth(som.year, som.month)+1)] |
1561 | - else: |
1562 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som.replace(day=x).strftime('%a'),x-som.day+1) for x in range(som.day, eom.day+1)] |
1563 | - |
1564 | - cell=x-som.day+1 |
1565 | - day_diff1=day_diff.days-cell+1 |
1566 | - |
1567 | - width_dict={} |
1568 | - month_dict={} |
1569 | - |
1570 | - i=1 |
1571 | - j=1 |
1572 | - year=som.year |
1573 | - month=som.month |
1574 | - month_dict[j]=som.strftime('%B') |
1575 | - width_dict[j]=cell |
1576 | - |
1577 | - while day_diff1>0: |
1578 | - if month+i<=12: |
1579 | - if day_diff1>30: |
1580 | - som1=datetime.date(year,month+i,1) |
1581 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(year,i+month)+1)] |
1582 | - i=i+1 |
1583 | - j=j+1 |
1584 | - month_dict[j]=som1.strftime('%B') |
1585 | - cell=cell+x |
1586 | - width_dict[j]=x |
1587 | - |
1588 | - else: |
1589 | - som1=datetime.date(year,month+i,1) |
1590 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] |
1591 | - i=i+1 |
1592 | - j=j+1 |
1593 | - month_dict[j]=som1.strftime('%B') |
1594 | - cell=cell+x |
1595 | - width_dict[j]=x |
1596 | - |
1597 | - day_diff1=day_diff1-x |
1598 | -# print "now day_diff1 is..frst.",day_diff1 |
1599 | - else: |
1600 | - years=year+1 |
1601 | - year=years |
1602 | - month=0 |
1603 | - i=1 |
1604 | - if day_diff1>=30: |
1605 | - som1=datetime.date(years,i,1) |
1606 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, lengthmonth(years,i)+1)] |
1607 | - i=i+1 |
1608 | - j=j+1 |
1609 | - month_dict[j]=som1.strftime('%B') |
1610 | - cell=cell+x |
1611 | - width_dict[j]=x |
1612 | - |
1613 | - else: |
1614 | - som1=datetime.date(years,i,1) |
1615 | - i=i+1 |
1616 | - j=j+1 |
1617 | - month_dict[j]=som1.strftime('%B') |
1618 | - date_xml += ['<dayy number="%d" name="%s" cell="%d"/>' % (x, som1.replace(day=x).strftime('%a'),cell+x) for x in range(1, eom.day+1)] |
1619 | - cell=cell+x |
1620 | - width_dict[j]=x |
1621 | - |
1622 | - day_diff1=day_diff1-x |
1623 | -# print "now day_diff1 is..scnd.",day_diff1 |
1624 | - |
1625 | - date_xml.append('</days>') |
1626 | - date_xml.append('<cols>3.5cm%s</cols>\n' % (',0.7cm' * (day_diff.days+1))) |
1627 | - |
1628 | - st='<cols_months>3.5cm' |
1629 | - for m in range(1,len(width_dict)+1): |
1630 | - st+=',' + str(0.7 *width_dict[m])+'cm' |
1631 | - st+='</cols_months>\n' |
1632 | -# print "dates...",date_xml |
1633 | - months_xml =['<months number="%d" name="%s" />' % (x,month_dict[x]) for x in range(1,len(month_dict)+1) ] |
1634 | - months_xml.append(st) |
1635 | - emp_xml='' |
1636 | - row_id=1 |
1637 | - for id in data['form']['depts'][0][2]: |
1638 | - dept = pooler.get_pool(cr.dbname).get('hr.department').browse(cr, uid, id, context.copy()) |
1639 | - depts.append(dept) |
1640 | - |
1641 | - cr.execute('select user_id from hr_department_user_rel where department_id=%d'%(dept.id)) |
1642 | - result=cr.fetchall() |
1643 | - |
1644 | - if result!=[]: |
1645 | - emp_xml += emp_create_xml(self,cr,uid,1,row_id,dept.id,dept.name,som, eom) |
1646 | - row_id = row_id +1 |
1647 | - else: |
1648 | - continue |
1649 | - for d in range(0,len(result)): |
1650 | - emp_id[d]=pooler.get_pool(cr.dbname).get('hr.employee').search(cr,uid,[('user_id','=',result[d][0])]) |
1651 | - items = pooler.get_pool(cr.dbname).get('hr.employee').read(cr,uid,emp_id[d],['id','name']) |
1652 | - |
1653 | - for item in items: |
1654 | - emp_xml += emp_create_xml(self,cr,uid,0,row_id,item['id'],item['name'],som, eom) |
1655 | - row_id = row_id +1 |
1656 | - |
1657 | - # Computing the xml |
1658 | - xml='''<?xml version="1.0" encoding="UTF-8" ?> |
1659 | - <report> |
1660 | - %s |
1661 | - %s |
1662 | - %s |
1663 | - </report> |
1664 | - ''' % (months_xml,date_xml, emp_xml) |
1665 | - |
1666 | - return xml |
1667 | - |
1668 | -report_custom('report.holidays.summary', 'hr.holidays', '', 'addons/hr_holidays_cci/report/holidays_summary.xsl') |
1669 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1670 | - |
1671 | |
1672 | === removed directory 'hr_holidays_cci/wizard' |
1673 | === removed file 'hr_holidays_cci/wizard/__init__.py' |
1674 | --- hr_holidays_cci/wizard/__init__.py 2009-10-15 11:25:40 +0000 |
1675 | +++ hr_holidays_cci/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
1676 | @@ -1,24 +0,0 @@ |
1677 | -# -*- encoding: utf-8 -*- |
1678 | -############################################################################## |
1679 | -# |
1680 | -# OpenERP, Open Source Management Solution |
1681 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1682 | -# |
1683 | -# This program is free software: you can redistribute it and/or modify |
1684 | -# it under the terms of the GNU Affero General Public License as |
1685 | -# published by the Free Software Foundation, either version 3 of the |
1686 | -# License, or (at your option) any later version. |
1687 | -# |
1688 | -# This program is distributed in the hope that it will be useful, |
1689 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1690 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1691 | -# GNU Affero General Public License for more details. |
1692 | -# |
1693 | -# You should have received a copy of the GNU Affero General Public License |
1694 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1695 | -# |
1696 | -############################################################################## |
1697 | - |
1698 | -import holidays_summary |
1699 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1700 | - |
1701 | |
1702 | === removed file 'hr_holidays_cci/wizard/holidays_summary.py' |
1703 | --- hr_holidays_cci/wizard/holidays_summary.py 2009-10-15 11:25:40 +0000 |
1704 | +++ hr_holidays_cci/wizard/holidays_summary.py 1970-01-01 00:00:00 +0000 |
1705 | @@ -1,101 +0,0 @@ |
1706 | -# -*- encoding: utf-8 -*- |
1707 | -############################################################################## |
1708 | -# |
1709 | -# OpenERP, Open Source Management Solution |
1710 | -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1711 | -# |
1712 | -# This program is free software: you can redistribute it and/or modify |
1713 | -# it under the terms of the GNU Affero General Public License as |
1714 | -# published by the Free Software Foundation, either version 3 of the |
1715 | -# License, or (at your option) any later version. |
1716 | -# |
1717 | -# This program is distributed in the hope that it will be useful, |
1718 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1719 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1720 | -# GNU Affero General Public License for more details. |
1721 | -# |
1722 | -# You should have received a copy of the GNU Affero General Public License |
1723 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1724 | -# |
1725 | -############################################################################## |
1726 | - |
1727 | -import wizard |
1728 | -import datetime |
1729 | - |
1730 | -form='''<?xml version="1.0"?> |
1731 | -<form string="Choose the timespan for the report"> |
1732 | - <field name="date_from" colspan="1" /> |
1733 | - <field name="date_to" colspan="1" /> |
1734 | - <field name="depts" colspan="4" /> |
1735 | -</form>''' |
1736 | - |
1737 | -back_form='''<?xml version="1.0"?> |
1738 | -<form string="Notification"> |
1739 | -<label string="You should select less than 90 days for the proper layout of report. Try again." colspan="4"/> |
1740 | -</form>''' |
1741 | - |
1742 | -back_fields={ |
1743 | -} |
1744 | -class wizard_report(wizard.interface): |
1745 | - def _check(self, cr, uid, data, context): |
1746 | - cr.execute("select CURRENT_DATE") |
1747 | - _date_from=cr.fetchone() |
1748 | - cr.execute("select CURRENT_DATE + 89") |
1749 | - _date_to=cr.fetchone() |
1750 | - |
1751 | - data['form']['date_from']=_date_from[0] |
1752 | - data['form']['date_to']=_date_to[0] |
1753 | - |
1754 | - return data['form'] |
1755 | - def _check90days(self,cr,uid,data,context): |
1756 | - |
1757 | - first_date=data['form']['date_from'] |
1758 | - last_date=data['form']['date_to'] |
1759 | - |
1760 | - som = datetime.date(int(first_date[0:4]),int(first_date[5:7]),int(first_date[8:10])) |
1761 | - eom = datetime.date(int(last_date[0:4]),int(last_date[5:7]),int(last_date[8:10])) |
1762 | - |
1763 | - day_diff=eom-som |
1764 | - if day_diff.days>90: |
1765 | - return 'notify' |
1766 | - else: |
1767 | - return 'report' |
1768 | - |
1769 | - fields={ |
1770 | - 'date_from':{ |
1771 | - 'string':'From', |
1772 | - 'type':'date', |
1773 | - 'required':True, |
1774 | - |
1775 | - }, |
1776 | - 'date_to':{ |
1777 | - 'string':'To', |
1778 | - 'type':'date', |
1779 | - 'required':True, |
1780 | - |
1781 | - }, |
1782 | - 'depts': {'string': 'Department(s)', 'type': 'many2many', 'relation': 'hr.department','required': True}, |
1783 | - |
1784 | - } |
1785 | - |
1786 | - states={ |
1787 | - 'init':{ |
1788 | - 'actions':[_check], |
1789 | - 'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel'), ('state_next', 'Print')]} |
1790 | - }, |
1791 | - 'state_next':{ |
1792 | - 'actions':[], |
1793 | - 'result': {'type':'choice','next_state':_check90days} |
1794 | - }, |
1795 | - 'notify': { |
1796 | - 'actions': [], |
1797 | - 'result': {'type':'form','arch':back_form,'fields':back_fields,'state':[('end','Ok')]} |
1798 | - }, |
1799 | - 'report':{ |
1800 | - 'actions':[], |
1801 | - 'result':{'type':'print', 'report':'holidays.summary', 'state':'end'} |
1802 | - } |
1803 | - } |
1804 | -wizard_report('hr.holidays.summary') |
1805 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1806 | - |
1807 | |
1808 | === modified file 'hr_holidays_evaluation/__init__.py' |
1809 | --- hr_holidays_evaluation/__init__.py 2009-10-15 11:25:40 +0000 |
1810 | +++ hr_holidays_evaluation/__init__.py 2013-12-23 20:13:10 +0000 |
1811 | @@ -1,6 +1,6 @@ |
1812 | # -*- encoding: utf-8 -*- |
1813 | -############################################################################## |
1814 | -# |
1815 | +# |
1816 | +# |
1817 | # OpenERP, Open Source Management Solution |
1818 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1819 | # |
1820 | @@ -15,9 +15,9 @@ |
1821 | # GNU Affero General Public License for more details. |
1822 | # |
1823 | # You should have received a copy of the GNU Affero General Public License |
1824 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1825 | -# |
1826 | -############################################################################## |
1827 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1828 | +# |
1829 | +# |
1830 | import hr_holidays_evaluation |
1831 | |
1832 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1833 | \ No newline at end of file |
1834 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1835 | |
1836 | === renamed file 'hr_holidays_evaluation/__terp__.py' => 'hr_holidays_evaluation/__openerp__.py' |
1837 | --- hr_holidays_evaluation/__terp__.py 2009-10-15 11:25:40 +0000 |
1838 | +++ hr_holidays_evaluation/__openerp__.py 2013-12-23 20:13:10 +0000 |
1839 | @@ -1,6 +1,6 @@ |
1840 | # -*- encoding: utf-8 -*- |
1841 | -############################################################################## |
1842 | -# |
1843 | +# |
1844 | +# |
1845 | # OpenERP, Open Source Management Solution |
1846 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1847 | # |
1848 | @@ -15,23 +15,23 @@ |
1849 | # GNU Affero General Public License for more details. |
1850 | # |
1851 | # You should have received a copy of the GNU Affero General Public License |
1852 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1853 | -# |
1854 | -############################################################################## |
1855 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1856 | +# |
1857 | +# |
1858 | { |
1859 | - "name" : "Hr holidays evaluation", |
1860 | - "version" : "1.0", |
1861 | - "author" : "Tiny", |
1862 | - "category" : "Generic Modules/Human Resources", |
1863 | - "website" : "http://www.openerp.com", |
1864 | - "depends" : ["hr_holidays", "hr_contract", "hr_attendance"], |
1865 | - "demo_xml" : [], |
1866 | + "name": "Hr holidays evaluation", |
1867 | + "version": "1.0", |
1868 | + "author": "Tiny", |
1869 | + "category": "Generic Modules/Human Resources", |
1870 | + "website": "http://www.openerp.com", |
1871 | + "depends": ["hr_holidays", "hr_contract", "hr_attendance"], |
1872 | + "demo_xml": [], |
1873 | 'init_xml': [], |
1874 | - "update_xml" : ["hr_holidays_evaluation_view.xml", |
1875 | - "security/ir.model.access.csv"], |
1876 | - "description" : "Computation of holidays for employee", |
1877 | - "active" : False, |
1878 | - "installable" : True, |
1879 | + "update_xml": ["hr_holidays_evaluation_view.xml", |
1880 | + "security/ir.model.access.csv"], |
1881 | + "description": "Computation of holidays for employee", |
1882 | + "active": False, |
1883 | + "installable": True, |
1884 | } |
1885 | |
1886 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1887 | \ No newline at end of file |
1888 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1889 | |
1890 | === modified file 'hr_holidays_evaluation/hr_holidays_evaluation.py' |
1891 | --- hr_holidays_evaluation/hr_holidays_evaluation.py 2010-09-14 13:51:49 +0000 |
1892 | +++ hr_holidays_evaluation/hr_holidays_evaluation.py 2013-12-23 20:13:10 +0000 |
1893 | @@ -1,5 +1,5 @@ |
1894 | # -*- encoding: utf-8 -*- |
1895 | -############################################################################## |
1896 | +# |
1897 | # |
1898 | # OpenERP, Open Source Management Solution |
1899 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
1900 | @@ -17,7 +17,7 @@ |
1901 | # You should have received a copy of the GNU Affero General Public License |
1902 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1903 | # |
1904 | -############################################################################## |
1905 | +# |
1906 | |
1907 | from mx import DateTime |
1908 | import time |
1909 | @@ -27,36 +27,37 @@ |
1910 | from tools.translate import _ |
1911 | import pooler |
1912 | |
1913 | + |
1914 | class hr_holidays(osv.osv): |
1915 | _inherit = 'hr.holidays' |
1916 | _columns = { |
1917 | - 'auto_eval' : fields.boolean('Auto computed by wizard'), |
1918 | + 'auto_eval': fields.boolean('Auto computed by wizard'), |
1919 | } |
1920 | _defaults = { |
1921 | - 'auto_eval' : lambda *a: False, |
1922 | + 'auto_eval': lambda *a: False, |
1923 | } |
1924 | hr_holidays() |
1925 | |
1926 | + |
1927 | class hr_holidays_note(osv.osv): |
1928 | - _name='hr.holidays.note' |
1929 | + _name = 'hr.holidays.note' |
1930 | _description = "Holidays note" |
1931 | _rec_name = 'date' |
1932 | _order = 'date desc' |
1933 | |
1934 | def _compute_diff(self, cr, uid, ids, name, arg, context={}): |
1935 | - res={} |
1936 | + res = {} |
1937 | for id in ids: |
1938 | - tmp = self.read(cr, uid, id, ['prev_number','new_number']) |
1939 | + tmp = self.read(cr, uid, id, ['prev_number', 'new_number']) |
1940 | old, new = tmp['prev_number'], tmp['new_number'] |
1941 | if not old: |
1942 | old = 0 |
1943 | res[id] = new - old |
1944 | return res |
1945 | |
1946 | - |
1947 | _columns = { |
1948 | - 'holiday_status_id':fields.many2one('hr.holidays.status','Holiday Status', required=True), |
1949 | - 'date' : fields.char('Date', size=64, required=True), |
1950 | + 'holiday_status_id': fields.many2one('hr.holidays.status', 'Holiday Status', required=True), |
1951 | + 'date': fields.char('Date', size=64, required=True), |
1952 | 'employee_id': fields.many2one('hr.employee', string='Employee Name', required=True), |
1953 | 'prev_number': fields.float('Previous Holiday Number'), |
1954 | 'new_number': fields.float('New Holiday Number', required=True), |
1955 | @@ -64,20 +65,21 @@ |
1956 | } |
1957 | hr_holidays_note() |
1958 | |
1959 | + |
1960 | class wizard_hr_holidays_evaluation(osv.osv_memory): |
1961 | _name = 'wizard.hr.holidays.evaluation' |
1962 | _rec_name = 'holiday_status_id' |
1963 | _columns = { |
1964 | - 'holiday_status_id':fields.many2one('hr.holidays.status','Holiday Status',required=True,help='This is where you specify the holiday type to synchronize. It will create the "holidays per employee" accordingly if necessary, or replace the value "Max leaves allowed" into the existing one.'), |
1965 | - 'hr_timesheet_group_id':fields.many2one('resource.calendar','Working Hours',required=True,help='This field allow you to filter on only the employees that have a contract using this working hour.'), |
1966 | - 'float_time':fields.float('Time',required=True,help='''This time depicts the amount per day earned by an employee working a day.The computation is: total earned = time * number of working days'''), |
1967 | - 'date_current' : fields.date('Date',help='This field allow you to choose the date to use, for forecast matter e.g.'), |
1968 | + 'holiday_status_id': fields.many2one('hr.holidays.status', 'Holiday Status', required=True, help='This is where you specify the holiday type to synchronize. It will create the "holidays per employee" accordingly if necessary, or replace the value "Max leaves allowed" into the existing one.'), |
1969 | + 'hr_timesheet_group_id': fields.many2one('resource.calendar', 'Working Hours', required=True, help='This field allow you to filter on only the employees that have a contract using this working hour.'), |
1970 | + 'float_time': fields.float('Time', required=True, help='''This time depicts the amount per day earned by an employee working a day.The computation is: total earned = time * number of working days'''), |
1971 | + 'date_current': fields.date('Date', help='This field allow you to choose the date to use, for forecast matter e.g.'), |
1972 | 'date_start': fields.date('Start Date', required=True, help='This field allow you to choose the start date of the holiday computation. Usually it\' the begining of the current year. (NB: For new employees, it will be the starting date of their contract)'), |
1973 | } |
1974 | _defaults = { |
1975 | - 'date_current' : lambda *a: time.strftime('%Y-%m-%d'), |
1976 | + 'date_current': lambda *a: time.strftime('%Y-%m-%d'), |
1977 | 'date_start': lambda *a: time.strftime('%Y-01-01'), |
1978 | - } |
1979 | + } |
1980 | |
1981 | def action_create(self, cr, uid, ids, context=None): |
1982 | data = {} |
1983 | @@ -86,11 +88,12 @@ |
1984 | my_dict = {} |
1985 | bjs = [] |
1986 | contract_obj = self.pool.get('hr.contract') |
1987 | - evaluation_obj = self.browse(cr, uid, ids, context = context)[0] |
1988 | + evaluation_obj = self.browse(cr, uid, ids, context=context)[0] |
1989 | group_id = evaluation_obj.hr_timesheet_group_id.id |
1990 | - contract_ids = contract_obj.search(cr, uid, [('working_hours', '=', group_id)]) |
1991 | + contract_ids = contract_obj.search( |
1992 | + cr, uid, [('working_hours', '=', group_id)]) |
1993 | |
1994 | - for contract in contract_obj.browse(cr,uid,contract_ids): |
1995 | + for contract in contract_obj.browse(cr, uid, contract_ids): |
1996 | emp_id = contract.employee_id.id |
1997 | start_date = contract.date_start |
1998 | stop_date = evaluation_obj.cate_current |
1999 | @@ -102,16 +105,16 @@ |
2000 | cr.execute("""SELECT distinct(ht.dayofweek), sum(ht.hour_to - ht.hour_from) |
2001 | FROM resource_calendar as htg, resource_calendar_week as ht |
2002 | WHERE ht.calendar_id = htg.id AND htg.id = %s |
2003 | - GROUP BY ht.dayofweek""" %evaluation_obj.hr_timesheet_group_id.id) |
2004 | + GROUP BY ht.dayofweek""" % evaluation_obj.hr_timesheet_group_id.id) |
2005 | |
2006 | timesheet_grp = cr.fetchall() |
2007 | - alldays = map(lambda x: x[0],timesheet_grp) |
2008 | + alldays = map(lambda x: x[0], timesheet_grp) |
2009 | nod = len(alldays) |
2010 | - alltime = map(lambda x: x[1],timesheet_grp) |
2011 | + alltime = map(lambda x: x[1], timesheet_grp) |
2012 | how = 0 |
2013 | for k in alltime: |
2014 | how += k |
2015 | - hpd = how/nod |
2016 | + hpd = how / nod |
2017 | cr.execute("""SELECT distinct(to_date(to_char(ha.name, 'YYYY-MM-dd'),'YYYY-MM-dd')) |
2018 | FROM hr_attendance ha, hr_attendance ha2 |
2019 | WHERE ha.action='sign_in' |
2020 | @@ -122,7 +125,7 @@ |
2021 | AND ha.employee_id = %s """, (stop_date, start_date, emp_id)) |
2022 | |
2023 | results = cr.fetchall() |
2024 | - all_dates = map(lambda x: x[0],results) |
2025 | + all_dates = map(lambda x: x[0], results) |
2026 | days = len(all_dates) |
2027 | hrss = days * evaluation_obj.float_time |
2028 | |
2029 | @@ -136,7 +139,8 @@ |
2030 | x += 0.5 |
2031 | |
2032 | holiday_obj = self.pool.get('hr.holidays') |
2033 | - holiday_ids = holiday_obj.search(cr, uid, [('employee_id', '=', emp_id),('holiday_status_id', '=', evaluation_obj.holiday_status_id.id),('auto_eval','=',True)]) |
2034 | + holiday_ids = holiday_obj.search(cr, uid, [('employee_id', '=', emp_id), ( |
2035 | + 'holiday_status_id', '=', evaluation_obj.holiday_status_id.id), ('auto_eval', '=', True)]) |
2036 | old_leave = 0 |
2037 | for holiday_id in holiday_obj.browse(cr, uid, holiday_ids, context): |
2038 | old_leave += holiday_id.number_of_days_temp |
2039 | @@ -146,7 +150,7 @@ |
2040 | 'name': _('Automatically Created Holiday'), |
2041 | 'employee_id': emp_id, |
2042 | 'holiday_status_id': evaluation_obj.holiday_status_id.id, |
2043 | - 'number_of_days_temp' : x - old_leave, |
2044 | + 'number_of_days_temp': x - old_leave, |
2045 | 'type': 'add', |
2046 | 'auto_eval': True |
2047 | } |
2048 | @@ -160,19 +164,20 @@ |
2049 | 'employee_id': emp_id, |
2050 | } |
2051 | |
2052 | - note_id = self.pool.get('hr.holidays.note').create(cr, uid, value, context) |
2053 | + note_id = self.pool.get( |
2054 | + 'hr.holidays.note').create(cr, uid, value, context) |
2055 | bjs.append(note_id) |
2056 | |
2057 | return { |
2058 | - 'domain': "[('id','in', ["+','.join(map(str,bjs))+"])]", |
2059 | + 'domain': "[('id','in', [" + ','.join(map(str, bjs)) + "])]", |
2060 | 'name': _('Summary Report'), |
2061 | 'view_type': 'form', |
2062 | 'view_mode': 'tree,form', |
2063 | 'res_model': 'hr.holidays.note', |
2064 | 'type': 'ir.actions.act_window' |
2065 | - } |
2066 | + } |
2067 | |
2068 | - def action_cancel(self,cr,uid,ids,context=None): |
2069 | + def action_cancel(self, cr, uid, ids, context=None): |
2070 | return {} |
2071 | |
2072 | wizard_hr_holidays_evaluation() |
2073 | |
2074 | === modified file 'hr_holidays_request/__init__.py' |
2075 | --- hr_holidays_request/__init__.py 2009-10-15 11:25:40 +0000 |
2076 | +++ hr_holidays_request/__init__.py 2013-12-23 20:13:10 +0000 |
2077 | @@ -1,6 +1,6 @@ |
2078 | # -*- encoding: utf-8 -*- |
2079 | -############################################################################## |
2080 | -# |
2081 | +# |
2082 | +# |
2083 | # OpenERP, Open Source Management Solution |
2084 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2085 | # |
2086 | @@ -15,11 +15,10 @@ |
2087 | # GNU Affero General Public License for more details. |
2088 | # |
2089 | # You should have received a copy of the GNU Affero General Public License |
2090 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2091 | -# |
2092 | -############################################################################## |
2093 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2094 | +# |
2095 | +# |
2096 | import hr_holidays_request |
2097 | import wizard |
2098 | import report |
2099 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2100 | - |
2101 | |
2102 | === renamed file 'hr_holidays_request/__terp__.py' => 'hr_holidays_request/__openerp__.py' |
2103 | --- hr_holidays_request/__terp__.py 2009-10-15 11:25:40 +0000 |
2104 | +++ hr_holidays_request/__openerp__.py 2013-12-23 20:13:10 +0000 |
2105 | @@ -1,6 +1,6 @@ |
2106 | # -*- encoding: utf-8 -*- |
2107 | -############################################################################## |
2108 | -# |
2109 | +# |
2110 | +# |
2111 | # OpenERP, Open Source Management Solution |
2112 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2113 | # |
2114 | @@ -15,21 +15,20 @@ |
2115 | # GNU Affero General Public License for more details. |
2116 | # |
2117 | # You should have received a copy of the GNU Affero General Public License |
2118 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2119 | -# |
2120 | -############################################################################## |
2121 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2122 | +# |
2123 | +# |
2124 | { |
2125 | - "name" : "HR Holiday Request", |
2126 | - "version" : "1.0", |
2127 | - "author" : "Tiny & Axelor", |
2128 | - "category" : "Generic Modules/Human Resources", |
2129 | + "name": "HR Holiday Request", |
2130 | + "version": "1.0", |
2131 | + "author": "Tiny & Axelor", |
2132 | + "category": "Generic Modules/Human Resources", |
2133 | "website": "http://www.axelor.com", |
2134 | - "depends" : ["base", "hr", "hr_holidays"], |
2135 | - "init_xml" : [], |
2136 | - "update_xml" : ["security/ir.model.access.csv","holiday_demo_data.xml","hr_holidays_request_view.xml","hr_holiday_wizard.xml","hr_workflow.xml"], |
2137 | - "demo_xml" : [], |
2138 | + "depends": ["base", "hr", "hr_holidays"], |
2139 | + "init_xml": [], |
2140 | + "update_xml": ["security/ir.model.access.csv", "holiday_demo_data.xml", "hr_holidays_request_view.xml", "hr_holiday_wizard.xml", "hr_workflow.xml"], |
2141 | + "demo_xml": [], |
2142 | "installable": True, |
2143 | - "active" : False, |
2144 | + "active": False, |
2145 | } |
2146 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2147 | - |
2148 | |
2149 | === modified file 'hr_holidays_request/hr_holidays_request.py' |
2150 | --- hr_holidays_request/hr_holidays_request.py 2010-08-05 10:31:01 +0000 |
2151 | +++ hr_holidays_request/hr_holidays_request.py 2013-12-23 20:13:10 +0000 |
2152 | @@ -1,5 +1,5 @@ |
2153 | # -*- encoding: utf-8 -*- |
2154 | -############################################################################## |
2155 | +# |
2156 | # |
2157 | # OpenERP, Open Source Management Solution |
2158 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2159 | @@ -17,437 +17,477 @@ |
2160 | # You should have received a copy of the GNU Affero General Public License |
2161 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
2162 | # |
2163 | -############################################################################## |
2164 | +# |
2165 | from mx import DateTime |
2166 | import time |
2167 | import pooler |
2168 | import netsvc |
2169 | -from osv import fields, osv |
2170 | import datetime |
2171 | import calendar |
2172 | -def _manager_get(obj,cr,uid,context={}): |
2173 | - ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
2174 | +from osv import fields, osv |
2175 | + |
2176 | + |
2177 | +def _manager_get(obj, cr, uid, context={}): |
2178 | + ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)]) |
2179 | if ids: |
2180 | boss = obj.pool.get('hr.employee').read(cr, uid, ids)[0]['parent_id'] |
2181 | if boss: |
2182 | return boss[0] |
2183 | return False |
2184 | |
2185 | + |
2186 | class hr_holidays(osv.osv): |
2187 | _inherit = 'hr.holidays' |
2188 | _description = "Holidays" |
2189 | + |
2190 | def search(self, cr, uid, args, offset=0, limit=None, order=None, |
2191 | - context=None, count=False): |
2192 | - if len(args)==2: |
2193 | - if (args[0]==['state', '=', 'confirm'] and args[1]==['employee_id',"=",[]]) or (args[0]==('state', '=', 'confirm') and args[1]==('employee_id',"=",[])): |
2194 | - res=[] |
2195 | - ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
2196 | + context=None, count=False): |
2197 | + if len(args) == 2: |
2198 | + if (args[0] == ['state', '=', 'confirm'] and args[1] == ['employee_id', "=", []]) or (args[0] == ('state', '=', 'confirm') and args[1] == ('employee_id', "=", [])): |
2199 | + res = [] |
2200 | + ids = self.pool.get('hr.employee').search( |
2201 | + cr, uid, [('user_id', '=', uid)]) |
2202 | for id in ids: |
2203 | - boss = self.pool.get('hr.employee').search(cr, uid,[('parent_id','=',id)]) |
2204 | + boss = self.pool.get('hr.employee').search( |
2205 | + cr, uid, [('parent_id', '=', id)]) |
2206 | for b in boss: |
2207 | res.append(b) |
2208 | - boss1 = self.pool.get('hr.employee').search(cr, uid,[('parent_id','=',b)]) |
2209 | + boss1 = self.pool.get('hr.employee').search( |
2210 | + cr, uid, [('parent_id', '=', b)]) |
2211 | for b1 in boss1: |
2212 | boss.append(b1) |
2213 | - args[1]=['employee_id','in',res] |
2214 | - |
2215 | - return super(hr_holidays,self).search(cr, uid, args, offset, limit, |
2216 | - order, context=context, count=count) |
2217 | + args[1] = ['employee_id', 'in', res] |
2218 | + |
2219 | + return super(hr_holidays, self).search(cr, uid, args, offset, limit, |
2220 | + order, context=context, count=count) |
2221 | + |
2222 | def copy(self, cr, uid, id, default=None, context={}): |
2223 | - raise osv.except_osv('Duplicate Error !','Can not create duplicate record') |
2224 | + raise osv.except_osv( |
2225 | + 'Duplicate Error !', 'Can not create duplicate record') |
2226 | return False |
2227 | + |
2228 | def unlink(self, cr, uid, ids, context={}, check=True): |
2229 | for id in ids: |
2230 | - selfobj=self.browse(cr,uid,id) |
2231 | - if selfobj.state=="validate" or selfobj.state=="refuse": |
2232 | - raise osv.except_osv('Data Error !','Can not Delete Validated or refused record') |
2233 | + selfobj = self.browse(cr, uid, id) |
2234 | + if selfobj.state == "validate" or selfobj.state == "refuse": |
2235 | + raise osv.except_osv( |
2236 | + 'Data Error !', 'Can not delete validated or refused record') |
2237 | return super(hr_holidays, self).unlink(cr, uid, ids, context=context) |
2238 | + |
2239 | def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): |
2240 | - slobj=self.browse(cr,uid,ids) |
2241 | + slobj = self.browse(cr, uid, ids) |
2242 | if vals.__contains__('date_from1'): |
2243 | - d=vals['date_from1'] |
2244 | + d = vals['date_from1'] |
2245 | else: |
2246 | for s in slobj: |
2247 | - d=s.date_from1 |
2248 | + d = s.date_from1 |
2249 | if vals.__contains__('date_to1'): |
2250 | - dd=vals['date_to1'] |
2251 | - else : |
2252 | + dd = vals['date_to1'] |
2253 | + else: |
2254 | for s in slobj: |
2255 | - dd=s.date_to1 |
2256 | + dd = s.date_to1 |
2257 | |
2258 | - d1=d.split('-') |
2259 | - d2=dd.split('-') |
2260 | - d1[2]=d1[2].split(' ') |
2261 | - d2[2]=d2[2].split(' ') |
2262 | - a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0])) |
2263 | - b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0])) |
2264 | - if b<a: |
2265 | - raise osv.except_osv('Date Error !','From date should be smaller than To date') |
2266 | + d1 = d.split('-') |
2267 | + d2 = dd.split('-') |
2268 | + d1[2] = d1[2].split(' ') |
2269 | + d2[2] = d2[2].split(' ') |
2270 | + a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0])) |
2271 | + b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0])) |
2272 | + if b < a: |
2273 | + raise osv.except_osv( |
2274 | + 'Date Error !', 'From date should be smaller than To date') |
2275 | return super(hr_holidays, self).write(cr, uid, ids, vals, context=context) |
2276 | + |
2277 | def create(self, cr, uid, vals, context=None): |
2278 | - d=vals['date_from1'] |
2279 | - dd=vals['date_to1'] |
2280 | - d1=d.split('-') |
2281 | - d2=dd.split('-') |
2282 | - d1[2]=d1[2].split(' ') |
2283 | - d2[2]=d2[2].split(' ') |
2284 | - a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0])) |
2285 | - b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0])) |
2286 | - if b<a: |
2287 | - raise osv.except_osv('Date Error !','From date should be smaller than To date') |
2288 | + d = vals['date_from1'] |
2289 | + dd = vals['date_to1'] |
2290 | + d1 = d.split('-') |
2291 | + d2 = dd.split('-') |
2292 | + d1[2] = d1[2].split(' ') |
2293 | + d2[2] = d2[2].split(' ') |
2294 | + a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0])) |
2295 | + b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0])) |
2296 | + if b < a: |
2297 | + raise osv.except_osv( |
2298 | + 'Date Error !', 'From date should be smaller than To date') |
2299 | else: |
2300 | return super(hr_holidays, self).create(cr, uid, vals, context=context) |
2301 | _columns = { |
2302 | - 'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)],'draft1':[('readonly',False)]}), |
2303 | - 'state': fields.selection([('draft1', 'draft'),('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2304 | - 'date_from' : fields.datetime('Vacation start day'), |
2305 | - 'date_to' : fields.datetime('Vacation end day'), |
2306 | - 'date_from1' : fields.date('From', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
2307 | - 'date_to1' : fields.date('To', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
2308 | - 'employee_id' : fields.many2one('hr.employee', 'Employee', select=True, readonly=True, required=True), |
2309 | - 'user_id':fields.many2one('res.users', 'User_id', states={'draft':[('readonly',False)],'draft1':[('readonly',False)]}, select=True, readonly=True), |
2310 | - 'manager_id' : fields.many2one('hr.employee', 'Holiday manager', invisible=False, readonly=True), |
2311 | - 'notes' : fields.text('Notes', readonly=True,states={'draft':[('readonly',False)],'draft1':[('readonly',False)]}), |
2312 | - 'contactno':fields.char("Contact no",size=64 , required=True, readonly=True,states={'draft':[('readonly',False)],'draft1':[('readonly',False)]}), |
2313 | - 'holiday_id':fields.one2many('days.holidays.days','holiday_id',"Holiday's days list", readonly=True,states={'draft':[('readonly',False)],'validate':[('readonly',False)]}), |
2314 | - 'total_half':fields.integer("Total Half Leave", readonly=True), |
2315 | - 'total_full':fields.integer("Total Full Leave", readonly=True), |
2316 | - 'total_hour':fields.integer("Total Hours", readonly=True), |
2317 | + 'name': fields.char('Description', required=True, readonly=True, size=64, states={'draft': [('readonly', False)], 'draft1': [('readonly', False)]}), |
2318 | + 'state': fields.selection([('draft1', 'draft'), ('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2319 | + 'date_from': fields.datetime('Vacation start day'), |
2320 | + 'date_to': fields.datetime('Vacation end day'), |
2321 | + 'date_from1': fields.date('From', required=True, readonly=True, states={'draft': [('readonly', False)]}), |
2322 | + 'date_to1': fields.date('To', required=True, readonly=True, states={'draft': [('readonly', False)]}), |
2323 | + 'employee_id': fields.many2one('hr.employee', 'Employee', select=True, readonly=True, required=True), |
2324 | + 'user_id': fields.many2one('res.users', 'User_id', states={'draft': [('readonly', False)], 'draft1': [('readonly', False)]}, select=True, readonly=True), |
2325 | + 'manager_id': fields.many2one('hr.employee', 'Holiday manager', invisible=False, readonly=True), |
2326 | + 'notes': fields.text('Notes', readonly=True, states={'draft': [('readonly', False)], 'draft1': [('readonly', False)]}), |
2327 | + 'contactno': fields.char("Contact no", size=64, required=True, readonly=True, states={'draft': [('readonly', False)], 'draft1': [('readonly', False)]}), |
2328 | + 'holiday_id': fields.one2many('days.holidays.days', 'holiday_id', "Holiday's days list", readonly=True, states={'draft': [('readonly', False)], 'validate': [('readonly', False)]}), |
2329 | + 'total_half': fields.integer("Total Half Leave", readonly=True), |
2330 | + 'total_full': fields.integer("Total Full Leave", readonly=True), |
2331 | + 'total_hour': fields.integer("Total Hours", readonly=True), |
2332 | 'number_of_days': fields.float('Number of Days in this Holiday Request'), |
2333 | - 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status"), |
2334 | - } |
2335 | + 'holiday_status': fields.many2one("hr.holidays.status", "Holiday's Status"), |
2336 | + } |
2337 | _defaults = { |
2338 | - 'manager_id' : _manager_get, |
2339 | - 'state' : lambda *a: 'draft', |
2340 | + 'manager_id': _manager_get, |
2341 | + 'state': lambda *a: 'draft', |
2342 | 'user_id': lambda obj, cr, uid, context: uid, |
2343 | 'date_from1': lambda *a: time.strftime('%Y-%m-%d'), |
2344 | 'date_to1': lambda *a: time.strftime('%Y-%m-%d'), |
2345 | 'date_from': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), |
2346 | 'date_to': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), |
2347 | - } |
2348 | + } |
2349 | _order = 'date_from1 desc' |
2350 | |
2351 | - def onchange_from_date(self, cr, uid, ids, date_from1,date_to1): |
2352 | - if date_from1>date_to1: |
2353 | - return{'value':{'date_to1':date_from1}} |
2354 | - |
2355 | + def onchange_from_date(self, cr, uid, ids, date_from1, date_to1): |
2356 | + if date_from1 > date_to1: |
2357 | + return{'value': {'date_to1': date_from1}} |
2358 | else: |
2359 | - return {'value':{}} |
2360 | + return {'value': {}} |
2361 | |
2362 | - def days_chaeck(self,cr,uid,ids,s1): |
2363 | - seaobj=self.pool.get('days.holidays.days').browse(cr,uid,s1) |
2364 | + def days_check(self, cr, uid, ids, s1): |
2365 | + seaobj = self.pool.get('days.holidays.days').browse(cr, uid, s1) |
2366 | if seaobj.holiday_id.id: |
2367 | - if not seaobj.holiday_id.id==ids[0]: |
2368 | + if not seaobj.holiday_id.id == ids[0]: |
2369 | |
2370 | - if seaobj.holiday_id.state=='refuse': |
2371 | + if seaobj.holiday_id.state == 'refuse': |
2372 | return True |
2373 | else: |
2374 | - raise osv.except_osv('Day Error !','Can not create more leaves for one day ') |
2375 | + raise osv.except_osv( |
2376 | + 'Day Error !', 'Can not create more leaves for one day ') |
2377 | else: |
2378 | return True |
2379 | else: |
2380 | return True |
2381 | |
2382 | def create_days(self, cr, uid, ids, *args): |
2383 | - selfobj=self.browse(cr, uid, ids, None) |
2384 | + selfobj = self.browse(cr, uid, ids, None) |
2385 | for s in selfobj: |
2386 | - d=s.date_from1 |
2387 | - dd=s.date_to1 |
2388 | - d1=d.split('-') |
2389 | - d2=dd.split('-') |
2390 | - d1[2]=d1[2].split(' ') |
2391 | - d2[2]=d2[2].split(' ') |
2392 | - a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0])) |
2393 | - b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0])) |
2394 | - temp=a |
2395 | - if a>b: |
2396 | - raise osv.except_osv('Date Error !','From date should be smaller than To date') |
2397 | - t12=datetime.timedelta(days=1) |
2398 | - dobj=self.pool.get('days.holidays.days') |
2399 | - delobject=dobj.search(cr, uid, [('holiday_id', '=', ids[0])]) |
2400 | + d = s.date_from1 |
2401 | + dd = s.date_to1 |
2402 | + d1 = d.split('-') |
2403 | + d2 = dd.split('-') |
2404 | + d1[2] = d1[2].split(' ') |
2405 | + d2[2] = d2[2].split(' ') |
2406 | + a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0])) |
2407 | + b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0])) |
2408 | + temp = a |
2409 | + if a > b: |
2410 | + raise osv.except_osv( |
2411 | + 'Date Error !', 'From date should be smaller than To date') |
2412 | + t12 = datetime.timedelta(days=1) |
2413 | + dobj = self.pool.get('days.holidays.days') |
2414 | + delobject = dobj.search(cr, uid, [('holiday_id', '=', ids[0])]) |
2415 | for d in delobject: |
2416 | - dobj.unlink(cr, uid,d) |
2417 | - cr.execute("select name from public_holidays_days" ) |
2418 | - t=[] |
2419 | - t=cr.fetchall() |
2420 | - fd=1 |
2421 | - pd=0 |
2422 | - while (temp<=b): |
2423 | - searchobject=self.pool.get('days.holidays.days').search(cr,uid,[('date1','like', temp.strftime("%Y-%m-%d")),('user_id',"=",uid)]) |
2424 | + dobj.unlink(cr, uid, d) |
2425 | + cr.execute("select name from public_holidays_days") |
2426 | + t = [] |
2427 | + t = cr.fetchall() |
2428 | + fd = 1 |
2429 | + pd = 0 |
2430 | + while (temp <= b): |
2431 | + searchobject = self.pool.get('days.holidays.days').search( |
2432 | + cr, uid, [('date1', 'like', temp.strftime("%Y-%m-%d")), ('user_id', "=", uid)]) |
2433 | |
2434 | - for s1 in searchobject: |
2435 | - if self.days_chaeck(cr, uid, ids, s1): |
2436 | + for s1 in searchobject: |
2437 | + if self.days_check(cr, uid, ids, s1): |
2438 | continue |
2439 | else: |
2440 | return False |
2441 | for t1 in t: |
2442 | - day=calendar.weekday(int(temp.strftime("%Y")),int(temp.strftime("%m")),int(temp.strftime("%d"))) |
2443 | + day = calendar.weekday(int(temp.strftime("%Y")), int( |
2444 | + temp.strftime("%m")), int(temp.strftime("%d"))) |
2445 | |
2446 | - if t1[0]==temp.strftime("%Y-%m-%d") : |
2447 | - if t1[0]==a.strftime("%Y-%m-%d") or t1[0]==b.strftime("%Y-%m-%d") : |
2448 | - pd=1 |
2449 | - fd=0 |
2450 | + if t1[0] == temp.strftime("%Y-%m-%d"): |
2451 | + if t1[0] == a.strftime("%Y-%m-%d") or t1[0] == b.strftime("%Y-%m-%d"): |
2452 | + pd = 1 |
2453 | + fd = 0 |
2454 | break |
2455 | else: |
2456 | - pd=1 |
2457 | - fd=1 |
2458 | + pd = 1 |
2459 | + fd = 1 |
2460 | else: |
2461 | - pd=0 |
2462 | - fd=1 |
2463 | - if day==6: |
2464 | - if temp.strftime("%Y-%m-%d")==a.strftime("%Y-%m-%d") or temp.strftime("%Y-%m-%d")==b.strftime("%Y-%m-%d") : |
2465 | - fd=0 |
2466 | - pd=1 |
2467 | + pd = 0 |
2468 | + fd = 1 |
2469 | + if day == 6: |
2470 | + if temp.strftime("%Y-%m-%d") == a.strftime("%Y-%m-%d") or temp.strftime("%Y-%m-%d") == b.strftime("%Y-%m-%d"): |
2471 | + fd = 0 |
2472 | + pd = 1 |
2473 | else: |
2474 | - fd=1 |
2475 | - pd=1 |
2476 | - self.write(cr, uid, ids, {'state':'draft1'}) |
2477 | - self.pool.get('days.holidays.days').create(cr,uid,{ |
2478 | - 'name':temp, |
2479 | - 'date1':temp, |
2480 | - 'half_day':0, |
2481 | - 'full_day':fd, |
2482 | - 'hourly_leave':0, |
2483 | - 'holiday_id':ids[0], |
2484 | - 'public_h':pd, |
2485 | - 'holiday_status':0, |
2486 | - 'user_id':uid, |
2487 | - 'state':'draft', |
2488 | - |
2489 | - }) |
2490 | - |
2491 | - temp+=t12 |
2492 | - |
2493 | - |
2494 | + fd = 1 |
2495 | + pd = 1 |
2496 | + self.write(cr, uid, ids, {'state': 'draft1'}) |
2497 | + self.pool.get( |
2498 | + 'days.holidays.days').create(cr, uid, {'name': temp, |
2499 | + 'date1': temp, |
2500 | + 'half_day': 0, |
2501 | + 'full_day': fd, |
2502 | + 'hourly_leave': 0, |
2503 | + 'holiday_id': ids[0], |
2504 | + 'public_h': pd, |
2505 | + 'holiday_status': 0, |
2506 | + 'user_id': uid, |
2507 | + 'state': 'draft'}) |
2508 | + temp += t12 |
2509 | return True |
2510 | + |
2511 | def days_count(self, cr, uid, ids, *args): |
2512 | - selfobj=self.browse(cr, uid, ids, None) |
2513 | + selfobj = self.browse(cr, uid, ids, None) |
2514 | for s in selfobj: |
2515 | - |
2516 | - d=s.date_from1 |
2517 | - dd=s.date_to1 |
2518 | - d1=d.split('-') |
2519 | - d2=dd.split('-') |
2520 | - d1[2]=d1[2].split(' ') |
2521 | - d2[2]=d2[2].split(' ') |
2522 | - a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0])) |
2523 | - b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0])) |
2524 | + d = s.date_from1 |
2525 | + dd = s.date_to1 |
2526 | + d1 = d.split('-') |
2527 | + d2 = dd.split('-') |
2528 | + d1[2] = d1[2].split(' ') |
2529 | + d2[2] = d2[2].split(' ') |
2530 | + a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0])) |
2531 | + b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0])) |
2532 | if b >= a: |
2533 | - t1=datetime.timedelta(days=1) |
2534 | - temp=b-a+t1 |
2535 | + t1 = datetime.timedelta(days=1) |
2536 | + temp = b - a + t1 |
2537 | |
2538 | if temp == t1: |
2539 | return False |
2540 | - elif temp >t1: |
2541 | + elif temp > t1: |
2542 | return True |
2543 | else: |
2544 | return False |
2545 | else: |
2546 | - raise osv.except_osv('Date Error !','From date should be smaller than To date') |
2547 | + raise osv.except_osv( |
2548 | + 'Date Error !', 'From date should be smaller than To date') |
2549 | |
2550 | def set_to_draft(self, cr, uid, ids, *args): |
2551 | + self.write(cr, uid, ids, {'state': 'draft'}) |
2552 | + return True |
2553 | |
2554 | - self.write(cr, uid, ids, { |
2555 | - 'state':'draft' |
2556 | - }) |
2557 | - return True |
2558 | - def write_data(self,cr,uid,ids,*args): |
2559 | - selfobj=self.browse(cr, uid, ids, None) |
2560 | - full=0 |
2561 | - half=0 |
2562 | - hl=0 |
2563 | + def write_data(self, cr, uid, ids, *args): |
2564 | + selfobj = self.browse(cr, uid, ids, None) |
2565 | + full = 0 |
2566 | + half = 0 |
2567 | + hl = 0 |
2568 | for s in selfobj: |
2569 | - sid=self.pool.get('hr.holidays.history').create(cr,uid,{'validated_id':uid,'name':s.name,'state':s.state,'date_from1':s.date_from1,'date_to1':s.date_to1,'employee_id':s.employee_id.id,'user_id':s.user_id.id,'manager_id':s.manager_id.id,'notes':s.notes,'contactno':s.contactno,'total_half':s.total_half,'total_full':s.total_half}) |
2570 | + sid = self.pool.get( |
2571 | + 'hr.holidays.history').create(cr, uid, {'validated_id': uid, |
2572 | + 'name': s.name, |
2573 | + 'state': s.state, |
2574 | + 'date_from1': s.date_from1, |
2575 | + 'date_to1': s.date_to1, |
2576 | + 'employee_id': s.employee_id.id, |
2577 | + 'user_id': s.user_id.id, |
2578 | + 'manager_id': s.manager_id.id, |
2579 | + 'notes': s.notes, |
2580 | + 'contactno': s.contactno, |
2581 | + 'total_half': s.total_half, |
2582 | + 'total_full': s.total_half}) |
2583 | for s1 in s.holiday_id: |
2584 | - self.pool.get('days.holidays.days').write(cr,uid,s1.id,{'state':s.state}) |
2585 | - ss1=self.pool.get('days.holidays.days').browse(cr,uid,s1.id) |
2586 | + self.pool.get('days.holidays.days').write( |
2587 | + cr, uid, s1.id, {'state': s.state}) |
2588 | + ss1 = self.pool.get( |
2589 | + 'days.holidays.days').browse(cr, uid, s1.id) |
2590 | |
2591 | if ss1.full_day: |
2592 | - full+=1 |
2593 | + full += 1 |
2594 | if ss1.half_day: |
2595 | - half+=1 |
2596 | - if ss1.hourly_leave >0: |
2597 | - hl+=ss1.hourly_leave |
2598 | - self.pool.get('days.holidays.days.history').create(cr,uid,{'user_id':ss1.user_id.id,'state':ss1.state,'name':ss1.name,'date1':ss1.name,'half_day':ss1.half_day,'full_day':ss1.full_day,'hourly_leave':ss1.hourly_leave,'holiday_id':sid,'public_h':ss1.public_h,'holiday_status':ss1.holiday_status}) |
2599 | - self.write(cr, uid, ids, {'total_hour':hl}) |
2600 | - self.write(cr, uid, ids, {'total_half':half}) |
2601 | - self.write(cr, uid, ids, {'total_full':full}) |
2602 | - self.pool.get('hr.holidays.history').write(cr, uid, sid, {'total_half':half}) |
2603 | - self.pool.get('hr.holidays.history').write(cr, uid, sid, {'total_full':full}) |
2604 | - self.pool.get('hr.holidays.history').write(cr, uid, sid, {'total_hour':hl}) |
2605 | + half += 1 |
2606 | + if ss1.hourly_leave > 0: |
2607 | + hl += ss1.hourly_leave |
2608 | + self.pool.get( |
2609 | + 'days.holidays.days.history').create(cr, uid, {'user_id': ss1.user_id.id, |
2610 | + 'state': ss1.state, |
2611 | + 'name': ss1.name, |
2612 | + 'date1': ss1.name, |
2613 | + 'half_day': ss1.half_day, |
2614 | + 'full_day': ss1.full_day, |
2615 | + 'hourly_leave': ss1.hourly_leave, |
2616 | + 'holiday_id': sid, |
2617 | + 'public_h': ss1.public_h, |
2618 | + 'holiday_status': ss1.holiday_status}) |
2619 | + self.write(cr, uid, ids, {'total_hour': hl}) |
2620 | + self.write(cr, uid, ids, {'total_half': half}) |
2621 | + self.write(cr, uid, ids, {'total_full': full}) |
2622 | + self.pool.get('hr.holidays.history').write( |
2623 | + cr, uid, sid, {'total_half': half}) |
2624 | + self.pool.get('hr.holidays.history').write( |
2625 | + cr, uid, sid, {'total_full': full}) |
2626 | + self.pool.get('hr.holidays.history').write( |
2627 | + cr, uid, sid, {'total_hour': hl}) |
2628 | |
2629 | def holidays_validate(self, cr, uid, ids, *args): |
2630 | - |
2631 | - self.write(cr, uid, ids, {'state':'validate'}) |
2632 | - self.write_data(cr, uid, ids) |
2633 | - return True |
2634 | + self.write(cr, uid, ids, {'state': 'validate'}) |
2635 | + self.write_data(cr, uid, ids) |
2636 | + return True |
2637 | |
2638 | def holidays_confirm(self, cr, uid, ids, *args): |
2639 | - selfobject=self.browse(cr, uid, ids, None) |
2640 | - full=0 |
2641 | - half=0 |
2642 | - hl=0 |
2643 | + selfobject = self.browse(cr, uid, ids, None) |
2644 | + full = 0 |
2645 | + half = 0 |
2646 | + hl = 0 |
2647 | for selfobj in selfobject: |
2648 | |
2649 | - recids=self.pool.get('days.holidays.days').search(cr,uid,[('holiday_id','=', selfobj.id)]) |
2650 | + recids = self.pool.get('days.holidays.days').search( |
2651 | + cr, uid, [('holiday_id', '=', selfobj.id)]) |
2652 | |
2653 | - if recids==[]: |
2654 | - raise osv.except_osv('Day Error !','Create Day list') |
2655 | + if recids == []: |
2656 | + raise osv.except_osv('Day Error !', 'Create Day list') |
2657 | for rec in recids: |
2658 | - if self.days_chaeck(cr, uid, ids, rec): |
2659 | - recobj=self.pool.get('days.holidays.days').browse(cr,uid,rec) |
2660 | - self.pool.get('days.holidays.days').write(cr,uid,rec,{'state':'confirm'}) |
2661 | - flg=0 |
2662 | - if recobj.half_day==1: |
2663 | - half+=1 |
2664 | - flg=1 |
2665 | - if recobj.full_day==1: |
2666 | - full+=1 |
2667 | - flg=1 |
2668 | - if recobj.public_h==1: |
2669 | - flg=1 |
2670 | + if self.days_check(cr, uid, ids, rec): |
2671 | + recobj = self.pool.get( |
2672 | + 'days.holidays.days').browse(cr, uid, rec) |
2673 | + self.pool.get('days.holidays.days').write( |
2674 | + cr, uid, rec, {'state': 'confirm'}) |
2675 | + flg = 0 |
2676 | + if recobj.half_day == 1: |
2677 | + half += 1 |
2678 | + flg = 1 |
2679 | + if recobj.full_day == 1: |
2680 | + full += 1 |
2681 | + flg = 1 |
2682 | + if recobj.public_h == 1: |
2683 | + flg = 1 |
2684 | if recobj.hourly_leave > 0: |
2685 | - hl+=recobj.hourly_leave |
2686 | - flg=1 |
2687 | - if flg==0: |
2688 | - raise osv.except_osv('Leave Error !','Select Leave type') |
2689 | + hl += recobj.hourly_leave |
2690 | + flg = 1 |
2691 | + if flg == 0: |
2692 | + raise osv.except_osv( |
2693 | + 'Leave Error !', 'Select Leave type') |
2694 | else: |
2695 | return False |
2696 | |
2697 | self.write(cr, uid, ids, { |
2698 | - 'state':'confirm', |
2699 | - 'total_half':half, |
2700 | - 'total_full':full, |
2701 | - 'total_hour':hl |
2702 | - }) |
2703 | + 'state': 'confirm', |
2704 | + 'total_half': half, |
2705 | + 'total_full': full, |
2706 | + 'total_hour': hl |
2707 | + }) |
2708 | return True |
2709 | |
2710 | - |
2711 | def holidays_refuse(self, cr, uid, ids, *args): |
2712 | - |
2713 | - self.write(cr, uid, ids, {'state':'refuse'}) |
2714 | + self.write(cr, uid, ids, {'state': 'refuse'}) |
2715 | self.write_data(cr, uid, ids) |
2716 | return True |
2717 | |
2718 | - |
2719 | def holidays_cancel(self, cr, uid, ids, *args): |
2720 | - |
2721 | - self.write(cr, uid, ids, { |
2722 | - 'state':'cancel' |
2723 | - }) |
2724 | + self.write(cr, uid, ids, {'state': 'cancel'}) |
2725 | return True |
2726 | |
2727 | def holidays_draft(self, cr, uid, ids, *args): |
2728 | - self.write(cr, uid, ids, { |
2729 | - 'state':'draft' |
2730 | - }) |
2731 | - selfobj=self.browse(cr, uid, ids, None) |
2732 | + self.write(cr, uid, ids, {'state': 'draft'}) |
2733 | + selfobj = self.browse(cr, uid, ids, None) |
2734 | for s in selfobj: |
2735 | for s1 in s.holiday_id: |
2736 | - self.pool.get('days.holidays.days').write(cr,uid,s1.id,{'state':draft}) |
2737 | - |
2738 | - |
2739 | + self.pool.get('days.holidays.days').write( |
2740 | + cr, uid, s1.id, {'state': draft}) |
2741 | return True |
2742 | - |
2743 | hr_holidays() |
2744 | |
2745 | + |
2746 | class holiday_history(osv.osv): |
2747 | _name = 'hr.holidays.history' |
2748 | _description = "Holidays history" |
2749 | _columns = { |
2750 | - 'validated_id':fields.many2one('res.users', 'Validated By', readonly=True), |
2751 | - 'name' : fields.char('Description', readonly=True, size=64), |
2752 | - 'state': fields.selection([('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2753 | - 'date_from1' : fields.date('From', readonly=True), |
2754 | - 'date_to1' : fields.date('To', readonly=True), |
2755 | - 'employee_id' : fields.many2one('hr.employee','Employee',readonly=True), |
2756 | - 'user_id':fields.many2one('res.users', 'Employee_id',readonly=True), |
2757 | - 'manager_id' : fields.many2one('hr.employee', 'Holiday manager', readonly=True), |
2758 | - 'notes' : fields.text('Notes',readonly=True), |
2759 | - 'contactno':fields.char("Contact no",size=64,readonly=True), |
2760 | - 'holiday_id':fields.one2many('days.holidays.days.history','holiday_id',"Holiday's days list",readonly=True), |
2761 | - 'total_half':fields.integer("Total Half Leave", readonly=True), |
2762 | - 'total_full':fields.integer("Total Full Leave", readonly=True), |
2763 | - 'total_hour':fields.integer("Total Hours", readonly=True), |
2764 | - } |
2765 | + 'validated_id': fields.many2one('res.users', 'Validated By', readonly=True), |
2766 | + 'name': fields.char('Description', readonly=True, size=64), |
2767 | + 'state': fields.selection([('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2768 | + 'date_from1': fields.date('From', readonly=True), |
2769 | + 'date_to1': fields.date('To', readonly=True), |
2770 | + 'employee_id': fields.many2one('hr.employee', 'Employee', readonly=True), |
2771 | + 'user_id': fields.many2one('res.users', 'Employee_id', readonly=True), |
2772 | + 'manager_id': fields.many2one('hr.employee', 'Holiday manager', readonly=True), |
2773 | + 'notes': fields.text('Notes', readonly=True), |
2774 | + 'contactno': fields.char("Contact no", size=64, readonly=True), |
2775 | + 'holiday_id': fields.one2many('days.holidays.days.history', 'holiday_id', "Holiday's days list", readonly=True), |
2776 | + 'total_half': fields.integer("Total Half Leave", readonly=True), |
2777 | + 'total_full': fields.integer("Total Full Leave", readonly=True), |
2778 | + 'total_hour': fields.integer("Total Hours", readonly=True), |
2779 | + } |
2780 | holiday_history() |
2781 | |
2782 | -class holiday_days(osv.osv): |
2783 | |
2784 | - _name='days.holidays.days' |
2785 | +class holiday_days(osv.osv): |
2786 | + _name = 'days.holidays.days' |
2787 | _description = "Holidays history" |
2788 | _columns = { |
2789 | - 'name':fields.char("Date",size=64), |
2790 | - 'date1':fields.date('Date', readonly=True,required=True), |
2791 | - 'half_day' : fields.boolean('Half Leave', readonly=True,states={'draft':[('readonly',False)]}), |
2792 | - 'full_day' : fields.boolean('Full Leave', readonly=True,states={'draft':[('readonly',False)]}), |
2793 | - 'hourly_leave':fields.float("Hourly Leave", readonly=True,states={'draft':[('readonly',False)]}), |
2794 | - 'holiday_id':fields.many2one("hr.holidays","Holiday Ref"), |
2795 | - 'public_h':fields.boolean('Public Holiday',readonly=True), |
2796 | - 'holiday_status':fields.many2one("hr.holidays.status", "Holiday's Status"), |
2797 | - 'user_id':fields.many2one('res.users', 'User_id',readonly=True), |
2798 | - 'state': fields.selection([('draft1', 'draft'),('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2799 | - } |
2800 | + 'name': fields.char("Date", size=64), |
2801 | + 'date1': fields.date('Date', readonly=True, required=True), |
2802 | + 'half_day': fields.boolean('Half Leave', readonly=True, states={'draft': [('readonly', False)]}), |
2803 | + 'full_day': fields.boolean('Full Leave', readonly=True, states={'draft': [('readonly', False)]}), |
2804 | + 'hourly_leave': fields.float("Hourly Leave", readonly=True, states={'draft': [('readonly', False)]}), |
2805 | + 'holiday_id': fields.many2one("hr.holidays", "Holiday Ref"), |
2806 | + 'public_h': fields.boolean('Public Holiday', readonly=True), |
2807 | + 'holiday_status': fields.many2one("hr.holidays.status", "Holiday's Status"), |
2808 | + 'user_id': fields.many2one('res.users', 'User_id', readonly=True), |
2809 | + 'state': fields.selection([('draft1', 'draft'), ('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2810 | + } |
2811 | _order = 'date1' |
2812 | _defaults = { |
2813 | - 'state' : lambda *a: 'refuse', |
2814 | - } |
2815 | - |
2816 | - def onchange_half_day(self, cr, uid, ids, half_day,full_day,hourly_leave,public_h): |
2817 | - if public_h==1: |
2818 | - return {'value':{'full_day':1,'half_day':0,'hourly_leave':0}} |
2819 | - if half_day==1 and full_day==1: |
2820 | - full_day=0 |
2821 | - if half_day==1 and hourly_leave>0: |
2822 | - hourly_leave=0 |
2823 | - return {'value':{'full_day':full_day,'hourly_leave':hourly_leave}} |
2824 | - def onchange_full_day(self, cr, uid, ids, half_day,full_day,hourly_leave,public_h): |
2825 | - if public_h==1: |
2826 | - return {'value':{'full_day':1,'half_day':0,'hourly_leave':0}} |
2827 | - if half_day==1 and full_day==1: |
2828 | - half_day=0 |
2829 | - if half_day==1 and hourly_leave>0: |
2830 | - hourly_leave=0 |
2831 | - return {'value':{'half_day':half_day,'hourly_leave':hourly_leave}} |
2832 | - def onchange_hourly_leave(self, cr, uid, ids, half_day,full_day,hourly_leave,public_h): |
2833 | - if public_h==1: |
2834 | - return {'value':{'full_day':1,'half_day':0,'hourly_leave':0}} |
2835 | - if half_day==1 and hourly_leave>0: |
2836 | - half_day=0 |
2837 | - if full_day==1 and hourly_leave>0: |
2838 | - full_day=0 |
2839 | - return {'value':{'full_day':full_day,'half_day':half_day}} |
2840 | + 'state': lambda *a: 'refuse', |
2841 | + } |
2842 | + |
2843 | + def onchange_half_day(self, cr, uid, ids, half_day, full_day, hourly_leave, public_h): |
2844 | + if public_h == 1: |
2845 | + return {'value': {'full_day': 1, 'half_day': 0, 'hourly_leave': 0}} |
2846 | + if half_day == 1 and full_day == 1: |
2847 | + full_day = 0 |
2848 | + if half_day == 1 and hourly_leave > 0: |
2849 | + hourly_leave = 0 |
2850 | + return {'value': {'full_day': full_day, 'hourly_leave': hourly_leave}} |
2851 | + |
2852 | + def onchange_full_day(self, cr, uid, ids, half_day, full_day, hourly_leave, public_h): |
2853 | + if public_h == 1: |
2854 | + return {'value': {'full_day': 1, 'half_day': 0, 'hourly_leave': 0}} |
2855 | + if half_day == 1 and full_day == 1: |
2856 | + half_day = 0 |
2857 | + if half_day == 1 and hourly_leave > 0: |
2858 | + hourly_leave = 0 |
2859 | + return {'value': {'half_day': half_day, 'hourly_leave': hourly_leave}} |
2860 | + |
2861 | + def onchange_hourly_leave(self, cr, uid, ids, half_day, full_day, hourly_leave, public_h): |
2862 | + if public_h == 1: |
2863 | + return {'value': {'full_day': 1, 'half_day': 0, 'hourly_leave': 0}} |
2864 | + if half_day == 1 and hourly_leave > 0: |
2865 | + half_day = 0 |
2866 | + if full_day == 1 and hourly_leave > 0: |
2867 | + full_day = 0 |
2868 | + return {'value': {'full_day': full_day, 'half_day': half_day}} |
2869 | holiday_days() |
2870 | |
2871 | -class public_holiday_days(osv.osv): |
2872 | - _name='public.holidays.days' |
2873 | + |
2874 | +class public_holiday_days(osv.osv): |
2875 | + _name = 'public.holidays.days' |
2876 | _description = "Public Holidays" |
2877 | _columns = { |
2878 | - 'name':fields.date('Date',required=True), |
2879 | - 'reason':fields.text("Reason",required=True), |
2880 | - } |
2881 | + 'name': fields.date('Date', required=True), |
2882 | + 'reason': fields.text("Reason", required=True), |
2883 | + } |
2884 | public_holiday_days() |
2885 | -class holiday_days_history(osv.osv): |
2886 | + |
2887 | + |
2888 | +class holiday_days_history(osv.osv): |
2889 | + |
2890 | def _holidaystatus_get(self, cr, uid, context={}): |
2891 | obj = self.pool.get('hr.holidays.status') |
2892 | ids = obj.search(cr, uid, []) |
2893 | res = obj.read(cr, uid, ids, ['name'], context) |
2894 | res = [(r['id'], r['name']) for r in res] |
2895 | return res |
2896 | - _name='days.holidays.days.history' |
2897 | + |
2898 | + _name = 'days.holidays.days.history' |
2899 | _description = "Holidays history" |
2900 | _columns = { |
2901 | - 'name':fields.char("Date",size=64,readonly=True), |
2902 | - 'date1':fields.date('Date',readonly=True), |
2903 | - 'half_day' : fields.boolean('Half Leave',readonly=True), |
2904 | - 'full_day' : fields.boolean('Full Leave',readonly=True), |
2905 | - 'hourly_leave':fields.float("Hourly Leave",readonly=True), |
2906 | - 'holiday_id':fields.many2one("hr.holidays.history","Holiday Ref",readonly=True), |
2907 | - 'public_h':fields.boolean('Public Holiday',readonly=True), |
2908 | - 'holiday_status':fields.selection(_holidaystatus_get, "Holiday's Status",readonly=True), |
2909 | - 'user_id':fields.many2one('res.users', 'User_id',readonly=True), |
2910 | - 'state': fields.selection([('draft1', 'draft'),('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2911 | - } |
2912 | + 'name': fields.char("Date", size=64, readonly=True), |
2913 | + 'date1': fields.date('Date', readonly=True), |
2914 | + 'half_day': fields.boolean('Half Leave', readonly=True), |
2915 | + 'full_day': fields.boolean('Full Leave', readonly=True), |
2916 | + 'hourly_leave': fields.float("Hourly Leave", readonly=True), |
2917 | + 'holiday_id': fields.many2one("hr.holidays.history", "Holiday Ref", readonly=True), |
2918 | + 'public_h': fields.boolean('Public Holiday', readonly=True), |
2919 | + 'holiday_status': fields.selection(_holidaystatus_get, "Holiday's Status", readonly=True), |
2920 | + 'user_id': fields.many2one('res.users', 'User_id', readonly=True), |
2921 | + 'state': fields.selection([('draft1', 'draft'), ('draft', 'draft'), ('confirm', 'Requested'), ('refuse', 'Refused'), ('validate', 'Validate'), ('cancel', 'Cancel')], 'State', readonly=True), |
2922 | + } |
2923 | holiday_days_history() |
2924 | + |
2925 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2926 | - |
2927 | |
2928 | === modified file 'hr_holidays_request/report/__init__.py' |
2929 | --- hr_holidays_request/report/__init__.py 2009-10-15 11:25:40 +0000 |
2930 | +++ hr_holidays_request/report/__init__.py 2013-12-23 20:13:10 +0000 |
2931 | @@ -1,6 +1,6 @@ |
2932 | # -*- encoding: utf-8 -*- |
2933 | -############################################################################## |
2934 | -# |
2935 | +# |
2936 | +# |
2937 | # OpenERP, Open Source Management Solution |
2938 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2939 | # |
2940 | @@ -15,11 +15,10 @@ |
2941 | # GNU Affero General Public License for more details. |
2942 | # |
2943 | # You should have received a copy of the GNU Affero General Public License |
2944 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2945 | -# |
2946 | -############################################################################## |
2947 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2948 | +# |
2949 | +# |
2950 | |
2951 | import hr_holiday_report |
2952 | import hr_holiday_report_form |
2953 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2954 | - |
2955 | |
2956 | === modified file 'hr_holidays_request/report/hr_holiday_report.py' |
2957 | --- hr_holidays_request/report/hr_holiday_report.py 2009-10-15 11:25:40 +0000 |
2958 | +++ hr_holidays_request/report/hr_holiday_report.py 2013-12-23 20:13:10 +0000 |
2959 | @@ -1,6 +1,6 @@ |
2960 | # -*- encoding: utf-8 -*- |
2961 | -############################################################################## |
2962 | -# |
2963 | +# |
2964 | +# |
2965 | # OpenERP, Open Source Management Solution |
2966 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
2967 | # |
2968 | @@ -15,76 +15,81 @@ |
2969 | # GNU Affero General Public License for more details. |
2970 | # |
2971 | # You should have received a copy of the GNU Affero General Public License |
2972 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2973 | -# |
2974 | -############################################################################## |
2975 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2976 | +# |
2977 | +# |
2978 | import time |
2979 | from report import report_sxw |
2980 | import calendar |
2981 | import datetime |
2982 | |
2983 | + |
2984 | class hr_holiday_report(report_sxw.rml_parse): |
2985 | + |
2986 | def __init__(self, cr, uid, name, context): |
2987 | super(hr_holiday_report, self).__init__(cr, uid, name, context) |
2988 | self.localcontext.update({ |
2989 | 'time': time, |
2990 | - 'line' : self._getShop, |
2991 | - |
2992 | + 'line': self._getShop, |
2993 | + |
2994 | }) |
2995 | - def _getShop(self,form): |
2996 | + |
2997 | + def _getShop(self, form): |
2998 | if form['active1']: |
2999 | - startdate=str(datetime.date(form['year'],form['month'],1)) |
3000 | - a=calendar.monthrange(form['year'],form['month']) |
3001 | - enddate=str(datetime.date(form['year'],form['month'],a[1])) |
3002 | - |
3003 | + startdate = str(datetime.date(form['year'], form['month'], 1)) |
3004 | + a = calendar.monthrange(form['year'], form['month']) |
3005 | + enddate = str(datetime.date(form['year'], form['month'], a[1])) |
3006 | + |
3007 | elif form['active2']: |
3008 | - |
3009 | - startdate=form['fromdate'] |
3010 | - enddate=form['todate'] |
3011 | - ls=[] |
3012 | - res={} |
3013 | - half=0 |
3014 | - full=0 |
3015 | - hl=0 |
3016 | - total=0.0 |
3017 | + |
3018 | + startdate = form['fromdate'] |
3019 | + enddate = form['todate'] |
3020 | + ls = [] |
3021 | + res = {} |
3022 | + half = 0 |
3023 | + full = 0 |
3024 | + hl = 0 |
3025 | + total = 0.0 |
3026 | for li in form['emp_ids'][0][2]: |
3027 | hr_pool = self.pool.get('hr.holidays') |
3028 | day_pool = self.pool.get('days.holidays.days') |
3029 | - hr_ids = hr_pool.search(self.cr,self.uid,[('employee_id', '=',li)]) |
3030 | + hr_ids = hr_pool.search( |
3031 | + self.cr, self.uid, [('employee_id', '=', li)]) |
3032 | for hrid in hr_ids: |
3033 | - hr_obj=hr_pool.browse(self.cr,self.uid,hrid) |
3034 | - day_ids = day_pool.search(self.cr,self.uid,[('holiday_id', '=',hrid)]) |
3035 | + hr_obj = hr_pool.browse(self.cr, self.uid, hrid) |
3036 | + day_ids = day_pool.search( |
3037 | + self.cr, self.uid, [('holiday_id', '=', hrid)]) |
3038 | for did in day_ids: |
3039 | - day_obj=day_pool.browse(self.cr,self.uid,did) |
3040 | - if day_obj.date1>=startdate and day_obj.date1<=enddate and hr_obj.state=='validate': |
3041 | - if day_obj.half_day==1: |
3042 | - half+=1 |
3043 | - if day_obj.full_day==1: |
3044 | - full+=1 |
3045 | + day_obj = day_pool.browse(self.cr, self.uid, did) |
3046 | + if day_obj.date1 >= startdate and day_obj.date1 <= enddate and hr_obj.state == 'validate': |
3047 | + if day_obj.half_day == 1: |
3048 | + half += 1 |
3049 | + if day_obj.full_day == 1: |
3050 | + full += 1 |
3051 | if day_obj.hourly_leave > 0: |
3052 | - hl+=day_obj.hourly_leave |
3053 | - emp=self.pool.get('hr.employee').browse(self.cr,self.uid,li) |
3054 | - user=self.pool.get('res.users').browse(self.cr,self.uid,emp.user_id.id) |
3055 | - res['emp_name']=emp.name |
3056 | - res['total_full']=full |
3057 | - res['total_half']=half |
3058 | - res['total_hour']=hl |
3059 | - res['user_name']=user.login |
3060 | - total+=full |
3061 | - total+=(float(half)/float(2)) |
3062 | - total+=(float(hl)/float(8)) |
3063 | - res['total']=total |
3064 | - total=0.0 |
3065 | - half=0 |
3066 | - full=0 |
3067 | - hl=0 |
3068 | + hl += day_obj.hourly_leave |
3069 | + emp = self.pool.get('hr.employee').browse(self.cr, self.uid, li) |
3070 | + user = self.pool.get('res.users').browse( |
3071 | + self.cr, self.uid, emp.user_id.id) |
3072 | + res['emp_name'] = emp.name |
3073 | + res['total_full'] = full |
3074 | + res['total_half'] = half |
3075 | + res['total_hour'] = hl |
3076 | + res['user_name'] = user.login |
3077 | + total += full |
3078 | + total += (float(half) / float(2)) |
3079 | + total += (float(hl) / float(8)) |
3080 | + res['total'] = total |
3081 | + total = 0.0 |
3082 | + half = 0 |
3083 | + full = 0 |
3084 | + hl = 0 |
3085 | ls.append(res) |
3086 | - res={} |
3087 | - |
3088 | + res = {} |
3089 | + |
3090 | return ls |
3091 | - |
3092 | - |
3093 | - |
3094 | -report_sxw.report_sxw('report.hr.holiday.req.report', 'hr.holidays', 'addons/hr_holidays_request/report/hrreport.rml' ,parser=hr_holiday_report) |
3095 | + |
3096 | + |
3097 | +report_sxw.report_sxw('report.hr.holiday.req.report', 'hr.holidays', |
3098 | + 'addons/hr_holidays_request/report/hrreport.rml', parser=hr_holiday_report) |
3099 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3100 | - |
3101 | |
3102 | === modified file 'hr_holidays_request/report/hr_holiday_report_form.py' |
3103 | --- hr_holidays_request/report/hr_holiday_report_form.py 2009-10-15 11:25:40 +0000 |
3104 | +++ hr_holidays_request/report/hr_holiday_report_form.py 2013-12-23 20:13:10 +0000 |
3105 | @@ -1,6 +1,6 @@ |
3106 | # -*- encoding: utf-8 -*- |
3107 | -############################################################################## |
3108 | -# |
3109 | +# |
3110 | +# |
3111 | # OpenERP, Open Source Management Solution |
3112 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3113 | # |
3114 | @@ -15,66 +15,74 @@ |
3115 | # GNU Affero General Public License for more details. |
3116 | # |
3117 | # You should have received a copy of the GNU Affero General Public License |
3118 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3119 | -# |
3120 | -############################################################################## |
3121 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3122 | +# |
3123 | +# |
3124 | import time |
3125 | from report import report_sxw |
3126 | import calendar |
3127 | import datetime |
3128 | |
3129 | + |
3130 | class hr_holiday_report_form(report_sxw.rml_parse): |
3131 | + |
3132 | def __init__(self, cr, uid, name, context): |
3133 | super(hr_holiday_report_form, self).__init__(cr, uid, name, context) |
3134 | - self.half=0 |
3135 | - self.hl=0 |
3136 | + self.half = 0 |
3137 | + self.hl = 0 |
3138 | self.localcontext.update({ |
3139 | 'time': time, |
3140 | - 'total_days':self._total_days, |
3141 | - 'total_full':self._total_full, |
3142 | - 'total_half':self._total_half, |
3143 | - 'total_hourly':self._total_hourly, |
3144 | - |
3145 | + 'total_days': self._total_days, |
3146 | + 'total_full': self._total_full, |
3147 | + 'total_half': self._total_half, |
3148 | + 'total_hourly': self._total_hourly, |
3149 | + |
3150 | }) |
3151 | - def _total_days(self,full,half,hours): |
3152 | - total=0.0 |
3153 | - total+=full |
3154 | - total+=(float(half)/float(2)) |
3155 | - total+=(float(hours)/float(8)) |
3156 | + |
3157 | + def _total_days(self, full, half, hours): |
3158 | + total = 0.0 |
3159 | + total += full |
3160 | + total += (float(half) / float(2)) |
3161 | + total += (float(hours) / float(8)) |
3162 | return total |
3163 | - def _total_full(self,object,emp): |
3164 | - lst=object.date_from1.split('-') |
3165 | - |
3166 | - year=int(lst[0]) |
3167 | - month=int(lst[1]) |
3168 | - startdate=str(datetime.date(year,month,1)) |
3169 | - a=calendar.monthrange(year,month) |
3170 | - enddate=str(datetime.date(year,month,a[1])) |
3171 | - self.half=0 |
3172 | - full=0 |
3173 | - self.hl=0 |
3174 | + |
3175 | + def _total_full(self, object, emp): |
3176 | + lst = object.date_from1.split('-') |
3177 | + |
3178 | + year = int(lst[0]) |
3179 | + month = int(lst[1]) |
3180 | + startdate = str(datetime.date(year, month, 1)) |
3181 | + a = calendar.monthrange(year, month) |
3182 | + enddate = str(datetime.date(year, month, a[1])) |
3183 | + self.half = 0 |
3184 | + full = 0 |
3185 | + self.hl = 0 |
3186 | hr_pool = self.pool.get('hr.holidays') |
3187 | day_pool = self.pool.get('days.holidays.days') |
3188 | - hr_ids = hr_pool.search(self.cr,self.uid,[('employee_id', '=',emp.id)]) |
3189 | + hr_ids = hr_pool.search( |
3190 | + self.cr, self.uid, [('employee_id', '=', emp.id)]) |
3191 | for hrid in hr_ids: |
3192 | - if hrid==object.id: |
3193 | + if hrid == object.id: |
3194 | continue |
3195 | - hr_obj=hr_pool.browse(self.cr,self.uid,hrid) |
3196 | - day_ids = day_pool.search(self.cr,self.uid,[('holiday_id', '=',hrid)]) |
3197 | + hr_obj = hr_pool.browse(self.cr, self.uid, hrid) |
3198 | + day_ids = day_pool.search( |
3199 | + self.cr, self.uid, [('holiday_id', '=', hrid)]) |
3200 | for did in day_ids: |
3201 | - day_obj=day_pool.browse(self.cr,self.uid,did) |
3202 | - if day_obj.date1>=startdate and day_obj.date1<=enddate and hr_obj.state=='validate': |
3203 | - if day_obj.half_day==1: |
3204 | - self.half+=1 |
3205 | - if day_obj.full_day==1: |
3206 | - full+=1 |
3207 | + day_obj = day_pool.browse(self.cr, self.uid, did) |
3208 | + if day_obj.date1 >= startdate and day_obj.date1 <= enddate and hr_obj.state == 'validate': |
3209 | + if day_obj.half_day == 1: |
3210 | + self.half += 1 |
3211 | + if day_obj.full_day == 1: |
3212 | + full += 1 |
3213 | if day_obj.hourly_leave > 0: |
3214 | - self.hl+=day_obj.hourly_leave |
3215 | + self.hl += day_obj.hourly_leave |
3216 | return full |
3217 | - def _total_half(self,object,emp): |
3218 | + |
3219 | + def _total_half(self, object, emp): |
3220 | return self.half |
3221 | - def _total_hourly(self,object,emp): |
3222 | + |
3223 | + def _total_hourly(self, object, emp): |
3224 | return self.hl |
3225 | -report_sxw.report_sxw('report.hr_holiday_report_form', 'hr.holidays', 'addons/hr_holidays_request/report/hrreport_form.rml' ,parser=hr_holiday_report_form) |
3226 | +report_sxw.report_sxw('report.hr_holiday_report_form', 'hr.holidays', |
3227 | + 'addons/hr_holidays_request/report/hrreport_form.rml', parser=hr_holiday_report_form) |
3228 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3229 | - |
3230 | |
3231 | === modified file 'hr_holidays_request/wizard/__init__.py' |
3232 | --- hr_holidays_request/wizard/__init__.py 2009-10-15 11:25:40 +0000 |
3233 | +++ hr_holidays_request/wizard/__init__.py 2013-12-23 20:13:10 +0000 |
3234 | @@ -1,6 +1,6 @@ |
3235 | # -*- encoding: utf-8 -*- |
3236 | -############################################################################## |
3237 | -# |
3238 | +# |
3239 | +# |
3240 | # OpenERP, Open Source Management Solution |
3241 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3242 | # |
3243 | @@ -15,9 +15,8 @@ |
3244 | # GNU Affero General Public License for more details. |
3245 | # |
3246 | # You should have received a copy of the GNU Affero General Public License |
3247 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3248 | -# |
3249 | -############################################################################## |
3250 | -import hr_holiday |
3251 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3252 | +# |
3253 | +# |
3254 | +from . import hr_holiday |
3255 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3256 | - |
3257 | |
3258 | === modified file 'hr_holidays_request/wizard/hr_holiday.py' |
3259 | --- hr_holidays_request/wizard/hr_holiday.py 2009-10-15 11:25:40 +0000 |
3260 | +++ hr_holidays_request/wizard/hr_holiday.py 2013-12-23 20:13:10 +0000 |
3261 | @@ -1,6 +1,6 @@ |
3262 | # -*- encoding: utf-8 -*- |
3263 | -############################################################################## |
3264 | -# |
3265 | +# |
3266 | +# |
3267 | # OpenERP, Open Source Management Solution |
3268 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
3269 | # |
3270 | @@ -15,12 +15,14 @@ |
3271 | # GNU Affero General Public License for more details. |
3272 | # |
3273 | # You should have received a copy of the GNU Affero General Public License |
3274 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3275 | -# |
3276 | -############################################################################## |
3277 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3278 | +# |
3279 | +# |
3280 | + |
3281 | +from osv import osv |
3282 | import time |
3283 | -import wizard |
3284 | import datetime |
3285 | + |
3286 | error = '''<?xml version="1.0"?> |
3287 | <form string="Select period"> |
3288 | <label string="Error in Data !!"/> |
3289 | @@ -50,72 +52,78 @@ |
3290 | <field name="todate"/> |
3291 | </group> |
3292 | </form>''' |
3293 | + |
3294 | + |
3295 | def _get_months(sel, cr, uid, context): |
3296 | - i=0 |
3297 | - res=[] |
3298 | - while i<12: |
3299 | - t=() |
3300 | - t=(i+1,i+1) |
3301 | + i = 0 |
3302 | + res = [] |
3303 | + while i < 12: |
3304 | + t = () |
3305 | + t = (i + 1, i + 1) |
3306 | res.append(t) |
3307 | - i+=1 |
3308 | + i += 1 |
3309 | return res |
3310 | + |
3311 | field1 = { |
3312 | - 'emp_ids': {'string':'Employees', 'type':'many2many', 'relation':'hr.employee'}, |
3313 | - 'month': {'string':'Month','type':'selection', 'selection':_get_months}, |
3314 | - 'year':{'string':'Year','type':'integer'}, |
3315 | - 'fromdate': {'string':'From', 'type':'date'}, |
3316 | - 'todate': {'string':'To', 'type':'date'}, |
3317 | - 'active1':{'string':'Month Wise','type':'boolean'}, |
3318 | - 'active2':{'string':'Date Wise','type':'boolean'} |
3319 | + 'emp_ids': {'string': 'Employees', 'type': 'many2many', 'relation': 'hr.employee'}, |
3320 | + 'month': {'string': 'Month', 'type': 'selection', 'selection': _get_months}, |
3321 | + 'year': {'string': 'Year', 'type': 'integer'}, |
3322 | + 'fromdate': {'string': 'From', 'type': 'date'}, |
3323 | + 'todate': {'string': 'To', 'type': 'date'}, |
3324 | + 'active1': {'string': 'Month Wise', 'type': 'boolean'}, |
3325 | + 'active2': {'string': 'Date Wise', 'type': 'boolean'} |
3326 | } |
3327 | |
3328 | |
3329 | -class hr_holidays_report(wizard.interface): |
3330 | +class hr_holidays_report(osv.osv_memory): |
3331 | + |
3332 | def year_get(self, cr, uid, data, context): |
3333 | - p=int(time.strftime('%Y')) |
3334 | - return {'year':p} |
3335 | - def _riase_error(self, cr, uid, data, context): |
3336 | - form=data['form'] |
3337 | - if not form['emp_ids'][0][2] : |
3338 | - raise wizard.except_wizard('Error', 'You must select Employee(s) For report !') |
3339 | - |
3340 | + p = int(time.strftime('%Y')) |
3341 | + return {'year': p} |
3342 | + |
3343 | + def _raise_error(self, cr, uid, data, context): |
3344 | + form = data['form'] |
3345 | + if not form['emp_ids'][0][2]: |
3346 | + raise osv.except_osv( |
3347 | + 'Error', 'You must select Employee(s) for report !') |
3348 | if form['active1'] and form['active2']: |
3349 | - raise wizard.except_wizard('TyepError', 'You must select only one type For report !') |
3350 | + raise osv.except_osv( |
3351 | + 'TyepError', 'You must select only one type for report !') |
3352 | if form['active1']: |
3353 | - temp=form['year'] |
3354 | + temp = form['year'] |
3355 | if not form['month']: |
3356 | - raise wizard.except_wizard('MonthError', 'You must select month For month-wise report !') |
3357 | - |
3358 | - |
3359 | + raise osv.except_osv( |
3360 | + 'MonthError', 'You must select month for month-wise report !') |
3361 | elif form['active2']: |
3362 | - temp=0 |
3363 | + temp = 0 |
3364 | if not form['fromdate'] or not form['todate']: |
3365 | - raise wizard.except_wizard('DateError', 'You must select Dates For date-wise report !') |
3366 | + raise osv.except_osv( |
3367 | + 'DateError', 'You must select Dates for date-wise report !') |
3368 | else: |
3369 | - d=form['fromdate'] |
3370 | - dd=form['todate'] |
3371 | - d1=d.split('-') |
3372 | - d2=dd.split('-') |
3373 | - d1[2]=d1[2].split(' ') |
3374 | - d2[2]=d2[2].split(' ') |
3375 | - a=datetime.date(int(d1[0]),int(d1[1]),int(d1[2][0])) |
3376 | - b=datetime.date(int(d2[0]),int(d2[1]),int(d2[2][0])) |
3377 | - if a>b : |
3378 | - raise wizard.except_wizard('DateError', 'You must select Dates proparly !') |
3379 | + d = form['fromdate'] |
3380 | + dd = form['todate'] |
3381 | + d1 = d.split('-') |
3382 | + d2 = dd.split('-') |
3383 | + d1[2] = d1[2].split(' ') |
3384 | + d2[2] = d2[2].split(' ') |
3385 | + a = datetime.date(int(d1[0]), int(d1[1]), int(d1[2][0])) |
3386 | + b = datetime.date(int(d2[0]), int(d2[1]), int(d2[2][0])) |
3387 | + if a > b: |
3388 | + raise osv.except_osv( |
3389 | + 'DateError', 'You must select Dates properly !') |
3390 | else: |
3391 | - raise wizard.except_wizard('typeError', 'You must select Type !') |
3392 | - return {'year':temp} |
3393 | + raise osv.except_osv('typeError', 'You must select Type !') |
3394 | + return {'year': temp} |
3395 | states = { |
3396 | 'init': { |
3397 | 'actions': [year_get], |
3398 | - 'result': {'type':'form', 'arch':form1, 'fields':field1, 'state' : [('print', 'Ok'),('end', 'Cancel')]} |
3399 | + 'result': {'type': 'form', 'arch': form1, 'fields': field1, 'state': [('print', 'Ok'), ('end', 'Cancel')]} |
3400 | }, |
3401 | - 'print': { |
3402 | - 'actions': [_riase_error], |
3403 | - 'result': {'type':'print', 'report':'hr.holiday.req.report','state':'end'} |
3404 | + 'print': { |
3405 | + 'actions': [_raise_error], |
3406 | + 'result': {'type': 'print', 'report': 'hr.holiday.req.report', 'state': 'end'} |
3407 | } |
3408 | - |
3409 | } |
3410 | hr_holidays_report('hr_holiday_req') |
3411 | + |
3412 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3413 | - |
3414 | |
3415 | === modified file 'hr_holidays_type/__init__.py' |
3416 | --- hr_holidays_type/__init__.py 2010-05-10 05:14:44 +0000 |
3417 | +++ hr_holidays_type/__init__.py 2013-12-23 20:13:10 +0000 |
3418 | @@ -1,5 +1,5 @@ |
3419 | # -*- coding: utf-8 -*- |
3420 | -############################################################################## |
3421 | +# |
3422 | # |
3423 | # OpenERP, Open Source Management Solution |
3424 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
3425 | @@ -17,7 +17,7 @@ |
3426 | # You should have received a copy of the GNU Affero General Public License |
3427 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3428 | # |
3429 | -############################################################################## |
3430 | +# |
3431 | |
3432 | import hr_holidays_type |
3433 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3434 | \ No newline at end of file |
3435 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3436 | |
3437 | === renamed file 'hr_holidays_type/__terp__.py' => 'hr_holidays_type/__openerp__.py' |
3438 | --- hr_holidays_type/__terp__.py 2010-05-10 05:14:44 +0000 |
3439 | +++ hr_holidays_type/__openerp__.py 2013-12-23 20:13:10 +0000 |
3440 | @@ -1,5 +1,5 @@ |
3441 | # -*- coding: utf-8 -*- |
3442 | -############################################################################## |
3443 | +# |
3444 | # |
3445 | # OpenERP, Open Source Management Solution |
3446 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
3447 | @@ -17,23 +17,21 @@ |
3448 | # You should have received a copy of the GNU Affero General Public License |
3449 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3450 | # |
3451 | -############################################################################## |
3452 | - |
3453 | +# |
3454 | |
3455 | |
3456 | { |
3457 | - "name" : "Human Resources: Holidays management", |
3458 | - "version" : "0.1", |
3459 | - "author" : "Tiny", |
3460 | - "category" : "Generic Modules/Human Resources", |
3461 | - "website" : "http://www.openerp.com/", |
3462 | + "name": "Human Resources: Holidays management", |
3463 | + "version": "0.1", |
3464 | + "author": "Tiny", |
3465 | + "category": "Generic Modules/Human Resources", |
3466 | + "website": "http://www.openerp.com/", |
3467 | "description": """ One request for different Leave type """, |
3468 | - "depends" : ["hr_holidays"], |
3469 | - "init_xml" : [], |
3470 | - "demo_xml" : [], |
3471 | - "update_xml" : ["hr_holidays_type_view.xml"], |
3472 | + "depends": ["hr_holidays"], |
3473 | + "init_xml": [], |
3474 | + "demo_xml": [], |
3475 | + "update_xml": ["hr_holidays_type_view.xml"], |
3476 | "active": False, |
3477 | "installable": True |
3478 | } |
3479 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3480 | - |
3481 | |
3482 | === modified file 'hr_holidays_type/hr_holidays_type.py' |
3483 | --- hr_holidays_type/hr_holidays_type.py 2010-05-10 05:14:44 +0000 |
3484 | +++ hr_holidays_type/hr_holidays_type.py 2013-12-23 20:13:10 +0000 |
3485 | @@ -1,5 +1,5 @@ |
3486 | # -*- coding: utf-8 -*- |
3487 | -############################################################################## |
3488 | +# |
3489 | # |
3490 | # OpenERP, Open Source Management Solution |
3491 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
3492 | @@ -17,12 +17,13 @@ |
3493 | # You should have received a copy of the GNU Affero General Public License |
3494 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3495 | # |
3496 | -############################################################################## |
3497 | +# |
3498 | import time |
3499 | |
3500 | from osv import fields, osv |
3501 | from tools.translate import _ |
3502 | |
3503 | + |
3504 | class hr_holidays_status(osv.osv): |
3505 | _inherit = "hr.holidays.status" |
3506 | |
3507 | @@ -32,13 +33,15 @@ |
3508 | res[record.id] = {} |
3509 | max_leaves = leaves_taken = 0 |
3510 | if not return_false: |
3511 | - cr.execute("""SELECT type, sum(number_of_days) FROM hr_holidays WHERE employee_id = %s AND state='validate' AND holiday_status_id = %s and type='add' GROUP BY type""", (str(employee_id), str(record.id))) |
3512 | + cr.execute("""SELECT type, sum(number_of_days) FROM hr_holidays WHERE employee_id = %s AND state='validate' AND holiday_status_id = %s and type='add' GROUP BY type""", ( |
3513 | + str(employee_id), str(record.id))) |
3514 | for line in cr.fetchall(): |
3515 | - if line[0] =='add': |
3516 | + if line[0] == 'add': |
3517 | max_leaves = line[1] |
3518 | - cr.execute("""SELECT type, sum(h.number_of_days) from hr_holidays as h left join hr_holidays_line as t on t.holiday_id=h.id where employee_id = %s AND state='validate' AND t.holiday_status_id = %s and type='remove' GROUP BY type""",(str(employee_id), str(record.id))) |
3519 | + cr.execute("""SELECT type, sum(h.number_of_days) from hr_holidays as h left join hr_holidays_line as t on t.holiday_id=h.id where employee_id = %s AND state='validate' AND t.holiday_status_id = %s and type='remove' GROUP BY type""", ( |
3520 | + str(employee_id), str(record.id))) |
3521 | for line in cr.fetchall(): |
3522 | - if line[0] =='remove': |
3523 | + if line[0] == 'remove': |
3524 | leaves_taken = -line[1] |
3525 | res[record.id]['max_leaves'] = max_leaves |
3526 | res[record.id]['leaves_taken'] = leaves_taken |
3527 | @@ -47,6 +50,7 @@ |
3528 | |
3529 | hr_holidays_status() |
3530 | |
3531 | + |
3532 | class hr_holidays_line(osv.osv): |
3533 | _name = 'hr.holidays.line' |
3534 | _description = 'hr.holidays.line' |
3535 | @@ -56,27 +60,29 @@ |
3536 | 'date_to': fields.datetime('End Date'), |
3537 | 'number_of_days': fields.float('Number of Days'), |
3538 | 'holiday_id': fields.many2one('hr.holidays', 'Holiday'), |
3539 | - } |
3540 | + } |
3541 | |
3542 | def onchange_sec_id(self, cr, uid, ids, status, context={}): |
3543 | warning = {} |
3544 | if status: |
3545 | - brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status])[0] |
3546 | + brows_obj = self.pool.get( |
3547 | + 'hr.holidays.status').browse(cr, uid, [status])[0] |
3548 | if brows_obj.categ_id and brows_obj.categ_id.section_id and not brows_obj.categ_id.section_id.allow_unlink: |
3549 | warning = { |
3550 | 'title': "Warning for ", |
3551 | 'message': "You won\'t be able to cancel this leave request because the CRM Section of the leave type disallows." |
3552 | - } |
3553 | + } |
3554 | return {'warning': warning} |
3555 | |
3556 | def onchange_date_from(self, cr, uid, ids, date_to, date_from): |
3557 | result = {} |
3558 | if date_to and date_from: |
3559 | - from_dt = time.mktime(time.strptime(date_from,'%Y-%m-%d %H:%M:%S')) |
3560 | - to_dt = time.mktime(time.strptime(date_to,'%Y-%m-%d %H:%M:%S')) |
3561 | - diff_day = (to_dt-from_dt)/(3600*24) |
3562 | + from_dt = time.mktime( |
3563 | + time.strptime(date_from, '%Y-%m-%d %H:%M:%S')) |
3564 | + to_dt = time.mktime(time.strptime(date_to, '%Y-%m-%d %H:%M:%S')) |
3565 | + diff_day = (to_dt - from_dt) / (3600 * 24) |
3566 | result['value'] = { |
3567 | - 'number_of_days': round(diff_day)+1 |
3568 | + 'number_of_days': round(diff_day) + 1 |
3569 | } |
3570 | return result |
3571 | result['value'] = { |
3572 | @@ -87,11 +93,12 @@ |
3573 | def onchange_date_to(self, cr, uid, ids, date_from, date_to): |
3574 | result = {} |
3575 | if date_from and date_to: |
3576 | - from_dt = time.mktime(time.strptime(date_from,'%Y-%m-%d %H:%M:%S')) |
3577 | - to_dt = time.mktime(time.strptime(date_to,'%Y-%m-%d %H:%M:%S')) |
3578 | - diff_day = (to_dt-from_dt)/(3600*24) |
3579 | + from_dt = time.mktime( |
3580 | + time.strptime(date_from, '%Y-%m-%d %H:%M:%S')) |
3581 | + to_dt = time.mktime(time.strptime(date_to, '%Y-%m-%d %H:%M:%S')) |
3582 | + diff_day = (to_dt - from_dt) / (3600 * 24) |
3583 | result['value'] = { |
3584 | - 'number_of_days': round(diff_day)+1 |
3585 | + 'number_of_days': round(diff_day) + 1 |
3586 | } |
3587 | return result |
3588 | result['value'] = { |
3589 | @@ -101,139 +108,158 @@ |
3590 | |
3591 | hr_holidays_line() |
3592 | |
3593 | + |
3594 | class hr_holidays(osv.osv): |
3595 | _inherit = 'hr.holidays' |
3596 | _description = 'hr.holidays' |
3597 | _columns = { |
3598 | - 'date_from' : fields.datetime('Start Date', readonly=False, states={'draft':[('readonly',False)]}), |
3599 | - 'date_to' : fields.datetime('End Date', readonly=False, states={'draft':[('readonly',False)]}), |
3600 | + 'date_from': fields.datetime('Start Date', readonly=False, states={'draft': [('readonly', False)]}), |
3601 | + 'date_to': fields.datetime('End Date', readonly=False, states={'draft': [('readonly', False)]}), |
3602 | 'holiday_line': fields.one2many('hr.holidays.line', 'holiday_id', 'Holidays Line'), |
3603 | - 'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type", required=False,readonly=False, states={'draft':[('readonly',False)]}), |
3604 | - } |
3605 | + 'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=False, readonly=False, states={'draft': [('readonly', False)]}), |
3606 | + } |
3607 | |
3608 | def check_holidays(self, cr, uid, ids): |
3609 | for record in self.browse(cr, uid, ids): |
3610 | if not record.number_of_days: |
3611 | - raise osv.except_osv(_('Warning!'),_('Wrong leave definition.')) |
3612 | - if record.holiday_type=='employee' and record.employee_id: |
3613 | - for i in record.holiday_line: |
3614 | - leave_asked = -(i.number_of_days) |
3615 | -# leave_asked = record.number_of_days |
3616 | - if leave_asked < 0.00: |
3617 | - if not i.holiday_status_id.limit: |
3618 | - leaves_rest = self.pool.get('hr.holidays.status').get_days(cr, uid, [i.holiday_status_id.id], record.employee_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3619 | - if leaves_rest < -(leave_asked): |
3620 | - raise osv.except_osv(_('Warning!'),_('You Cannot Validate leaves while available leaves are less than asked leaves for %s' %(i.holiday_status_id.name))) |
3621 | - elif record.holiday_type=='category' and record.category_id: |
3622 | -# leave_asked = record.number_of_days |
3623 | - for i in record.holiday_line: |
3624 | - leave_asked = -(i.number_of_days) |
3625 | - if leave_asked < 0.00: |
3626 | - if not i.holiday_status_id.limit: |
3627 | - leaves_rest = self.pool.get('hr.holidays.status').get_days_cat(cr, uid, [i.holiday_status_id.id], record.category_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3628 | - if leaves_rest < -(leave_asked): |
3629 | - raise osv.except_osv(_('Warning!'),_('You Cannot Validate leaves while available leaves are less than asked leaves for %s'%(i.holiday_status_id.name))) |
3630 | - else:# This condition will never meet!! # check me |
3631 | + raise osv.except_osv( |
3632 | + _('Warning!'), _('Wrong leave definition.')) |
3633 | + if record.holiday_type == 'employee' and record.employee_id: |
3634 | + for i in record.holiday_line: |
3635 | + leave_asked = -(i.number_of_days) |
3636 | +# leave_asked = record.number_of_days |
3637 | + if leave_asked < 0.00: |
3638 | + if not i.holiday_status_id.limit: |
3639 | + leaves_rest = self.pool.get('hr.holidays.status').get_days( |
3640 | + cr, uid, [i.holiday_status_id.id], record.employee_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3641 | + if leaves_rest < -(leave_asked): |
3642 | + raise osv.except_osv( |
3643 | + _('Warning!'), _('You Cannot Validate leaves while available leaves are less than asked leaves for %s' % (i.holiday_status_id.name))) |
3644 | + elif record.holiday_type == 'category' and record.category_id: |
3645 | +# leave_asked = record.number_of_days |
3646 | + for i in record.holiday_line: |
3647 | + leave_asked = -(i.number_of_days) |
3648 | + if leave_asked < 0.00: |
3649 | + if not i.holiday_status_id.limit: |
3650 | + leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( |
3651 | + cr, uid, [i.holiday_status_id.id], record.category_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3652 | + if leaves_rest < -(leave_asked): |
3653 | + raise osv.except_osv( |
3654 | + _('Warning!'), _('You Cannot Validate leaves while available leaves are less than asked leaves for %s' % (i.holiday_status_id.name))) |
3655 | + else: # This condition will never meet!! # check me |
3656 | for i in record.holiday_line: |
3657 | holiday_ids = [] |
3658 | vals = { |
3659 | - 'name' : record.name, |
3660 | - 'holiday_status_id' : i.holiday_status_id.id, |
3661 | + 'name': record.name, |
3662 | + 'holiday_status_id': i.holiday_status_id.id, |
3663 | 'state': 'draft', |
3664 | - 'date_from' : i.date_from, |
3665 | - 'date_to' : i.date_to, |
3666 | - 'notes' : record.notes, |
3667 | + 'date_from': i.date_from, |
3668 | + 'date_to': i.date_to, |
3669 | + 'notes': record.notes, |
3670 | 'number_of_days': i.number_of_days, |
3671 | 'number_of_days_temp': i.number_of_days, |
3672 | 'type': record.type, |
3673 | 'allocation_type': record.allocation_type, |
3674 | 'parent_id': record.id, |
3675 | } |
3676 | - employee_ids = self.pool.get('hr.employee').search(cr, uid, []) |
3677 | + employee_ids = self.pool.get( |
3678 | + 'hr.employee').search(cr, uid, []) |
3679 | for employee in employee_ids: |
3680 | vals['employee_id'] = employee |
3681 | - user_id = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)]) |
3682 | + user_id = self.pool.get('hr.employee').search( |
3683 | + cr, uid, [('user_id', '=', uid)]) |
3684 | if user_id: |
3685 | vals['user_id'] = user_id[0] |
3686 | - holiday_ids.append(self.create(cr, uid, vals, context={})) |
3687 | + holiday_ids.append( |
3688 | + self.create(cr, uid, vals, context={})) |
3689 | self.holidays_confirm(cr, uid, holiday_ids) |
3690 | self.holidays_validate(cr, uid, holiday_ids) |
3691 | |
3692 | - #if record.holiday_status_id.categ_id and record.date_from and record.date_to and record.employee_id: |
3693 | + # if record.holiday_status_id.categ_id and record.date_from and |
3694 | + # record.date_to and record.employee_id: |
3695 | for i in record.holiday_line: |
3696 | if i.holiday_status_id.categ_id and i.date_from and i.date_to: |
3697 | - vals={} |
3698 | - vals['name']=record.name |
3699 | - vals['categ_id']=i.holiday_status_id.categ_id.id |
3700 | - epoch_c = time.mktime(time.strptime(i.date_to,'%Y-%m-%d %H:%M:%S')) |
3701 | - epoch_d = time.mktime(time.strptime(i.date_from,'%Y-%m-%d %H:%M:%S')) |
3702 | - diff_day = (epoch_c - epoch_d)/(3600*24) |
3703 | + vals = {} |
3704 | + vals['name'] = record.name |
3705 | + vals['categ_id'] = i.holiday_status_id.categ_id.id |
3706 | + epoch_c = time.mktime( |
3707 | + time.strptime(i.date_to, '%Y-%m-%d %H:%M:%S')) |
3708 | + epoch_d = time.mktime( |
3709 | + time.strptime(i.date_from, '%Y-%m-%d %H:%M:%S')) |
3710 | + diff_day = (epoch_c - epoch_d) / (3600 * 24) |
3711 | vals['duration'] = (diff_day) * 8 |
3712 | vals['note'] = record.notes |
3713 | # vals['user_id'] = record.user_id.id |
3714 | vals['date'] = i.date_from |
3715 | - if record.holiday_type=='employee': |
3716 | + if record.holiday_type == 'employee': |
3717 | vals['user_id'] = record.user_id.id |
3718 | - case_id = self.pool.get('crm.meeting').create(cr,uid,vals) |
3719 | - self.write(cr, uid, ids, {'case_id':case_id}) |
3720 | + case_id = self.pool.get( |
3721 | + 'crm.meeting').create(cr, uid, vals) |
3722 | + self.write(cr, uid, ids, {'case_id': case_id}) |
3723 | return True |
3724 | |
3725 | def holidays_validate(self, cr, uid, ids, *args): |
3726 | self.check_holidays(cr, uid, ids) |
3727 | vals = { |
3728 | - 'state':'validate', |
3729 | + 'state': 'validate', |
3730 | } |
3731 | - ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) |
3732 | + ids2 = self.pool.get('hr.employee').search( |
3733 | + cr, uid, [('user_id', '=', uid)]) |
3734 | if ids2: |
3735 | vals['manager_id'] = ids2[0] |
3736 | else: |
3737 | - raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.')) |
3738 | + raise osv.except_osv( |
3739 | + _('Warning !'), _('No user related to the selected employee.')) |
3740 | self.write(cr, uid, ids, vals) |
3741 | for record in self.browse(cr, uid, ids): |
3742 | for i in record.holiday_line: |
3743 | - if record.holiday_type=='employee' and record.type=='remove': |
3744 | - vals= { |
3745 | - 'name':record.name, |
3746 | - 'date_from':i.date_from, |
3747 | - 'date_to':i.date_to, |
3748 | - 'calendar_id':record.employee_id.calendar_id.id, |
3749 | - 'company_id':record.employee_id.company_id.id, |
3750 | - 'resource_id':record.employee_id.resource_id.id |
3751 | - } |
3752 | - self.pool.get('resource.calendar.leaves').create(cr, uid, vals) |
3753 | + if record.holiday_type == 'employee' and record.type == 'remove': |
3754 | + vals = { |
3755 | + 'name': record.name, |
3756 | + 'date_from': i.date_from, |
3757 | + 'date_to': i.date_to, |
3758 | + 'calendar_id': record.employee_id.calendar_id.id, |
3759 | + 'company_id': record.employee_id.company_id.id, |
3760 | + 'resource_id': record.employee_id.resource_id.id |
3761 | + } |
3762 | + self.pool.get( |
3763 | + 'resource.calendar.leaves').create(cr, uid, vals) |
3764 | return True |
3765 | |
3766 | def holidays_confirm(self, cr, uid, ids, *args): |
3767 | for record in self.browse(cr, uid, ids): |
3768 | user_id = False |
3769 | # leave_asked = record.number_of_days_temp |
3770 | - if record.holiday_type=='employee' and record.type == 'remove': |
3771 | + if record.holiday_type == 'employee' and record.type == 'remove': |
3772 | # if record.employee_id and not record.holiday_status_id.limit: |
3773 | if record.employee_id: |
3774 | for i in record.holiday_line: |
3775 | leave_asked = i.number_of_days |
3776 | - leaves_rest = self.pool.get('hr.holidays.status').get_days( cr, uid, [i.holiday_status_id.id], record.employee_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3777 | + leaves_rest = self.pool.get('hr.holidays.status').get_days( |
3778 | + cr, uid, [i.holiday_status_id.id], record.employee_id.id, False)[i.holiday_status_id.id]['remaining_leaves'] |
3779 | if leaves_rest < leave_asked and not i.holiday_status_id.limit: |
3780 | - raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves for %s' %(record.employee_id.name, i.holiday_status_id.name))) |
3781 | + raise osv.except_osv( |
3782 | + _('Warning!'), _('You cannot validate leaves for %s while available leaves are less than asked leaves for %s' % (record.employee_id.name, i.holiday_status_id.name))) |
3783 | nb = -(record.number_of_days_temp) |
3784 | - elif record.holiday_type=='category' and record.type == 'remove': |
3785 | + elif record.holiday_type == 'category' and record.type == 'remove': |
3786 | # if record.category_id and not record.holiday_status_id.limit: |
3787 | if record.category_id: |
3788 | for j in record.holiday_line: |
3789 | leave_asked = i.number_of_days |
3790 | - leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( cr, uid, [j.holiday_status_id.id], record.category_id.id, False)[j.holiday_status_id.id]['remaining_leaves'] |
3791 | + leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( |
3792 | + cr, uid, [j.holiday_status_id.id], record.category_id.id, False)[j.holiday_status_id.id]['remaining_leaves'] |
3793 | if leaves_rest < leave_asked and not i.holiday_status_id.limit: |
3794 | - raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves for %s' %(record.category_id.name, j.holiday_status_id.name))) |
3795 | + raise osv.except_osv( |
3796 | + _('Warning!'), _('You cannot validate leaves for %s while available leaves are less than asked leaves for %s' % (record.category_id.name, j.holiday_status_id.name))) |
3797 | nb = -(record.number_of_days_temp) |
3798 | else: |
3799 | nb = record.number_of_days_temp |
3800 | |
3801 | - if record.holiday_type=='employee' and record.employee_id: |
3802 | + if record.holiday_type == 'employee' and record.employee_id: |
3803 | user_id = record.employee_id.user_id and record.employee_id.user_id.id or uid |
3804 | |
3805 | - |
3806 | self.write(cr, uid, [record.id], { |
3807 | - 'state':'confirm', |
3808 | + 'state': 'confirm', |
3809 | 'number_of_days': nb, |
3810 | 'user_id': user_id |
3811 | }) |
3812 | @@ -253,13 +279,15 @@ |
3813 | days = 0.0 |
3814 | if context is None: |
3815 | context = {} |
3816 | - res = super(hr_holidays, self).write(cr, uid, ids, vals, context=context) |
3817 | + res = super(hr_holidays, self).write( |
3818 | + cr, uid, ids, vals, context=context) |
3819 | if 'holiday_line' in vals and vals['holiday_line']: |
3820 | for i in self.browse(cr, uid, ids)[0].holiday_line: |
3821 | days += i.number_of_days |
3822 | - cr.execute('update hr_holidays set number_of_days_temp=%s'%(days,)) |
3823 | + cr.execute( |
3824 | + 'update hr_holidays set number_of_days_temp=%s' % (days,)) |
3825 | return res |
3826 | |
3827 | hr_holidays() |
3828 | |
3829 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3830 | \ No newline at end of file |
3831 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3832 | |
3833 | === modified file 'hr_interview/__init__.py' |
3834 | --- hr_interview/__init__.py 2009-11-23 08:56:43 +0000 |
3835 | +++ hr_interview/__init__.py 2013-12-23 20:13:10 +0000 |
3836 | @@ -1,7 +1,7 @@ |
3837 | # -*- encoding: utf-8 -*- |
3838 | -############################################################################## |
3839 | -# |
3840 | -# OpenERP, Open Source Management Solution |
3841 | +# |
3842 | +# |
3843 | +# OpenERP, Open Source Management Solution |
3844 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3845 | # $Id$ |
3846 | # |
3847 | @@ -18,9 +18,8 @@ |
3848 | # You should have received a copy of the GNU General Public License |
3849 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3850 | # |
3851 | -############################################################################## |
3852 | +# |
3853 | import hr_interview |
3854 | import wizard |
3855 | import report |
3856 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3857 | - |
3858 | |
3859 | === renamed file 'hr_interview/__terp__.py' => 'hr_interview/__openerp__.py' |
3860 | --- hr_interview/__terp__.py 2009-11-23 08:56:43 +0000 |
3861 | +++ hr_interview/__openerp__.py 2013-12-23 20:13:10 +0000 |
3862 | @@ -1,7 +1,7 @@ |
3863 | # -*- encoding: utf-8 -*- |
3864 | -############################################################################## |
3865 | -# |
3866 | -# OpenERP, Open Source Management Solution |
3867 | +# |
3868 | +# |
3869 | +# OpenERP, Open Source Management Solution |
3870 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3871 | # $Id$ |
3872 | # |
3873 | @@ -18,7 +18,7 @@ |
3874 | # You should have received a copy of the GNU General Public License |
3875 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3876 | # |
3877 | -############################################################################## |
3878 | +# |
3879 | |
3880 | { |
3881 | 'name': 'Human Resources (Interview Evaluation)', |
3882 | @@ -32,12 +32,12 @@ |
3883 | """, |
3884 | 'author': 'Tiny', |
3885 | 'website': 'http://www.openerp.com', |
3886 | - 'depends': ['base', 'hr','crm','smtpclient'], |
3887 | + 'depends': ['base', 'hr', 'crm', 'smtpclient'], |
3888 | 'init_xml': [], |
3889 | - 'update_xml': ['hr_interview_view.xml','hr_workflow.xml','hr_sequence.xml','security/ir.model.access.csv','hr_wizard.xml','hr_interview_report.xml'], |
3890 | + 'update_xml': ['hr_interview_view.xml', 'hr_workflow.xml', 'hr_sequence.xml', 'security/ir.model.access.csv', 'hr_wizard.xml', 'hr_interview_report.xml'], |
3891 | 'demo_xml': [], |
3892 | 'installable': True, |
3893 | 'active': False, |
3894 | - |
3895 | + |
3896 | } |
3897 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3898 | |
3899 | === modified file 'hr_interview/hr_interview.py' |
3900 | --- hr_interview/hr_interview.py 2010-04-07 10:31:59 +0000 |
3901 | +++ hr_interview/hr_interview.py 2013-12-23 20:13:10 +0000 |
3902 | @@ -1,5 +1,5 @@ |
3903 | # -*- encoding: utf-8 -*- |
3904 | -############################################################################## |
3905 | +# |
3906 | # |
3907 | # OpenERP, Open Source Management Solution |
3908 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3909 | @@ -18,201 +18,213 @@ |
3910 | # You should have received a copy of the GNU General Public License |
3911 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3912 | # |
3913 | -############################################################################## |
3914 | +# |
3915 | |
3916 | -from osv import fields,osv |
3917 | +from osv import fields, osv |
3918 | from osv.orm import except_orm |
3919 | from tools.translate import _ |
3920 | from time import strftime |
3921 | |
3922 | |
3923 | class candidate_category(osv.osv): |
3924 | - _name="candidate.category" |
3925 | - _description="Category Of Candidate" |
3926 | - _columns={ |
3927 | - 'code':fields.char("Code", size=64, required=True), |
3928 | - 'name' : fields.char("Name", size=64, required=True), |
3929 | - 'question_ids':fields.one2many("category.question","category_id","Question") |
3930 | - } |
3931 | + _name = "candidate.category" |
3932 | + _description = "Category Of Candidate" |
3933 | + _columns = { |
3934 | + 'code': fields.char("Code", size=64, required=True), |
3935 | + 'name': fields.char("Name", size=64, required=True), |
3936 | + 'question_ids': fields.one2many("category.question", "category_id", "Question") |
3937 | + } |
3938 | candidate_category() |
3939 | |
3940 | |
3941 | class cateory_question(osv.osv): |
3942 | - _name="category.question" |
3943 | - _description="Question Category (Question Belongs to Which Category)" |
3944 | - _columns={ |
3945 | - 'name' :fields.char("Question" ,size=64,required=True), |
3946 | - 'tot_marks':fields.integer("Total Marks",required=True), |
3947 | - 'category_id':fields.many2one("candidate.category","Category") |
3948 | - } |
3949 | + _name = "category.question" |
3950 | + _description = "Question Category (Question Belongs to Which Category)" |
3951 | + _columns = { |
3952 | + 'name': fields.char("Question", size=64, required=True), |
3953 | + 'tot_marks': fields.integer("Total Marks", required=True), |
3954 | + 'category_id': fields.many2one("candidate.category", "Category") |
3955 | + } |
3956 | |
3957 | cateory_question() |
3958 | |
3959 | |
3960 | class candidate_experience(osv.osv): |
3961 | - _name="candidate.experience" |
3962 | - _description="Candidate Experience" |
3963 | - _columns={ |
3964 | - 'code':fields.char("Code", size=64, required=True), |
3965 | - 'name' : fields.char("Name", size=64, required=True), |
3966 | - 'special':fields.char("Specialization",size =128) |
3967 | - } |
3968 | + _name = "candidate.experience" |
3969 | + _description = "Candidate Experience" |
3970 | + _columns = { |
3971 | + 'code': fields.char("Code", size=64, required=True), |
3972 | + 'name': fields.char("Name", size=64, required=True), |
3973 | + 'special': fields.char("Specialization", size=128) |
3974 | + } |
3975 | candidate_experience() |
3976 | |
3977 | |
3978 | class hr_interview(osv.osv): |
3979 | - _name = "hr.interview" |
3980 | - _description = "Interview Evaluation" |
3981 | - |
3982 | - def eval_performance(self,cr, uid, ids, *args): |
3983 | - tech_obj=self.pool.get("technical.skill") |
3984 | - tot_marks=obt_marks=0 |
3985 | - tech_id=tech_obj.search(cr,uid,[('candidate_id','=',ids[0])]) |
3986 | - if tech_id : |
3987 | - for rec in tech_obj.browse(cr,uid,tech_id): |
3988 | - tot_marks += rec.tot_marks |
3989 | - obt_marks += rec.obt_marks |
3990 | - self.write(cr, uid, ids, { 'performance' : (obt_marks * 100) / tot_marks }) |
3991 | - return True |
3992 | - |
3993 | - def _constraint_obt_marks(self, cr, uid, ids): |
3994 | - tech_skill_obj=self.pool.get("technical.skill") |
3995 | - tech_skill_ids=tech_skill_obj.search(cr,uid,[('candidate_id','=',ids[0])]) |
3996 | - for rec in tech_skill_obj.browse(cr,uid,tech_skill_ids): |
3997 | - if rec['obt_marks'] > rec['tot_marks'] or rec['tot_marks'] <= 0 : |
3998 | - return False |
3999 | - return True |
4000 | - |
4001 | - def _constraint_evaluator(self, cr, uid, ids): |
4002 | - rec = self.read(cr,uid,ids[0]) |
4003 | - if rec['reference_id']: |
4004 | - if rec['reference_id'][0] in rec['evaluator_ids']: |
4005 | - return False |
4006 | - return True |
4007 | - |
4008 | - _columns ={ |
4009 | - 'hr_id' : fields.char("Interview ID", size =64), |
4010 | - 'name':fields.char("Candidate Name", size=64, required = True,select = True), |
4011 | - 'crm_case_id' : fields.many2one('crm.case',"Case"), |
4012 | - 'email' : fields.char("E-mail",size=64,required =True), |
4013 | - 'mobile_no' :fields.char("Mobile",size=64), |
4014 | - 'date' :fields.datetime('Scheduled Date'), |
4015 | - 'exam_date' :fields.datetime('Exam On'), |
4016 | - 'education': fields.selection([("be_ce","BE Computers"),("be_it","BE IT"),("bsc_it","BSc IT"),("bca","BCA"),("btech_ce","BTech Computers"),("btech_it","BTech IT"),("mca","MCA"),("msc_it","MSc IT"),("mtech_ce","MTech Computers"),("other","Other")],"Education"), |
4017 | - 'category_id' : fields.many2one("candidate.category","Category"), |
4018 | - 'experience_id':fields.many2one("candidate.experience","Experience"), |
4019 | - 'remarks':fields.text("Remarks"), |
4020 | - 'evaluator_ids': fields.many2many("hr.employee",'hr_empl_rel', 'hr_cand_id', 'emp_id',"Evaluator"), |
4021 | - 'reference_id': fields.many2one("hr.employee","Reference"), |
4022 | - 'tech_skills_ids': fields.one2many("technical.skill","candidate_id","Technology Skills"), |
4023 | - 'performance': fields.float("Performance (%)",readonly=True), |
4024 | - 'state' : fields.selection([("draft","Draft"),('scheduled','Scheduled'),('re-scheduled','Re-Scheduled'),('start-interview','Start-Interview'),('end-interview','End-Interview'),("selected","Selected"),('rejected','Rejected'),("cancel","Cancel")],"State",readonly=True,select =1), |
4025 | - 'history_log_ids': fields.one2many("hr.interview.log","history_id","Interview Logs",readonly=True), |
4026 | - } |
4027 | - _defaults = { |
4028 | - 'state' : lambda *a: "draft", |
4029 | - 'hr_id': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'hr.interview'), |
4030 | - } |
4031 | - |
4032 | - _constraints = [ |
4033 | - (_constraint_obt_marks, _('Obtained marks cannot be greater than Total marks!'), ['obt_marks']), |
4034 | - (_constraint_evaluator, "Reference Person cannot be among Evaluators!", ['reference_id']) |
4035 | + _name = "hr.interview" |
4036 | + _description = "Interview Evaluation" |
4037 | + |
4038 | + def eval_performance(self, cr, uid, ids, *args): |
4039 | + tech_obj = self.pool.get("technical.skill") |
4040 | + tot_marks = obt_marks = 0 |
4041 | + tech_id = tech_obj.search(cr, uid, [('candidate_id', '=', ids[0])]) |
4042 | + if tech_id: |
4043 | + for rec in tech_obj.browse(cr, uid, tech_id): |
4044 | + tot_marks += rec.tot_marks |
4045 | + obt_marks += rec.obt_marks |
4046 | + self.write( |
4047 | + cr, uid, ids, {'performance': (obt_marks * 100) / tot_marks}) |
4048 | + return True |
4049 | + |
4050 | + def _constraint_obt_marks(self, cr, uid, ids): |
4051 | + tech_skill_obj = self.pool.get("technical.skill") |
4052 | + tech_skill_ids = tech_skill_obj.search( |
4053 | + cr, uid, [('candidate_id', '=', ids[0])]) |
4054 | + for rec in tech_skill_obj.browse(cr, uid, tech_skill_ids): |
4055 | + if rec['obt_marks'] > rec['tot_marks'] or rec['tot_marks'] <= 0: |
4056 | + return False |
4057 | + return True |
4058 | + |
4059 | + def _constraint_evaluator(self, cr, uid, ids): |
4060 | + rec = self.read(cr, uid, ids[0]) |
4061 | + if rec['reference_id']: |
4062 | + if rec['reference_id'][0] in rec['evaluator_ids']: |
4063 | + return False |
4064 | + return True |
4065 | + |
4066 | + _columns = { |
4067 | + 'hr_id': fields.char("Interview ID", size=64), |
4068 | + 'name': fields.char("Candidate Name", size=64, required=True, select=True), |
4069 | + 'crm_case_id': fields.many2one('crm.case', "Case"), |
4070 | + 'email': fields.char("E-mail", size=64, required=True), |
4071 | + 'mobile_no': fields.char("Mobile", size=64), |
4072 | + 'date': fields.datetime('Scheduled Date'), |
4073 | + 'exam_date': fields.datetime('Exam On'), |
4074 | + 'education': fields.selection([("be_ce", "BE Computers"), ("be_it", "BE IT"), ("bsc_it", "BSc IT"), ("bca", "BCA"), ("btech_ce", "BTech Computers"), ("btech_it", "BTech IT"), ("mca", "MCA"), ("msc_it", "MSc IT"), ("mtech_ce", "MTech Computers"), ("other", "Other")], "Education"), |
4075 | + 'category_id': fields.many2one("candidate.category", "Category"), |
4076 | + 'experience_id': fields.many2one("candidate.experience", "Experience"), |
4077 | + 'remarks': fields.text("Remarks"), |
4078 | + 'evaluator_ids': fields.many2many("hr.employee", 'hr_empl_rel', 'hr_cand_id', 'emp_id', "Evaluator"), |
4079 | + 'reference_id': fields.many2one("hr.employee", "Reference"), |
4080 | + 'tech_skills_ids': fields.one2many("technical.skill", "candidate_id", "Technology Skills"), |
4081 | + 'performance': fields.float("Performance (%)", readonly=True), |
4082 | + 'state': fields.selection([("draft", "Draft"), ('scheduled', 'Scheduled'), ('re-scheduled', 'Re-Scheduled'), ('start-interview', 'Start-Interview'), ('end-interview', 'End-Interview'), ("selected", "Selected"), ('rejected', 'Rejected'), ("cancel", "Cancel")], "State", readonly=True, select=1), |
4083 | + 'history_log_ids': fields.one2many("hr.interview.log", "history_id", "Interview Logs", readonly=True), |
4084 | + } |
4085 | + _defaults = { |
4086 | + 'state': lambda *a: "draft", |
4087 | + 'hr_id': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'hr.interview'), |
4088 | + } |
4089 | + |
4090 | + _constraints = [ |
4091 | + (_constraint_obt_marks, |
4092 | + _('Obtained marks cannot be greater than Total marks!'), ['obt_marks']), |
4093 | + (_constraint_evaluator, |
4094 | + "Reference Person cannot be among Evaluators!", ['reference_id']) |
4095 | ] |
4096 | |
4097 | - def state_scheduled(self, cr, uid, ids,*arg): |
4098 | - self.write(cr, uid, ids, { 'state' : 'scheduled'}) |
4099 | - self._log(cr,uid,ids,'scheduled') |
4100 | - return True |
4101 | - |
4102 | - def state_cancel(self, cr, uid, ids,*arg): |
4103 | - self.write(cr, uid, ids, { 'state' : 'cancel' }) |
4104 | - self._log(cr,uid,ids,'cancel') |
4105 | - return True |
4106 | - |
4107 | - def state_re_scheduled(self, cr, uid, ids,*arg): |
4108 | - self.write(cr, uid, ids, { 'state' : 're-scheduled' }) |
4109 | - self._log(cr,uid,ids,'re-scheduled') |
4110 | - return True |
4111 | - |
4112 | - def state_start_interview(self, cr, uid, ids,*arg): |
4113 | - self.write(cr, uid, ids, { 'state' : 'start-interview' }) |
4114 | - self._log(cr,uid,ids,'start-interview') |
4115 | - return True |
4116 | - |
4117 | - def state_end_interview(self, cr, uid, ids,*arg): |
4118 | - self.write(cr, uid, ids, { 'state' : 'end-interview' }) |
4119 | - self._log(cr,uid,ids,'end-interview') |
4120 | - return True |
4121 | - |
4122 | - def state_selected(self, cr, uid, ids,*arg): |
4123 | - self.write(cr, uid, ids, { 'state' : 'selected' }) |
4124 | - self._log(cr,uid,ids,'selected') |
4125 | - return True |
4126 | - |
4127 | - def state_rejected(self, cr, uid, ids,*arg): |
4128 | - self.write(cr, uid, ids, { 'state' : 'rejected' }) |
4129 | - self._log(cr,uid,ids,'rejected') |
4130 | - return True |
4131 | - |
4132 | - def _log(self,cr,uid,ids,action): |
4133 | - his_obj = self.pool.get("hr.interview.log") |
4134 | - his_obj.create(cr,uid,{'state':action,'date':strftime("%Y-%m-%d %H:%M:%S"),"user_id":uid,'history_id':ids[0]}) |
4135 | - return True |
4136 | - |
4137 | - def copy(self, cr, uid, id, default=None,context=None): |
4138 | - raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!')) |
4139 | - return False |
4140 | - |
4141 | - def create(self, cr, uid, vals, context=None): |
4142 | - que_obj = self.pool.get("category.question") |
4143 | - tech_skill_obj = self.pool.get("technical.skill") |
4144 | - hr_id = super(hr_interview, self).create(cr, uid, vals, context=context) |
4145 | - if vals.get('category_id', False): |
4146 | - cate_id = vals.get('category_id') |
4147 | - que_ids = que_obj.search(cr, uid, [('category_id','=',int(cate_id))], context=context) |
4148 | - for rec in que_obj.browse(cr, uid, que_ids, context=context): |
4149 | - tech_skill_obj.create(cr, uid, {'name': rec.name, 'tot_marks': rec.tot_marks, 'candidate_id': hr_id}) |
4150 | - self._log(cr, uid, [hr_id], 'draft') |
4151 | - return hr_id |
4152 | - |
4153 | - def write(self, cr, uid, ids, vals, context=None): |
4154 | - que_obj = self.pool.get("category.question") |
4155 | - tech_skill_obj=self.pool.get("technical.skill") |
4156 | - if 'category_id' in vals : |
4157 | - cate_id = vals['category_id'] |
4158 | - que_ids = que_obj.search(cr, uid, [('category_id', '=', int(cate_id))]) |
4159 | - tech_skill_ids=tech_skill_obj.search(cr, uid, [('candidate_id','=',ids[0])]) |
4160 | - if tech_skill_ids: |
4161 | - tech_skill_obj.unlink(cr,uid,tech_skill_ids) |
4162 | - for rec in que_obj.browse(cr,uid,que_ids): |
4163 | - tech_skill_obj.create(cr,uid,{'name':rec.name,'tot_marks':rec.tot_marks,'candidate_id':ids[0]}) |
4164 | - return super(hr_interview, self).write(cr, uid, ids, vals, context=context) |
4165 | + def state_scheduled(self, cr, uid, ids, *arg): |
4166 | + self.write(cr, uid, ids, {'state': 'scheduled'}) |
4167 | + self._log(cr, uid, ids, 'scheduled') |
4168 | + return True |
4169 | + |
4170 | + def state_cancel(self, cr, uid, ids, *arg): |
4171 | + self.write(cr, uid, ids, {'state': 'cancel'}) |
4172 | + self._log(cr, uid, ids, 'cancel') |
4173 | + return True |
4174 | + |
4175 | + def state_re_scheduled(self, cr, uid, ids, *arg): |
4176 | + self.write(cr, uid, ids, {'state': 're-scheduled'}) |
4177 | + self._log(cr, uid, ids, 're-scheduled') |
4178 | + return True |
4179 | + |
4180 | + def state_start_interview(self, cr, uid, ids, *arg): |
4181 | + self.write(cr, uid, ids, {'state': 'start-interview'}) |
4182 | + self._log(cr, uid, ids, 'start-interview') |
4183 | + return True |
4184 | + |
4185 | + def state_end_interview(self, cr, uid, ids, *arg): |
4186 | + self.write(cr, uid, ids, {'state': 'end-interview'}) |
4187 | + self._log(cr, uid, ids, 'end-interview') |
4188 | + return True |
4189 | + |
4190 | + def state_selected(self, cr, uid, ids, *arg): |
4191 | + self.write(cr, uid, ids, {'state': 'selected'}) |
4192 | + self._log(cr, uid, ids, 'selected') |
4193 | + return True |
4194 | + |
4195 | + def state_rejected(self, cr, uid, ids, *arg): |
4196 | + self.write(cr, uid, ids, {'state': 'rejected'}) |
4197 | + self._log(cr, uid, ids, 'rejected') |
4198 | + return True |
4199 | + |
4200 | + def _log(self, cr, uid, ids, action): |
4201 | + his_obj = self.pool.get("hr.interview.log") |
4202 | + his_obj.create(cr, uid, {'state': action, 'date': strftime( |
4203 | + "%Y-%m-%d %H:%M:%S"), "user_id": uid, 'history_id': ids[0]}) |
4204 | + return True |
4205 | + |
4206 | + def copy(self, cr, uid, id, default=None, context=None): |
4207 | + raise osv.except_osv( |
4208 | + _('Error !'), _('You cannot duplicate the resource!')) |
4209 | + return False |
4210 | + |
4211 | + def create(self, cr, uid, vals, context=None): |
4212 | + que_obj = self.pool.get("category.question") |
4213 | + tech_skill_obj = self.pool.get("technical.skill") |
4214 | + hr_id = super(hr_interview, self).create( |
4215 | + cr, uid, vals, context=context) |
4216 | + if vals.get('category_id', False): |
4217 | + cate_id = vals.get('category_id') |
4218 | + que_ids = que_obj.search( |
4219 | + cr, uid, [('category_id', '=', int(cate_id))], context=context) |
4220 | + for rec in que_obj.browse(cr, uid, que_ids, context=context): |
4221 | + tech_skill_obj.create( |
4222 | + cr, uid, {'name': rec.name, 'tot_marks': rec.tot_marks, 'candidate_id': hr_id}) |
4223 | + self._log(cr, uid, [hr_id], 'draft') |
4224 | + return hr_id |
4225 | + |
4226 | + def write(self, cr, uid, ids, vals, context=None): |
4227 | + que_obj = self.pool.get("category.question") |
4228 | + tech_skill_obj = self.pool.get("technical.skill") |
4229 | + if 'category_id' in vals: |
4230 | + cate_id = vals['category_id'] |
4231 | + que_ids = que_obj.search( |
4232 | + cr, uid, [('category_id', '=', int(cate_id))]) |
4233 | + tech_skill_ids = tech_skill_obj.search( |
4234 | + cr, uid, [('candidate_id', '=', ids[0])]) |
4235 | + if tech_skill_ids: |
4236 | + tech_skill_obj.unlink(cr, uid, tech_skill_ids) |
4237 | + for rec in que_obj.browse(cr, uid, que_ids): |
4238 | + tech_skill_obj.create( |
4239 | + cr, uid, {'name': rec.name, 'tot_marks': rec.tot_marks, 'candidate_id': ids[0]}) |
4240 | + return super(hr_interview, self).write(cr, uid, ids, vals, context=context) |
4241 | |
4242 | hr_interview() |
4243 | |
4244 | |
4245 | class technical_skill(osv.osv): |
4246 | - _name="technical.skill" |
4247 | - _description="Technical Skill Of Candidate" |
4248 | - _columns={ |
4249 | - 'candidate_id' : fields.many2one("hr.interview","Candidate ID"), |
4250 | - 'name' : fields.char("Category" ,size=64), |
4251 | - 'tot_marks' : fields.float("Total Marks"), |
4252 | - 'obt_marks': fields.float("Obtained Marks"), |
4253 | - 'remarks' : fields.text("Remarks") |
4254 | - } |
4255 | + _name = "technical.skill" |
4256 | + _description = "Technical Skill Of Candidate" |
4257 | + _columns = { |
4258 | + 'candidate_id': fields.many2one("hr.interview", "Candidate ID"), |
4259 | + 'name': fields.char("Category", size=64), |
4260 | + 'tot_marks': fields.float("Total Marks"), |
4261 | + 'obt_marks': fields.float("Obtained Marks"), |
4262 | + 'remarks': fields.text("Remarks") |
4263 | + } |
4264 | technical_skill() |
4265 | |
4266 | |
4267 | class hr_interview_log(osv.osv): |
4268 | - _name="hr.interview.log" |
4269 | - _description="HR interview log" |
4270 | - _rec_name="history_id" |
4271 | - _columns={ |
4272 | - 'history_id':fields.many2one("hr.interview","History ID"), |
4273 | - 'state' : fields.char("State",size=64), |
4274 | - 'date': fields.datetime("Date"), |
4275 | - 'user_id' : fields.many2one("res.users","User Name") |
4276 | - } |
4277 | + _name = "hr.interview.log" |
4278 | + _description = "HR interview log" |
4279 | + _rec_name = "history_id" |
4280 | + _columns = { |
4281 | + 'history_id': fields.many2one("hr.interview", "History ID"), |
4282 | + 'state': fields.char("State", size=64), |
4283 | + 'date': fields.datetime("Date"), |
4284 | + 'user_id': fields.many2one("res.users", "User Name") |
4285 | + } |
4286 | hr_interview_log() |
4287 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4288 | |
4289 | === modified file 'hr_interview/report/candidate_summary.py' |
4290 | --- hr_interview/report/candidate_summary.py 2009-11-23 08:56:43 +0000 |
4291 | +++ hr_interview/report/candidate_summary.py 2013-12-23 20:13:10 +0000 |
4292 | @@ -1,7 +1,7 @@ |
4293 | # -*- encoding: utf-8 -*- |
4294 | -############################################################################## |
4295 | -# |
4296 | -# OpenERP, Open Source Management Solution |
4297 | +# |
4298 | +# |
4299 | +# OpenERP, Open Source Management Solution |
4300 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4301 | # $Id$ |
4302 | # |
4303 | @@ -18,38 +18,41 @@ |
4304 | # You should have received a copy of the GNU General Public License |
4305 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4306 | # |
4307 | -############################################################################## |
4308 | +# |
4309 | |
4310 | import time |
4311 | from report import report_sxw |
4312 | import datetime |
4313 | import mx.DateTime |
4314 | |
4315 | + |
4316 | class candidate_summary(report_sxw.rml_parse): |
4317 | |
4318 | def __init__(self, cr, uid, name, context): |
4319 | super(candidate_summary, self).__init__(cr, uid, name, context) |
4320 | - self.localcontext.update( { |
4321 | + self.localcontext.update({ |
4322 | 'time': time, |
4323 | 'get_education': self._get_education, |
4324 | - 'get_scheduled_date':self._get_schedule_date, |
4325 | + 'get_scheduled_date': self._get_schedule_date, |
4326 | }) |
4327 | - |
4328 | + |
4329 | def _get_education(self, edu_type): |
4330 | - edu_list = [("be_ce","BE Computers"),("be_it","BE IT"),("bsc_it","BSc IT"),("bca","BCA"),("btech_ce","BTech Computers"),("btech_it","BTech IT"),("mca","MCA"),("msc_it","MSc IT"),("mtech_ce","MTech Computers"),("other","Other")] |
4331 | - edu = [x[1] for x in edu_list if x[0]==str(edu_type) ] |
4332 | + edu_list = [( |
4333 | + "be_ce", "BE Computers"), ("be_it", "BE IT"), ("bsc_it", "BSc IT"), ("bca", "BCA"), ("btech_ce", "BTech Computers"), |
4334 | + ("btech_it", "BTech IT"), ("mca", "MCA"), ("msc_it", "MSc IT"), ("mtech_ce", "MTech Computers"), ("other", "Other")] |
4335 | + edu = [x[1] for x in edu_list if x[0] == str(edu_type)] |
4336 | return edu[0] |
4337 | - |
4338 | + |
4339 | def _get_schedule_date(self, sch_time): |
4340 | if len(sch_time) > 5: |
4341 | - dt = mx.DateTime.strptime(str(sch_time),"%m/%d/%Y %H:%M:%S") |
4342 | + dt = mx.DateTime.strptime(str(sch_time), "%m/%d/%Y %H:%M:%S") |
4343 | sch_dt = dt.strftime('%B %d,%Y at %H:%M %p') |
4344 | - else : |
4345 | - sch_dt="" |
4346 | + else: |
4347 | + sch_dt = "" |
4348 | return sch_dt |
4349 | |
4350 | -report_sxw.report_sxw('report.candidate.summary', 'hr.interview', 'addons/hr_interview/report/candidate_summary.rml',parser=candidate_summary,header=False) |
4351 | +report_sxw.report_sxw('report.candidate.summary', 'hr.interview', |
4352 | + 'addons/hr_interview/report/candidate_summary.rml', parser=candidate_summary, header=False) |
4353 | |
4354 | |
4355 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4356 | - |
4357 | |
4358 | === modified file 'hr_interview/wizard/__init__.py' |
4359 | --- hr_interview/wizard/__init__.py 2009-11-23 08:56:43 +0000 |
4360 | +++ hr_interview/wizard/__init__.py 2013-12-23 20:13:10 +0000 |
4361 | @@ -1,7 +1,7 @@ |
4362 | # -*- encoding: utf-8 -*- |
4363 | -############################################################################## |
4364 | -# |
4365 | -# OpenERP, Open Source Management Solution |
4366 | +# |
4367 | +# |
4368 | +# OpenERP, Open Source Management Solution |
4369 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4370 | # $Id$ |
4371 | # |
4372 | @@ -18,8 +18,8 @@ |
4373 | # You should have received a copy of the GNU General Public License |
4374 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4375 | # |
4376 | -############################################################################## |
4377 | +# |
4378 | |
4379 | import wiz_schedule |
4380 | import wizard_send_interview_mail |
4381 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4382 | \ No newline at end of file |
4383 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4384 | |
4385 | === modified file 'hr_interview/wizard/wiz_schedule.py' |
4386 | --- hr_interview/wizard/wiz_schedule.py 2010-01-21 08:17:41 +0000 |
4387 | +++ hr_interview/wizard/wiz_schedule.py 2013-12-23 20:13:10 +0000 |
4388 | @@ -1,7 +1,7 @@ |
4389 | # -*- encoding: utf-8 -*- |
4390 | -############################################################################## |
4391 | -# |
4392 | -# OpenERP, Open Source Management Solution |
4393 | +# |
4394 | +# |
4395 | +# OpenERP, Open Source Management Solution |
4396 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4397 | # $Id$ |
4398 | # |
4399 | @@ -18,9 +18,9 @@ |
4400 | # You should have received a copy of the GNU General Public License |
4401 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4402 | # |
4403 | -############################################################################## |
4404 | +# |
4405 | |
4406 | -import wizard |
4407 | +from osv import osv |
4408 | import pooler |
4409 | import datetime |
4410 | import time |
4411 | @@ -36,10 +36,10 @@ |
4412 | </form>''' |
4413 | |
4414 | _schedule_fields = { |
4415 | - 'start_interview' : {'string' : 'Start Interview Time', 'type' : 'datetime','required':True }, |
4416 | - 'end_interview' : {'string' : 'End Interview Time', 'type' : 'datetime','required':True }, |
4417 | - 'interval_time' : {'string' : 'Interval(Approximate Evaluation Time) ', 'type' : 'integer','required':True }, |
4418 | - } |
4419 | + 'start_interview': {'string': 'Start Interview Time', 'type': 'datetime', 'required': True}, |
4420 | + 'end_interview': {'string': 'End Interview Time', 'type': 'datetime', 'required': True}, |
4421 | + 'interval_time': {'string': 'Interval(Approximate Evaluation Time) ', 'type': 'integer', 'required': True}, |
4422 | +} |
4423 | |
4424 | |
4425 | form = """<?xml version="1.0"?> |
4426 | @@ -52,57 +52,66 @@ |
4427 | """ |
4428 | |
4429 | fields = { |
4430 | - 'list' : {'string': "",'type':'text','readonly':True}, |
4431 | - 'list_all' : {'string': "",'type':'text','readonly':True} |
4432 | - } |
4433 | - |
4434 | -class wiz_schedule(wizard.interface): |
4435 | + 'list': {'string': "", 'type': 'text', 'readonly': True}, |
4436 | + 'list_all': {'string': "", 'type': 'text', 'readonly': True} |
4437 | +} |
4438 | + |
4439 | + |
4440 | +class wiz_schedule(osv.osv_memory): |
4441 | + |
4442 | def _scheduling(self, cr, uid, data, context): |
4443 | pool = pooler.get_pool(cr.dbname) |
4444 | hr_int_obj = pool.get("hr.interview") |
4445 | - if time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S") < time.strptime(data['form']['end_interview'],"%Y-%m-%d %H:%M:%S") and time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S")[:3] ==time.strptime(str(data['form']['end_interview']),"%Y-%m-%d %H:%M:%S")[:3] : |
4446 | - if datetime.datetime(*time.strptime(str(data['form']['end_interview']),"%Y-%m-%d %H:%M:%S")[:6]) >= datetime.datetime(*time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])): |
4447 | + if time.strptime(str(data['form']['start_interview']), "%Y-%m-%d %H:%M:%S") < time.strptime(data['form']['end_interview'], "%Y-%m-%d %H:%M:%S") and time.strptime(str(data['form']['start_interview']), "%Y-%m-%d %H:%M:%S")[:3] == time.strptime(str(data['form']['end_interview']), "%Y-%m-%d %H:%M:%S")[:3]: |
4448 | + if datetime.datetime(*time.strptime(str(data['form']['end_interview']), "%Y-%m-%d %H:%M:%S")[:6]) >= datetime.datetime(*time.strptime(str(data['form']['start_interview']), "%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])): |
4449 | cur_time = data['form']['start_interview'] |
4450 | re_id = deepcopy(data['ids']) |
4451 | - list_all="Interview ID \t Name " |
4452 | + list_all = "Interview ID \t Name " |
4453 | for rec in data['ids']: |
4454 | wf_service = netsvc.LocalService('workflow') |
4455 | - wf_service.trg_validate(uid, 'hr.interview', rec, 'state_scheduled', cr) |
4456 | - record = hr_int_obj.read(cr,uid,rec,['hr_id','name']) |
4457 | - list_all +="\n" + record['hr_id']+"\t\t" + record['name'] |
4458 | - id = hr_int_obj.write(cr,uid,rec,{'date':cur_time,'state':'scheduled'}) |
4459 | - cur_time = datetime.datetime(*time.strptime(str(cur_time),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])) |
4460 | + wf_service.trg_validate( |
4461 | + uid, 'hr.interview', rec, 'state_scheduled', cr) |
4462 | + record = hr_int_obj.read(cr, uid, rec, ['hr_id', 'name']) |
4463 | + list_all += "\n" + \ |
4464 | + record['hr_id'] + "\t\t" + record['name'] |
4465 | + id = hr_int_obj.write( |
4466 | + cr, uid, rec, {'date': cur_time, 'state': 'scheduled'}) |
4467 | + cur_time = datetime.datetime(*time.strptime(str(cur_time), "%Y-%m-%d %H:%M:%S")[ |
4468 | + :6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])) |
4469 | re_id.remove(rec) |
4470 | - end_time = datetime.datetime(*time.strptime(str(cur_time),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])) |
4471 | - if len(re_id) > 0 and time.strptime(str(end_time),"%Y-%m-%d %H:%M:%S") > time.strptime(data['form']['end_interview'],"%Y-%m-%d %H:%M:%S") : |
4472 | - remain="Interview ID \t Name " |
4473 | - for record in hr_int_obj.read(cr,uid,re_id,['hr_id','name']): |
4474 | - remain +="\n" + record['hr_id']+"\t\t" + record['name'] |
4475 | - data['form']['list']=remain |
4476 | - data['form']['list_all']=list_all |
4477 | + end_time = datetime.datetime(*time.strptime(str(cur_time), "%Y-%m-%d %H:%M:%S")[ |
4478 | + :6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])) |
4479 | + if len(re_id) > 0 and time.strptime(str(end_time), "%Y-%m-%d %H:%M:%S") > time.strptime(data['form']['end_interview'], "%Y-%m-%d %H:%M:%S"): |
4480 | + remain = "Interview ID \t Name " |
4481 | + for record in hr_int_obj.read(cr, uid, re_id, ['hr_id', 'name']): |
4482 | + remain += "\n" + \ |
4483 | + record['hr_id'] + "\t\t" + record['name'] |
4484 | + data['form']['list'] = remain |
4485 | + data['form']['list_all'] = list_all |
4486 | return data['form'] |
4487 | - else : |
4488 | - raise wizard.except_wizard(_('UserError'),_('Insert appropriate interval time!!!')) |
4489 | + else: |
4490 | + raise osv.except_osv( |
4491 | + _('UserError'), _('Insert appropriate interval time!!!')) |
4492 | return {} |
4493 | - else : |
4494 | - raise wizard.except_wizard(_('UserError'),_('The Scheduling is not Appropriate. Enter appropriate date and time ')) |
4495 | + else: |
4496 | + raise osv.except_osv( |
4497 | + _('UserError'), _('The Scheduling is not Appropriate. Enter appropriate date and time ')) |
4498 | return {} |
4499 | - |
4500 | - data['form']['list_all']= list_all |
4501 | - data['form']['list']= "None" |
4502 | - |
4503 | + |
4504 | + data['form']['list_all'] = list_all |
4505 | + data['form']['list'] = "None" |
4506 | + |
4507 | return data['form'] |
4508 | - |
4509 | - |
4510 | + |
4511 | states = { |
4512 | 'init': { |
4513 | 'actions': [], |
4514 | - 'result': {'type': 'form', 'arch':_schedule_form, 'fields':_schedule_fields, 'state':[('schedule','Schedule','gtk-ok'),('end','Cancel','gtk-cancel')]} |
4515 | - }, |
4516 | - 'schedule': { |
4517 | + 'result': {'type': 'form', 'arch': _schedule_form, 'fields': _schedule_fields, 'state': [('schedule', 'Schedule', 'gtk-ok'), ('end', 'Cancel', 'gtk-cancel')]} |
4518 | + }, |
4519 | + 'schedule': { |
4520 | 'actions': [_scheduling], |
4521 | - 'result': {'type': 'form','arch':form, 'fields':fields, 'state':[('end','Ok')]} |
4522 | - }, |
4523 | + 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': [('end', 'Ok')]} |
4524 | + }, |
4525 | } |
4526 | wiz_schedule('wiz_interview_scheduling') |
4527 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4528 | \ No newline at end of file |
4529 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4530 | |
4531 | === modified file 'hr_interview/wizard/wizard_send_interview_mail.py' |
4532 | --- hr_interview/wizard/wizard_send_interview_mail.py 2010-07-06 06:47:27 +0000 |
4533 | +++ hr_interview/wizard/wizard_send_interview_mail.py 2013-12-23 20:13:10 +0000 |
4534 | @@ -1,7 +1,7 @@ |
4535 | # -*- encoding: utf-8 -*- |
4536 | -############################################################################## |
4537 | -# |
4538 | -# OpenERP, Open Source Management Solution |
4539 | +# |
4540 | +# |
4541 | +# OpenERP, Open Source Management Solution |
4542 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4543 | # $Id$ |
4544 | # |
4545 | @@ -18,9 +18,9 @@ |
4546 | # You should have received a copy of the GNU General Public License |
4547 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4548 | # |
4549 | -############################################################################## |
4550 | +# |
4551 | |
4552 | -import wizard |
4553 | +from osv import osv |
4554 | import pooler |
4555 | import tools |
4556 | import time |
4557 | @@ -28,7 +28,7 @@ |
4558 | import mx.DateTime |
4559 | import re |
4560 | |
4561 | -mail_form='''<?xml version="1.0"?> |
4562 | +mail_form = '''<?xml version="1.0"?> |
4563 | <form string="Interview Mail"> |
4564 | <field name="smtp_server" colspan="4"/> |
4565 | <field name="subject" colspan="4"/> |
4566 | @@ -36,20 +36,22 @@ |
4567 | </form>''' |
4568 | |
4569 | mail_fields = { |
4570 | - 'smtp_server':{'string':'SMTP Server','type':'many2one','relation': 'email.smtpclient','required':True}, |
4571 | - 'subject': {'string': 'Subject', 'type':'char', 'size': 64, 'required':True}, |
4572 | - 'mail_body': {'string': 'Body', 'type': 'text_tag', 'required':True} |
4573 | + 'smtp_server': {'string': 'SMTP Server', 'type': 'many2one', 'relation': 'email.smtpclient', 'required': True}, |
4574 | + 'subject': {'string': 'Subject', 'type': 'char', 'size': 64, 'required': True}, |
4575 | + 'mail_body': {'string': 'Body', 'type': 'text_tag', 'required': True} |
4576 | } |
4577 | |
4578 | -class wizard_email_interview(wizard.interface): |
4579 | - |
4580 | + |
4581 | +class wizard_email_interview(osv.osv_memory): |
4582 | + |
4583 | def merge_message(self, cr, uid, id, keystr, context): |
4584 | obj_pool = pooler.get_pool(cr.dbname).get('hr.interview') |
4585 | - |
4586 | + |
4587 | def merge(match): |
4588 | obj = obj_pool.browse(cr, uid, id) |
4589 | exp = str(match.group()[2:-2]).strip() |
4590 | - result = eval(exp, {'object':obj, 'context': context,'time':time}) |
4591 | + result = eval( |
4592 | + exp, {'object': obj, 'context': context, 'time': time}) |
4593 | if result in (None, False): |
4594 | return str("--------") |
4595 | print 'XXXXXXXXXXXXXXXXXXXX : ', result |
4596 | @@ -57,7 +59,7 @@ |
4597 | |
4598 | com = re.compile('(\[\[.+?\]\])') |
4599 | message = com.sub(merge, keystr) |
4600 | - |
4601 | + |
4602 | return message |
4603 | |
4604 | def _send_mail(self, cr, uid, data, context={}): |
4605 | @@ -66,40 +68,43 @@ |
4606 | body = data['form']['mail_body'] |
4607 | ids = data['ids'] |
4608 | hr_candidate_obj = pooler.get_pool(cr.dbname).get('hr.interview') |
4609 | - hr_candidates = hr_candidate_obj.browse(cr,uid,ids) |
4610 | + hr_candidates = hr_candidate_obj.browse(cr, uid, ids) |
4611 | for hr_candidate in hr_candidates: |
4612 | msg = self.merge_message(cr, uid, hr_candidate.id, body, context) |
4613 | to = hr_candidate.email |
4614 | - files = smtp_obj.send_email(cr, uid, data['form']['smtp_server'], to, subject, msg) |
4615 | - return {} |
4616 | + files = smtp_obj.send_email( |
4617 | + cr, uid, data['form']['smtp_server'], to, subject, msg) |
4618 | + return {} |
4619 | |
4620 | def _default_params(self, cr, uid, data, context={}): |
4621 | ids = data['ids'] |
4622 | - hr_candidates = pooler.get_pool(cr.dbname).get('hr.interview').browse(cr,uid,ids) |
4623 | + hr_candidates = pooler.get_pool(cr.dbname).get( |
4624 | + 'hr.interview').browse(cr, uid, ids) |
4625 | subject = '<No Subject>' |
4626 | for hr_candidate in hr_candidates: |
4627 | body = "Hello __candidate__ ,\n\n" + "Congratulations!\n\n" |
4628 | if hr_candidate.state == 'scheduled': |
4629 | body = body + "Your resume has been short listed in the qualifying candidates.\n"\ |
4630 | - + "Your interview has been scheduled on __date__\n\n" |
4631 | + + \ |
4632 | + "Your interview has been scheduled on __date__\n\n" |
4633 | subject = "A call for Interview !" |
4634 | elif hr_candidate.state == 'selected': |
4635 | body = body + "You have been selected .\n"\ |
4636 | + "Your date of joining is : __date__\n\n" |
4637 | - subject = "Congratulations! A call for Joining!" |
4638 | - |
4639 | + subject = "Congratulations! A call for Joining!" |
4640 | + |
4641 | data['mail_body'] = body + "Regards,\n" + "Management\n" |
4642 | - data['subject'] = subject |
4643 | + data['subject'] = subject |
4644 | return data |
4645 | - |
4646 | + |
4647 | states = { |
4648 | 'init': { |
4649 | 'actions': [_default_params], |
4650 | - 'result': {'type':'form', 'arch':mail_form, 'fields':mail_fields, 'state':[('end','Cancel'),('sendmail','Send Mail')]} |
4651 | + 'result': {'type': 'form', 'arch': mail_form, 'fields': mail_fields, 'state': [('end', 'Cancel'), ('sendmail', 'Send Mail')]} |
4652 | }, |
4653 | 'sendmail': { |
4654 | 'actions': [_send_mail], |
4655 | - 'result': {'type':'state', 'state':'end'} |
4656 | + 'result': {'type': 'state', 'state': 'end'} |
4657 | } |
4658 | } |
4659 | wizard_email_interview('hr.email.interview') |
4660 | |
4661 | === modified file 'hr_payroll_declare/__init__.py' |
4662 | --- hr_payroll_declare/__init__.py 2010-01-20 11:54:30 +0000 |
4663 | +++ hr_payroll_declare/__init__.py 2013-12-23 20:13:10 +0000 |
4664 | @@ -1,8 +1,8 @@ |
4665 | #!/usr/bin/env python |
4666 | #-*- coding:utf-8 -*- |
4667 | -############################################################################## |
4668 | -# |
4669 | -# OpenERP, Open Source Management Solution |
4670 | +# |
4671 | +# |
4672 | +# OpenERP, Open Source Management Solution |
4673 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4674 | # d$ |
4675 | # |
4676 | @@ -19,6 +19,5 @@ |
4677 | # You should have received a copy of the GNU General Public License |
4678 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4679 | # |
4680 | -############################################################################## |
4681 | - |
4682 | -import hr_payroll_declare |
4683 | +# |
4684 | +from . import hr_payroll_declare |
4685 | |
4686 | === renamed file 'hr_payroll_declare/__terp__.py' => 'hr_payroll_declare/__openerp__.py' |
4687 | --- hr_payroll_declare/__terp__.py 2010-01-20 12:24:59 +0000 |
4688 | +++ hr_payroll_declare/__openerp__.py 2013-12-23 20:13:10 +0000 |
4689 | @@ -1,8 +1,8 @@ |
4690 | #!/usr/bin/env python |
4691 | #-*- coding:utf-8 -*- |
4692 | -############################################################################## |
4693 | -# |
4694 | -# OpenERP, Open Source Management Solution |
4695 | +# |
4696 | +# |
4697 | +# OpenERP, Open Source Management Solution |
4698 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4699 | # d$ |
4700 | # |
4701 | @@ -19,7 +19,7 @@ |
4702 | # You should have received a copy of the GNU General Public License |
4703 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4704 | # |
4705 | -############################################################################## |
4706 | +# |
4707 | |
4708 | { |
4709 | 'name': 'Human Resource Payroll Decleration Form', |
4710 | |
4711 | === modified file 'hr_payroll_declare/hr_payroll_declare.py' |
4712 | --- hr_payroll_declare/hr_payroll_declare.py 2010-07-06 06:47:27 +0000 |
4713 | +++ hr_payroll_declare/hr_payroll_declare.py 2013-12-23 20:13:10 +0000 |
4714 | @@ -1,8 +1,8 @@ |
4715 | #!/usr/bin/env python |
4716 | #-*- coding:utf-8 -*- |
4717 | -############################################################################## |
4718 | -# |
4719 | -# OpenERP, Open Source Management Solution |
4720 | +# |
4721 | +# |
4722 | +# OpenERP, Open Source Management Solution |
4723 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
4724 | # d$ |
4725 | # |
4726 | @@ -19,53 +19,51 @@ |
4727 | # You should have received a copy of the GNU General Public License |
4728 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4729 | # |
4730 | -############################################################################## |
4731 | - |
4732 | +# |
4733 | import time |
4734 | +from datetime import datetime |
4735 | +from datetime import timedelta |
4736 | |
4737 | -from osv import osv |
4738 | -from osv import fields |
4739 | +from osv import osv, fields |
4740 | from tools import config |
4741 | from tools.translate import _ |
4742 | -from datetime import datetime |
4743 | -from datetime import timedelta |
4744 | + |
4745 | |
4746 | class hr_payroll_declar(osv.osv): |
4747 | + |
4748 | ''' |
4749 | - Decleration Form |
4750 | + Declaration Form |
4751 | ''' |
4752 | _name = 'hr.payroll.declare' |
4753 | - _description = 'Decleration Form' |
4754 | - |
4755 | + _description = 'Declaration Form' |
4756 | _columns = { |
4757 | - 'name':fields.char('Name', size=1024, required=False), |
4758 | - 'company_id':fields.many2one('res.company', 'Company', required=True), |
4759 | - 'employee_id':fields.many2one('hr.employee', 'Employee', required=True), |
4760 | + 'name': fields.char('Name', size=1024, required=False), |
4761 | + 'company_id': fields.many2one('res.company', 'Company', required=True), |
4762 | + 'employee_id': fields.many2one('hr.employee', 'Employee', required=True), |
4763 | 'income_sal': fields.float('Income by Salary', digits=(16, int(config['price_accuracy'])), readonly=True), |
4764 | - 'income_ids':fields.one2many('hr.payroll.declare.line', 'income_id', 'Source Of Income', required=False), |
4765 | - 'investment_ids':fields.one2many('hr.payroll.declare.line', 'invest_id', 'Investments', required=False), |
4766 | - 'claim_ids':fields.one2many('hr.payroll.declare.line', 'claim_id', 'Allowance to Claime', required=False), |
4767 | + 'income_ids': fields.one2many('hr.payroll.declare.line', 'income_id', 'Source Of Income', required=False), |
4768 | + 'investment_ids': fields.one2many('hr.payroll.declare.line', 'invest_id', 'Investments', required=False), |
4769 | + 'claim_ids': fields.one2many('hr.payroll.declare.line', 'claim_id', 'Allowance to Claime', required=False), |
4770 | 'date': fields.date('Date'), |
4771 | - |
4772 | 'income': fields.float('Taxable Income', digits=(16, int(config['price_accuracy'])), readonly=True), |
4773 | 'investment': fields.float('Total Investment', digits=(16, int(config['price_accuracy'])), readonly=True), |
4774 | 'claims': fields.float('Total Allowance Claims', digits=(16, int(config['price_accuracy'])), readonly=True), |
4775 | - |
4776 | - 'state':fields.selection([ |
4777 | - ('draft','Draft'), |
4778 | - ('pending','Waiting for Review'), |
4779 | - ('pending','Approved by HR'), |
4780 | - ('done','Confirm'), |
4781 | - ],'State', select=True, readonly=True), |
4782 | - 'note': fields.text('Description'), |
4783 | + 'state': fields.selection([('draft', 'Draft'), |
4784 | + ('pending', 'Waiting for Review'), |
4785 | + ('pending', 'Approved by HR'), |
4786 | + ('done', 'Confirm'), |
4787 | + ], 'State', select=True, readonly=True), |
4788 | + 'note': fields.text('Description'), |
4789 | } |
4790 | - |
4791 | + |
4792 | def get_basic(self, cr, uid, ids, context): |
4793 | res = {} |
4794 | for rs in self.browse(cr, uid, ids, context): |
4795 | - period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0] |
4796 | - fiscalyear_id = self.pool.get('account.period').browse(cr, uid, period_id).fiscalyear_id |
4797 | - sql_req= ''' |
4798 | + period_id = self.pool.get('account.period').search( |
4799 | + cr, uid, [('date_start', '<=', time.strftime('%Y-%m-%d')), ('date_stop', '>=', time.strftime('%Y-%m-%d'))])[0] |
4800 | + fiscalyear_id = self.pool.get('account.period').browse( |
4801 | + cr, uid, period_id).fiscalyear_id |
4802 | + sql_req = ''' |
4803 | SELECT c.id as id, c.wage as wage, function as function, c.date_start as start, c.date_end as end |
4804 | FROM hr_contract c |
4805 | LEFT JOIN hr_employee emp on (c.employee_id=emp.id) |
4806 | @@ -76,24 +74,26 @@ |
4807 | (date_start >= %s) AND |
4808 | (date_end IS NULL OR date_end <= %s) |
4809 | ''' |
4810 | - cr.execute(sql_req, (rs.employee_id.id, fiscalyear_id.date_start, fiscalyear_id.date_stop)) |
4811 | + cr.execute( |
4812 | + sql_req, (rs.employee_id.id, fiscalyear_id.date_start, fiscalyear_id.date_stop)) |
4813 | contracts = cr.dictfetchall() |
4814 | if not contracts: |
4815 | - raise osv.except_osv(_('Contract Error !'), _('No Contract Defined for : %s ' % (rs.employee_id.name))) |
4816 | + raise osv.except_osv(_('Contract Error !'), _( |
4817 | + 'No Contract Defined for : %s ' % (rs.employee_id.name))) |
4818 | total = 0.0 |
4819 | - |
4820 | + |
4821 | line_ids = [] |
4822 | for lines in rs.claim_ids: |
4823 | line_ids += [lines.head_id.id] |
4824 | - |
4825 | + |
4826 | for ct in contracts: |
4827 | - allow = 0.0 |
4828 | - |
4829 | + # allow = 0.0 |
4830 | d1 = ct['start'] |
4831 | d2 = ct['end'] or fiscalyear_id.date_stop |
4832 | - td = datetime.fromtimestamp(time.mktime(time.strptime(d2, '%Y-%m-%d'))) - datetime.fromtimestamp(time.mktime(time.strptime(d1, '%Y-%m-%d'))) |
4833 | + td = datetime.fromtimestamp(time.mktime(time.strptime(d2, '%Y-%m-%d'))) - datetime.fromtimestamp( |
4834 | + time.mktime(time.strptime(d1, '%Y-%m-%d'))) |
4835 | total += (td.days / 30) * ct['wage'] |
4836 | - |
4837 | + |
4838 | # ct = self.pool.get('hr.contract').browse(cr, uid, ct['id']) |
4839 | # for line in ct.function.line_ids: |
4840 | # if line.category_id.id in line_ids: |
4841 | @@ -102,32 +102,30 @@ |
4842 | # elif line.amount_type == 'per': |
4843 | # allow += (total * line.amount) |
4844 | # print 'XXXXXXXXXXXXXXXXXXXXXXX : ', line.name, allow |
4845 | - |
4846 | res[rs.id] = total |
4847 | return res |
4848 | - |
4849 | + |
4850 | def write(self, cr, user, ids, vals, context=None): |
4851 | res = self.get_basic(cr, user, ids, context) |
4852 | for id in ids: |
4853 | vals['income_sal'] = res[id] |
4854 | super(hr_payroll_declar, self).write(cr, user, [id], vals, context) |
4855 | - |
4856 | return res |
4857 | - |
4858 | hr_payroll_declar() |
4859 | |
4860 | + |
4861 | class hr_payroll_declare_line(osv.osv): |
4862 | + |
4863 | ''' |
4864 | - Decleration Line |
4865 | + Declaration Line |
4866 | ''' |
4867 | _name = 'hr.payroll.declare.line' |
4868 | - _description = 'Decleration Line' |
4869 | - |
4870 | + _description = 'Declaration Line' |
4871 | + |
4872 | def _function_call(self, cr, uid, ids, field_names, arg, context={}): |
4873 | res = {} |
4874 | for rs in self.browse(cr, uid, ids, context): |
4875 | val = 0.0 |
4876 | - |
4877 | if rs.income_id: |
4878 | pass |
4879 | elif rs.invest_id: |
4880 | @@ -140,47 +138,44 @@ |
4881 | val = rs.amount |
4882 | elif rs.amount > rs.head_id.max: |
4883 | val = rs.head_id.max |
4884 | - |
4885 | res[rs.id] = val |
4886 | - |
4887 | return res |
4888 | - |
4889 | + |
4890 | _columns = { |
4891 | - 'name':fields.char('Name', size=64, required=False), |
4892 | + 'name': fields.char('Name', size=64, required=False), |
4893 | 'note': fields.text('Description'), |
4894 | - 'income_id':fields.many2one('hr.payroll.declare', 'Income', required=False), |
4895 | - 'invest_id':fields.many2one('hr.payroll.declare', 'Investment', required=False), |
4896 | - 'claim_id':fields.many2one('hr.payroll.declare', 'Allowance Claims', required=False), |
4897 | + 'income_id': fields.many2one('hr.payroll.declare', 'Income', required=False), |
4898 | + 'invest_id': fields.many2one('hr.payroll.declare', 'Investment', required=False), |
4899 | + 'claim_id': fields.many2one('hr.payroll.declare', 'Allowance Claims', required=False), |
4900 | 'amount': fields.float('Amount', digits=(16, int(config['price_accuracy']))), |
4901 | 'allow': fields.float('Allowence', digits=(16, int(config['price_accuracy']))), |
4902 | 'allow_amount': fields.function(_function_call, method=True, type='float', digits=(16, int(config['price_accuracy'])), string='Allow Amount'), |
4903 | - 'head_id':fields.many2one('hr.allounce.deduction.categoty', 'Allowance / Deduction', required=True), |
4904 | - |
4905 | + 'head_id': fields.many2one('hr.allounce.deduction.categoty', 'Allowance / Deduction', required=True), |
4906 | + |
4907 | } |
4908 | hr_payroll_declare_line() |
4909 | |
4910 | |
4911 | class payment_category(osv.osv): |
4912 | + |
4913 | ''' |
4914 | Allowance Deduction Categoty |
4915 | ''' |
4916 | _inherit = 'hr.allounce.deduction.categoty' |
4917 | - |
4918 | + |
4919 | _columns = { |
4920 | - 'calc_type':fields.selection([ |
4921 | - ('min_max','Min / Max'), |
4922 | - ('stmt','List of Calculations'), |
4923 | - ('range','Selection from Range'), |
4924 | - ],'Calculation Type', select=True, readonly=False), |
4925 | + 'calc_type': fields.selection([('min_max', 'Min / Max'), |
4926 | + ('stmt', 'List of Calculations'), |
4927 | + ('range', 'Selection from Range'), |
4928 | + ], 'Calculation Type', select=True, readonly=False), |
4929 | 'min': fields.float('Min Value', digits=(16, int(config['price_accuracy']))), |
4930 | 'max': fields.float('Max Value', digits=(16, int(config['price_accuracy']))), |
4931 | - |
4932 | - 'stmt_ids':fields.one2many('hr.payroll.declare.stmt', 'category_id', 'Functions', required=False), |
4933 | - 'stmt_select':fields.selection([ |
4934 | - ('min','Minimum'), |
4935 | - ('max','Maximum'), |
4936 | - ('avg','Average'), |
4937 | - ],'Selection Method', select=True, readonly=False), |
4938 | + |
4939 | + 'stmt_ids': fields.one2many('hr.payroll.declare.stmt', 'category_id', 'Functions', required=False), |
4940 | + 'stmt_select': fields.selection([('min', 'Minimum'), |
4941 | + ('max', 'Maximum'), |
4942 | + ('avg', 'Average'), |
4943 | + ], 'Selection Method', select=True, readonly=False), |
4944 | } |
4945 | _defaults = { |
4946 | 'stmt_select': lambda *a: 'min', |
4947 | @@ -188,18 +183,20 @@ |
4948 | } |
4949 | payment_category() |
4950 | |
4951 | + |
4952 | class payment_stmt(osv.osv): |
4953 | + |
4954 | ''' |
4955 | Open ERP Model |
4956 | ''' |
4957 | _name = 'hr.payroll.declare.stmt' |
4958 | _description = 'Payroll Calculations' |
4959 | - |
4960 | + |
4961 | _columns = { |
4962 | - 'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Category', required=True), |
4963 | - 'name':fields.char('Expression', size=1024, required=True, readonly=False), |
4964 | + 'category_id': fields.many2one('hr.allounce.deduction.categoty', 'Category', required=True), |
4965 | + 'name': fields.char('Expression', size=1024, required=True, readonly=False), |
4966 | 'sequence': fields.integer('Sequence'), |
4967 | - 'active':fields.boolean('Active', required=False), |
4968 | + 'active': fields.boolean('Active', required=False), |
4969 | } |
4970 | _defaults = { |
4971 | 'sequence': lambda *a: 5, |
4972 | |
4973 | === modified file 'hr_performance/__init__.py' |
4974 | --- hr_performance/__init__.py 2009-10-15 11:25:40 +0000 |
4975 | +++ hr_performance/__init__.py 2013-12-23 20:13:10 +0000 |
4976 | @@ -1,6 +1,6 @@ |
4977 | # -*- encoding: utf-8 -*- |
4978 | -############################################################################## |
4979 | -# |
4980 | +# |
4981 | +# |
4982 | # OpenERP, Open Source Management Solution |
4983 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
4984 | # |
4985 | @@ -15,8 +15,8 @@ |
4986 | # GNU Affero General Public License for more details. |
4987 | # |
4988 | # You should have received a copy of the GNU Affero General Public License |
4989 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4990 | -# |
4991 | -############################################################################## |
4992 | -import hr_performance |
4993 | -import report |
4994 | \ No newline at end of file |
4995 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4996 | +# |
4997 | +# |
4998 | +from . import hr_performance |
4999 | +from . import report |
5000 |
The diff has been truncated for viewing.
These modules should not be here with wizard.interfaces, a lot of them.