Merge lp:~mukunde/unifield-server/US-7624 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6373
Proposed branch: lp:~mukunde/unifield-server/US-7624
Merge into: lp:unifield-server
Diff against target: 128 lines (+49/-12)
3 files modified
bin/addons/msf_homere_interface/wizard/hr_expat_import.py (+23/-11)
bin/addons/msf_profile/i18n/fr_MF.po (+24/-0)
bin/addons/msf_tools/automated_import_job.py (+2/-1)
To merge this branch: bzr merge lp:~mukunde/unifield-server/US-7624
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+423948@code.launchpad.net
To post a comment you must log in.
lp:~mukunde/unifield-server/US-7624 updated
6241. By Gaël Mukunde

MERGE

6242. By Gaël Mukunde

US-7624 [FIX] Fix bug when identification is not set

6243. By Gaël Mukunde

US-7624 [FIX] Fix bulk write of created/updated rows

6244. By Gaël Mukunde

US-7624 [FIX] Modify error message to avoid redundant words when using auto import.

6245. By Gaël Mukunde

US-7624 [FIX] Fix count of rejected rows.

6246. By Gaël Mukunde

US-7624 [FIX] Add Translation

6247. By Gaël Mukunde

US-7624 [FIX] Add translation

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_expat_import.py'
2--- bin/addons/msf_homere_interface/wizard/hr_expat_import.py 2022-06-15 08:56:10 +0000
3+++ bin/addons/msf_homere_interface/wizard/hr_expat_import.py 2022-12-13 09:31:49 +0000
4@@ -72,6 +72,8 @@
5 created = 0
6 updated = 0
7 processed = 0
8+ to_update_vals = []
9+ to_create_vals = []
10 # Check that a file is given
11 if not wiz.file:
12 raise osv.except_osv(_('Error'), _('No file given'))
13@@ -109,20 +111,17 @@
14 continue # inserting an invalid date format in the DB would fail
15 else:
16 contract_end_date_str = contract_end_date and contract_end_date.strftime('%Y-%m-%d') or ''
17- code = get_xml_spreadheet_cell_value(1).strip()
18+ code = get_xml_spreadheet_cell_value(1) and get_xml_spreadheet_cell_value(1).strip()
19 if not code:
20- msg = "At least one employee in the import file does not" \
21- " have an ID number; make sure all employees in the" \
22- " file have an ID number and run the import again."
23+ msg = _('THE EMPLOYEE DOES NOT HAVE AN ID NUMBER AT LINE %d.') % line_index
24 manage_error(line_index, msg, name, contract_end_date=contract_end_date_str)
25 active_str = get_xml_spreadheet_cell_value(2)
26 if not active_str:
27- msg = "Active column is missing or empty at line %d" % line_index
28+ msg = _("Active column is missing or empty at line %d") % line_index
29 manage_error(line_index, msg, name, code, contract_end_date=contract_end_date_str)
30 active_str = active_str and active_str.lower() or ''
31 if active_str not in ('active', 'inactive'):
32- msg = "Active column invalid value line %d" \
33- " (should be Active/Inactive)" % line_index
34+ msg = _("Active column invalid value line %d (should be Active/Inactive)") % line_index
35 manage_error(line_index, msg, name, code, active_str, contract_end_date=contract_end_date_str)
36 active = active_str == 'active' or False
37
38@@ -142,20 +141,33 @@
39 if handle_contract_end_date:
40 vals.update({'contract_end_date': contract_end_date})
41 if ids:
42- # Update name of Expat employee
43- hr_emp_obj.write(cr, uid, [ids[0]], vals, context=context)
44+ # Store name of Expat employee to update
45+ to_update_vals.append(([ids[0]], vals))
46 updated += 1
47 else:
48- # Create Expat employee
49+ # Store Expat employee to create
50 vals.update(
51 {
52 'type': 'ex',
53 'identification_id': code,
54 }
55 )
56- hr_emp_obj.create(cr, uid, vals, context=context)
57+ to_create_vals.append(vals)
58 created += 1
59 line_index += 1
60+ if not rejected_lines:
61+ for vals in to_update_vals:
62+ hr_emp_obj.write(cr, uid, vals[0], vals[1], context=context)
63+ for vals in to_create_vals:
64+ hr_emp_obj.create(cr, uid, vals, context=context)
65+ else: # US-7624: To avoid partial import, reject all lines if there is at least one invalid employee line
66+ created = 0
67+ updated = 0
68+ rejected_idx = [i[0] for i in rejected_lines] # get line number of each rejected line
69+ temp = [(t[0], t[1], '') for t in processed_lines if
70+ t[0] not in rejected_idx] # add an empty error column to valid lines
71+ rejected_lines += temp
72+ rejected_lines.sort(key=lambda j: j[0]) # sort on line number
73
74 context.update({'message': ' ', 'from': 'expat_import'})
75
76
77=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
78--- bin/addons/msf_profile/i18n/fr_MF.po 2022-11-23 11:30:06 +0000
79+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-12-13 09:31:49 +0000
80@@ -115633,6 +115633,12 @@
81 msgid "Cannot update these products, ED/BN attributes have not changed since the KCL creation"
82 msgstr "Impossible de mettre à jour ces produits. Les attributs NL/DE n'ont pas changé depuis la création du Kit"
83
84+#. module: msf_homere_interface
85+#: code:addons/msf_homere_interface/wizard/hr_expat_import.py:114
86+#, python-format
87+msgid "THE EMPLOYEE DOES NOT HAVE AN ID NUMBER."
88+msgstr "L'EMPLOYÉ N'A PAS DE NUMÉRO D'IDENTIFICATION"
89+
90 #. module: board
91 #: report:addons/board/report/integrity.mako:83
92 msgid "Filter used: "
93@@ -117889,3 +117895,21 @@
94 #, python-format
95 msgid "Both EoY Revaluation have been done in %s"
96 msgstr "Les deux réévaluations de fin d'année ont déjà été faite dans %s"
97+
98+#. module: msf_homere_interface
99+#: code:addons/msf_homere_interface/wizard/hr_expat_import.py:116
100+#, python-format
101+msgid "THE EMPLOYEE DOES NOT HAVE AN ID NUMBER AT LINE %d."
102+msgstr "L'EMPLOYÉ N'A PAS DE NUMÉRO D'IDENTIFICATION À LA LIGNE %d."
103+
104+#. module: msf_homere_interface
105+#: code:addons/msf_homere_interface/wizard/hr_expat_import.py:124
106+#, python-format
107+msgid "Active column invalid value line %d (should be Active/Inactive)"
108+msgstr "Valeur invalide dans la colonne statut ligne %d (devrait être active/inactive)"
109+
110+#. module: msf_homere_interface
111+#: code:addons/msf_homere_interface/wizard/hr_expat_import.py:120
112+#, python-format
113+msgid "Active column is missing or empty at line %d"
114+msgstr "Valeur manquante ou vide dans la colonne statut à la ligne %d"
115
116=== modified file 'bin/addons/msf_tools/automated_import_job.py'
117--- bin/addons/msf_tools/automated_import_job.py 2022-08-22 09:59:30 +0000
118+++ bin/addons/msf_tools/automated_import_job.py 2022-12-13 09:31:49 +0000
119@@ -353,7 +353,8 @@
120 nb_processed += self.generate_file_report(cr, uid, job, processed, headers, remote=remote)
121
122 if rejected:
123- nb_rejected += self.generate_file_report(cr, uid, job, rejected, headers, remote=remote, rejected=True)
124+ nb_rejected = nb_processed # US-7624 If one row is not correct, all processed rows are rejected
125+ self.generate_file_report(cr, uid, job, rejected, headers, remote=remote, rejected=True)
126 state = 'error'
127 for resjected_line in rejected:
128 line_message = ''

Subscribers

People subscribed via source and target branches