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

Proposed by jftempo
Status: Merged
Merged at revision: 6313
Proposed branch: lp:~mukunde/unifield-server/US-10124
Merge into: lp:unifield-server
Diff against target: 163 lines (+30/-26)
3 files modified
bin/addons/msf_homere_interface/hr_payroll_wizard.xml (+2/-3)
bin/addons/msf_homere_interface/wizard/hr_payroll_import.py (+20/-23)
bin/addons/msf_profile/i18n/fr_MF.po (+8/-0)
To merge this branch: bzr merge lp:~mukunde/unifield-server/US-10124
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+425389@code.launchpad.net
To post a comment you must log in.
lp:~mukunde/unifield-server/US-10124 updated
6258. By Gaël Mukunde

US-10124 [IMP] Write payroll entries dispite AD errors but block employee AD update with erroneous distribution + translation

6259. By Gaël Mukunde

US-10124 [IMP] Code fix to only block the update of erroneous Emp AD instead of blocking all the Emp AD update

6260. By Gaël Mukunde

US-10124 [IMP] Do AD checks in proceed state also to simplify code

6261. By Gaël Mukunde

US-10124 [MERGE] Merge with Trunk

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/hr_payroll_wizard.xml'
2--- bin/addons/msf_homere_interface/hr_payroll_wizard.xml 2022-06-16 14:59:26 +0000
3+++ bin/addons/msf_homere_interface/hr_payroll_wizard.xml 2022-09-19 12:45:05 +0000
4@@ -126,7 +126,7 @@
5 </p>
6 </html>
7 </group>
8- <field name="error_line_ids" nolabel="1" colspan="4">
9+ <field name="error_line_ids" nolabel="1" colspan="4" attrs="{'invisible': [('state', '=', 'payroll')]}">
10 <tree string="Error List">
11 <field name="msg"/>
12 </tree>
13@@ -173,10 +173,9 @@
14 <field name="file" filename="filename"/>
15 <field name="filename" invisible="1"/>
16 <field name="date_format"/>
17- <field name="blocked" invisible="1" />
18 <newline/>
19 <group colspan="4" col="2"
20- attrs="{'invisible': [('blocked', '=', False), ('state', '=', 'simu')]}">
21+ attrs="{'invisible': [('state', '=', 'simu')]}">
22 <field name="msg" colspan="4"/>
23 </group>
24 <group colspan="4" col="2"
25
26=== modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_import.py'
27--- bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2022-06-16 14:59:26 +0000
28+++ bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2022-09-19 12:45:05 +0000
29@@ -73,7 +73,6 @@
30 'filename': fields.char(string="Imported filename", size=256),
31 'date_format': fields.selection([('%d/%m/%Y', 'dd/mm/yyyy'), ('%m-%d-%Y', 'mm-dd-yyyy'), ('%d-%m-%y', 'dd-mm-yy'), ('%d-%m-%Y', 'dd-mm-yyyy'), ('%d/%m/%y', 'dd/mm/yy'), ('%d.%m.%Y', 'dd.mm.yyyy')], "Date format", required=True, help="This is the date format used in the Homère file in order to recognize them."),
32 'msg': fields.text(string='Message'),
33- 'blocked': fields.boolean('Is import blocked'),
34 }
35
36 _defaults = {
37@@ -132,7 +131,7 @@
38 created = 0
39 vals = {}
40 error_message = ""
41- blocking_message = []
42+ ad_errors_message = []
43 # verify that some data exists
44 if not data:
45 return False, res_amount, created, vals, "", error_message, bs_only
46@@ -335,27 +334,27 @@
47 'free1_id': employee_data and employee_data.get('free1_id', False) and employee_data.get('free1_id')[0] or False,
48 'free2_id': employee_data and employee_data.get('free2_id', False) and employee_data.get('free2_id')[0] or False,
49 })
50- if wiz_state == 'simu' and to_update_employee:
51+ if to_update_employee:
52 #check cc compat on (cost_center_id, destination_id, employee_data.funding_pool_id)
53 if cost_center_id and destination_id and not ad_obj.check_dest_cc_compatibility(cr, uid, destination_id, cost_center_id, context=context):
54- blocking_message.append(_('Employee %s: the Cost Center %s is not compatible with the Destination %s.') % (employee_data['name_resource'], cost_center_code, destination_code))
55+ ad_errors_message.append(_('Employee %s: the Cost Center %s is not compatible with the Destination %s.') % (employee_data['name_resource'], cost_center_code, destination_code))
56 fp_id = employee_data.get('funding_pool_id', False) and employee_data.get('funding_pool_id')[0]
57 if fp_id and cost_center_id and not ad_obj.check_fp_cc_compatibility(cr, uid, fp_id, cost_center_id, context=context):
58- blocking_message.append(_('Employee %s: the Cost Center %s is not compatible with the Funding Pool %s.') % (employee_data['name_resource'], cost_center_code, employee_data.get('funding_pool_id')[1]))
59+ ad_errors_message.append(_('Employee %s: the Cost Center %s is not compatible with the Funding Pool %s.') % (employee_data['name_resource'], cost_center_code, employee_data.get('funding_pool_id')[1]))
60 # Write payroll entry
61 if wiz_state != 'simu':
62 #US-671: In the process mode, update the employee cost center and destination, and use also this one for the payroll object.
63 ############################ UPDATE THE EMPLOYEE! AND PREPARE THE LOG FILE WITH WARNING!
64- if to_update_employee and employee_id:
65+ # US-10124: Only update AD of Employees without AD errors in payroll file
66+ if to_update_employee and employee_id and not ad_errors_message and not error_message:
67 self.pool.get('hr.employee').write(cr, uid, [employee_id], {'cost_center_id': cost_center_id, 'destination_id': destination_id,}, context)
68
69- res = self.pool.get('hr.payroll.msf').create(cr, uid, vals,
70- context={'from': 'import'})
71+ res = self.pool.get('hr.payroll.msf').create(cr, uid, vals, context={'from': 'import'})
72 if res:
73 created += 1
74 else:
75 created += 1
76- return True, amount, created, vals, currency[0], error_message, blocking_message, bs_only
77+ return True, amount, created, vals, currency[0], error_message, ad_errors_message, bs_only
78
79 def _get_homere_password(self, cr, uid, pass_type='payroll'):
80 ##### UPDATE HOMERE.CONF FILE #####
81@@ -524,7 +523,7 @@
82
83 filename = ""
84 error_msg = ""
85- blocking_msg = []
86+ ad_errors_msg = []
87 wiz_state = False
88 # Browse all given wizard
89 for wiz in self.browse(cr, uid, ids):
90@@ -587,14 +586,14 @@
91 for line in reader:
92 num_line += 1
93 processed += 1
94- update, amount, nb_created, vals, ccy, msg, blocking_message, bs_only = self.update_payroll_entries(
95+ update, amount, nb_created, vals, ccy, msg, ad_errors_message, bs_only = self.update_payroll_entries(
96 cr, uid, data=line, field=field,
97 date_format=wiz.date_format,
98 wiz_state=wiz.state,
99 bs_only=bs_only)
100 res_amount += round(amount, 2)
101- for block in blocking_message:
102- blocking_msg.append(_("Line %s: %s") % (str(num_line), block))
103+ for block in ad_errors_message:
104+ ad_errors_msg.append(_("Line %s: %s") % (str(num_line), block))
105 if not update:
106 res = False
107 if num_line == 2: # the first line containing data
108@@ -666,20 +665,16 @@
109 if wiz_state == 'simu' and ids:
110 # US_201: if check raise no error, change state to process
111 # US-671: Show message in the wizard if there was warning or not.
112- wiz_state = 'proceed'
113- blocked = False
114- if blocking_msg:
115- error_msg = '%s:\n--------------------\n%s' % (_('Please correct following employee analytic distribution errors to allow Import to be processed'), "\n".join(blocking_msg))
116- wiz_state = 'simu'
117- blocked = True
118+ if ad_errors_msg:
119+ error_msg = '%s\n--------------------\n%s' % (_('Import can be processed but with the warnings below. \n'
120+ '(If analytic distribution in payroll is invalid, employee analytic distribution will remain untouched).'), "\n".join(ad_errors_msg))
121 elif error_msg:
122 error_msg = _("Import can be processed but with the following warnings:\n-------------------- \n") + error_msg
123 else:
124 error_msg = _("No warning found for this file. Import can be now processed.")
125
126- self.write(cr, uid, [wiz.id], {'state': wiz_state, 'msg': error_msg, 'blocked': blocked})
127- view_id = self.pool.get('ir.model.data').get_object_reference(cr,
128- uid, 'msf_homere_interface', 'payroll_import_wizard')
129+ self.write(cr, uid, [wiz.id], {'state': 'proceed', 'msg': error_msg})
130+ view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'msf_homere_interface', 'payroll_import_wizard')
131 view_id = view_id and view_id[1] or False
132
133 return {
134@@ -704,7 +699,9 @@
135 # This is to redirect to Payroll Tree View
136 context.update({'from': 'payroll_import'})
137
138- res_id = self.pool.get('hr.payroll.import.confirmation').create(cr, uid, {'filename': filename,'created': created, 'total': processed, 'state': 'payroll',}, context=context)
139+ res_id = self.pool.get('hr.payroll.import.confirmation')\
140+ .create(cr, uid, {'filename': filename,'created': created, 'total': processed, 'state': 'payroll'},
141+ context=context)
142
143 return {
144 'name': 'Payroll Import Confirmation',
145
146=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
147--- bin/addons/msf_profile/i18n/fr_MF.po 2022-08-23 13:15:58 +0000
148+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-09-19 12:45:05 +0000
149@@ -115505,6 +115505,14 @@
150 msgid "Import error for account \"%s\" : Listing both Accounts/Destinations and G/L Accounts is not allowed"
151 msgstr "Erreur lors de l'import du compte \"%s\" : Lister à la fois les Comptes/Destinations et les Comptes Grand Livre n'est pas permis"
152
153+#. module: msf_homere_interface
154+#: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:672
155+#, python-format
156+msgid "Import can be processed but with the warnings below. \n"
157+"(If analytic distribution in payroll is invalid, employee analytic distribution will remain untouched)."
158+msgstr "L'import peut passer mais avec les alertes listées ci-bas. \n"
159+"(Si la distribution analytique dans les fichiers de Paie est invalide, la distribution analytique de l'employé correspondant ne sera pas touchée)."
160+
161 #. module: account
162 #: model:ir.model,name:account.model_account_common_employee_report
163 msgid "Account Common Employee Report"

Subscribers

People subscribed via source and target branches