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
=== modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py'
--- bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py 2015-05-28 12:04:30 +0000
+++ bin/addons/msf_homere_interface/wizard/hr_payroll_employee_import.py 2016-04-26 12:16:26 +0000
@@ -196,8 +196,23 @@
196 Check that:196 Check that:
197 - no more than 1 employee exist for "missioncode + staff_id + uniq_id"197 - no more than 1 employee exist for "missioncode + staff_id + uniq_id"
198 - only one employee have this staffcode198 - only one employee have this staffcode
199 :return (ok, what_changed)
200 :rtype tuple
199 """201 """
200 # Some verifications202 def changed(mission1, mission2, staff1, staff2, unique1, unique2):
203 res = None
204 if mission1 != mission2:
205 res = 'mission'
206 elif staff1 != staff2:
207 res = 'staff'
208 elif unique1 != unique2:
209 res = 'unique'
210 return res
211
212 res = False
213 what_changed = None
214
215 # Checks
201 if not staffcode or not missioncode or not staff_id or not uniq_id:216 if not staffcode or not missioncode or not staff_id or not uniq_id:
202 name = employee_name or _('Nonamed Employee')217 name = employee_name or _('Nonamed Employee')
203 message = _('Unknown error for employee %s') % name218 message = _('Unknown error for employee %s') % name
@@ -210,24 +225,16 @@
210 elif not uniq_id:225 elif not uniq_id:
211 message = _('No "id_unique" found for employee %s!') % (name,)226 message = _('No "id_unique" found for employee %s!') % (name,)
212 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})227 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})
213 return False228 return (res, what_changed, )
229
214 # Check employees230 # Check employees
215 search_ids = self.pool.get('hr.employee').search(cr, uid, [('homere_codeterrain', '=', missioncode), ('homere_id_staff', '=', staff_id), ('homere_id_unique', '=', uniq_id)])231 search_ids = self.pool.get('hr.employee').search(cr, uid, [('homere_codeterrain', '=', missioncode), ('homere_id_staff', '=', staff_id), ('homere_id_unique', '=', uniq_id)])
216 if search_ids and len(search_ids) > 1:232 if search_ids and len(search_ids) > 1:
217 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,)})233 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,)})
218 return False234 return (res, what_changed, )
235
219 # Check staffcode236 # Check staffcode
220 staffcode_ids = self.pool.get('hr.employee').search(cr, uid, [('identification_id', '=', staffcode)])237 staffcode_ids = self.pool.get('hr.employee').search(cr, uid, [('identification_id', '=', staffcode)])
221 what_changed = None
222 def changed(mission1, mission2, staff1, staff2, unique1, unique2):
223 res = None
224 if mission1 != mission2:
225 res = 'mission'
226 elif staff1 != staff2:
227 res = 'staff'
228 elif unique1 != unique2:
229 res = 'unique'
230 return res
231 if staffcode_ids:238 if staffcode_ids:
232 message = "Several employee have the same ID code: "239 message = "Several employee have the same ID code: "
233 employee_error_list = []240 employee_error_list = []
@@ -241,8 +248,10 @@
241 if employee_error_list:248 if employee_error_list:
242 message += ' ; '.join([employee_name] + employee_error_list)249 message += ' ; '.join([employee_name] + employee_error_list)
243 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})250 self.pool.get('hr.payroll.employee.import.errors').create(cr, uid, {'wizard_id': wizard_id, 'msg': message})
244 return False, what_changed251 return (res, what_changed, )
245 return True, what_changed252
253 res = True
254 return (res, what_changed, )
246255
247 def read_employee_infos(self, cr, uid, line='', context=None):256 def read_employee_infos(self, cr, uid, line='', context=None):
248 """257 """

Subscribers

People subscribed via source and target branches

to all changes: