Merge lp:~unifield-team/unifield-wm/bklg-9 into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2392
Proposed branch: lp:~unifield-team/unifield-wm/bklg-9
Merge into: lp:unifield-wm
Diff against target: 103 lines (+30/-14)
4 files modified
msf_homere_interface/hr_payroll_wizard.xml (+1/-1)
msf_homere_interface/hr_view.xml (+1/-1)
msf_homere_interface/wizard/hr_expat_import.py (+23/-11)
msf_homere_interface/wizard/hr_payroll_employee_import.py (+5/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/bklg-9
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+248506@code.launchpad.net
To post a comment you must log in.
lp:~unifield-team/unifield-wm/bklg-9 updated
2370. By Vincent GREINER

BKLG-9 [FIX] hr expat import: when proceeded directly go to regular tree view (we do not take care about 'transaction import tree view')

2371. By Vincent GREINER

BKLG-9 [IMP] hr expat import: do not import file if any entry has no staff number

2372. By Vincent GREINER

[FIX] after expat import going to regular employee tree without bypassing import confirmation wizard...

2373. By Vincent GREINER

BKLG-9 [IMP] expat import: in confirmation wizard display the count of updated entries

2374. By Vincent GREINER

BKLG-9 [FIX] expat import: confirmation wizard return duplicate

2375. By Vincent GREINER

BKLG-9 [FIX] expat import: protect import when importing a file with a line with one cell (no code cell value)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'msf_homere_interface/hr_payroll_wizard.xml'
2--- msf_homere_interface/hr_payroll_wizard.xml 2013-10-28 12:59:14 +0000
3+++ msf_homere_interface/hr_payroll_wizard.xml 2015-02-10 16:01:23 +0000
4@@ -85,7 +85,7 @@
5 <field name="filename" attrs="{'invisible': [('filename', '=', False)]}"/>
6 <group colspan="4" col="6">
7 <field name="created" attrs="{'invisible': [('state', '=', 'none')]}"/>
8- <field name="updated" invisible="1"/> <!-- attrs="{'invisible': ['!', ('updated', '=', False), ('state', 'in', ['none', 'payroll'])]}"/-->
9+ <field name="updated" invisible="context.get('from', False) != 'expat_employee_import'"/> <!-- attrs="{'invisible': ['!', ('updated', '=', False), ('state', 'in', ['none', 'payroll'])]}"/-->
10 <field name="total" attrs="{'invisible': [('state', 'in', ['none', 'payroll'])]}"/>
11 </group>
12 <field name="error_line_ids" nolabel="1" colspan="4" attrs="{'invisible': [('nberrors', '=', 0)]}">
13
14=== modified file 'msf_homere_interface/hr_view.xml'
15--- msf_homere_interface/hr_view.xml 2013-10-25 14:35:48 +0000
16+++ msf_homere_interface/hr_view.xml 2015-02-10 16:01:23 +0000
17@@ -38,7 +38,7 @@
18 <separator colspan="2" string="Social IDs"/>
19 <field name="ssnid" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
20 <field name="sinid" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
21- <field name="identification_id" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)], 'required': [('employee_type', '=', 'local')]}"/>
22+ <field name="identification_id" attrs="{'readonly': ['|', '&amp;', ('employee_type', '=', 'local'), ('allow_edition', '=', False), '&amp;', ('employee_type', '=', 'ex'), ('identification_id', '!=', False)], 'required': [('employee_type', 'in', ('local', 'ex'))]}"/>
23 <field name="passport_id" attrs="{'readonly': [('employee_type', '=', 'local'), ('allow_edition', '=', False)]}"/>
24 </group>
25 <group col="2" colspan="2">
26
27=== modified file 'msf_homere_interface/wizard/hr_expat_import.py'
28--- msf_homere_interface/wizard/hr_expat_import.py 2013-04-05 09:17:24 +0000
29+++ msf_homere_interface/wizard/hr_expat_import.py 2015-02-10 16:01:23 +0000
30@@ -41,6 +41,7 @@
31 """
32 Import XLS file
33 """
34+ hr_emp_obj = self.pool.get('hr.employee')
35 # Some verifications
36 if not context:
37 context = {}
38@@ -62,25 +63,36 @@
39 reader = fileobj.getRows()
40 reader.next()
41 for line in reader:
42- processed += 1
43 name = line.cells and line.cells[0] and line.cells[0].data or False
44 if not name:
45 continue
46- code = line.cells and line.cells[1] and line.cells[1].data or False
47- # Create Expat employee
48- self.pool.get('hr.employee').create(cr, uid, {'name': line.cells[0].data, 'active': True, 'type': 'ex', 'identification_id': code})
49- created += 1
50-
51- context.update({'message': ' '})
52-
53+ code = line.cells and len(line.cells) > 1 and line.cells[1] and line.cells[1].data or False
54+ if not code:
55+ msg = "At least one employee in the import file does not" \
56+ " have an ID number; make sure all employees in the" \
57+ " file have an ID number and run the import again."
58+ raise osv.except_osv(_('Error'), _(msg))
59+ processed += 1
60+
61+ ids = hr_emp_obj.search(cr, uid,
62+ [('identification_id', '=', code)])
63+ if ids:
64+ # Update name of Expat employee
65+ hr_emp_obj.write(cr, uid, [ids[0]], {'name': name})
66+ updated += 1
67+ else:
68+ # Create Expat employee
69+ hr_emp_obj.create(cr, uid, {'name': line.cells[0].data, 'active': True, 'type': 'ex', 'identification_id': code})
70+ created += 1
71+
72+ context.update({'message': ' ', 'from': 'expat_import'})
73+
74 view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'msf_homere_interface', 'payroll_import_confirmation')
75 view_id = view_id and view_id[1] or False
76-
77+
78 # This is to redirect to Employee Tree View
79 context.update({'from': 'expat_employee_import'})
80-
81 res_id = self.pool.get('hr.payroll.import.confirmation').create(cr, uid, {'created': created, 'updated': updated, 'total': processed, 'state': 'employee'}, context=context)
82-
83 return {
84 'name': 'Expat Employee Import Confirmation',
85 'type': 'ir.actions.act_window',
86
87=== modified file 'msf_homere_interface/wizard/hr_payroll_employee_import.py'
88--- msf_homere_interface/wizard/hr_payroll_employee_import.py 2014-10-09 08:53:34 +0000
89+++ msf_homere_interface/wizard/hr_payroll_employee_import.py 2015-02-10 16:01:23 +0000
90@@ -117,8 +117,12 @@
91 domain = ""
92 context.update({'search_default_non_validated': 1})
93 if context.get('from') == 'expat_employee_import':
94- result = ('editable_view_employee_tree', 'hr.employee')
95 context.update({'search_default_employee_type_expatriate': 1})
96+ action = self.pool.get('ir.actions.act_window').for_xml_id(cr,
97+ uid, 'hr', 'open_view_employee_list_my', context=context)
98+ action['target'] = 'same'
99+ action['context'] = context
100+ return action
101 if context.get('from') == 'nat_staff_import':
102 result = ('inherit_view_employee_tree', 'hr.employee')
103 context.update({'search_default_employee_type_local': 1, 'search_default_active': 1})

Subscribers

People subscribed via source and target branches