Merge lp:~unifield-team/unifield-server/us-1183 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 3736
Proposed branch: lp:~unifield-team/unifield-server/us-1183
Merge into: lp:unifield-server
Diff against target: 70 lines (+24/-15)
1 file modified
bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py (+24/-15)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1183
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+292926@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py'
2--- bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py 2015-05-28 12:04:30 +0000
3+++ bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py 2016-04-26 12:16:26 +0000
4@@ -196,8 +196,23 @@
5 Check that:
6 - no more than 1 employee exist for "missioncode + staff_id + uniq_id"
7 - only one employee have this staffcode
8+ :return (ok, what_changed)
9+ :rtype tuple
10 """
11- # Some verifications
12+ def changed(mission1, mission2, staff1, staff2, unique1, unique2):
13+ res = None
14+ if mission1 != mission2:
15+ res = 'mission'
16+ elif staff1 != staff2:
17+ res = 'staff'
18+ elif unique1 != unique2:
19+ res = 'unique'
20+ return res
21+
22+ res = False
23+ what_changed = None
24+
25+ # Checks
26 if not staffcode or not missioncode or not staff_id or not uniq_id:
27 name = employee_name or _('Nonamed Employee')
28 message = _('Unknown error for employee %s') % name
29@@ -210,24 +225,16 @@
30 elif not uniq_id:
31 message = _('No "id_unique" found for employee %s!') % (name,)
32 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})
33- return False
34+ return (res, what_changed, )
35+
36 # Check employees
37 search_ids = self.pool.get('hr.employee').search(cr, uid, [('homere_codeterrain', '=', missioncode), ('homere_id_staff', '=', staff_id), ('homere_id_unique', '=', uniq_id)])
38 if search_ids and len(search_ids) > 1:
39 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': _("Database have more than one employee with the unique code of this employee: %s") % (employee_name,)})
40- return False
41+ return (res, what_changed, )
42+
43 # Check staffcode
44 staffcode_ids = self.pool.get('hr.employee').search(cr, uid, [('identification_id', '=', staffcode)])
45- what_changed = None
46- def changed(mission1, mission2, staff1, staff2, unique1, unique2):
47- res = None
48- if mission1 != mission2:
49- res = 'mission'
50- elif staff1 != staff2:
51- res = 'staff'
52- elif unique1 != unique2:
53- res = 'unique'
54- return res
55 if staffcode_ids:
56 message = "Several employee have the same ID code: "
57 employee_error_list = []
58@@ -241,8 +248,10 @@
59 if employee_error_list:
60 message += ' ; '.join([employee_name] + employee_error_list)
61 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})
62- return False, what_changed
63- return True, what_changed
64+ return (res, what_changed, )
65+
66+ res = True
67+ return (res, what_changed, )
68
69 def read_employee_infos(self, cr, uid, line='', context=None):
70 """

Subscribers

People subscribed via source and target branches

to all changes: