~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to msf_homere_interface/wizard/hr_payroll_employee_import.py

  • Committer: dvo at dvo
  • Date: 2016-02-25 15:58:51 UTC
  • Revision ID: dvo@dvo-20160225155851-fgrqay5mnsi3wc1d
US-671: Search for the cost center from codeterrain and set this value, if not, set empty

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
            # UTP-1098: If what_changed is not None, we should search the employee only on code_staff
309
309
            if what_changed:
310
310
                e_ids = self.pool.get('hr.employee').search(cr, uid, [('identification_id', '=', ustr(code_staff)), ('name', '=', employee_name)])
 
311
                
311
312
            # Prepare vals
312
313
            res = False
313
314
            vals = {
388
389
            # Desactivate employee if no current contract
389
390
            if not current_contract:
390
391
                vals.update({'active': False})
 
392
                
 
393
            # US-671: Search for the cost center from codeterrain and set this value, if not, set empty
 
394
            account_analytic_obj = self.pool.get('account.analytic.account')
 
395
            cc_ids = account_analytic_obj.search(cr, uid,[('code', '=', codeterrain)])
 
396
            if cc_ids and len(cc_ids) == 1:
 
397
                vals.update({'cost_center_id': cc_ids[0],})
 
398
                
391
399
            if not e_ids:
392
400
                res = self.pool.get('hr.employee').create(cr, uid, vals, {'from': 'import'})
393
401
                if res: