Merge lp:~julie-w/unifield-server/US-5788 into lp:unifield-server/uf12
- US-5788
- Merge into uf12
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 5307 |
Proposed branch: | lp:~julie-w/unifield-server/US-5788 |
Merge into: | lp:unifield-server/uf12 |
Diff against target: |
214 lines (+74/-16) 4 files modified
bin/addons/msf_homere_interface/wizard/hr_payroll_import.py (+24/-10) bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py (+21/-6) bin/addons/msf_profile/i18n/fr_MF.po (+28/-0) bin/addons/sync_client/orm.py (+1/-0) |
To merge this branch: | bzr merge lp:~julie-w/unifield-server/US-5788 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email:
|
Commit message
Description of the change
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
1 | === modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_import.py' | |||
2 | --- bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2018-12-07 13:34:24 +0000 | |||
3 | +++ bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2019-03-28 11:11:55 +0000 | |||
4 | @@ -503,6 +503,7 @@ | |||
5 | 503 | xyargv = self._get_homere_password(cr, uid, pass_type='payroll') | 503 | xyargv = self._get_homere_password(cr, uid, pass_type='payroll') |
6 | 504 | 504 | ||
7 | 505 | filename = "" | 505 | filename = "" |
8 | 506 | error_msg = "" | ||
9 | 506 | wiz_state = False | 507 | wiz_state = False |
10 | 507 | # Browse all given wizard | 508 | # Browse all given wizard |
11 | 508 | for wiz in self.browse(cr, uid, ids): | 509 | for wiz in self.browse(cr, uid, ids): |
12 | @@ -525,10 +526,11 @@ | |||
13 | 525 | if zipobj.namelist(): | 526 | if zipobj.namelist(): |
14 | 526 | namelist = zipobj.namelist() | 527 | namelist = zipobj.namelist() |
15 | 527 | # Search CSV | 528 | # Search CSV |
17 | 528 | csvfile = None | 529 | csvfiles = [] |
18 | 530 | currency_list = [] | ||
19 | 529 | for name in namelist: | 531 | for name in namelist: |
20 | 530 | if name.split(file_ext_separator) and name.split(file_ext_separator)[-1] == file_ext: | 532 | if name.split(file_ext_separator) and name.split(file_ext_separator)[-1] == file_ext: |
22 | 531 | csvfile = name | 533 | csvfiles.append(name) |
23 | 532 | if not 'envoi.ini' in namelist: | 534 | if not 'envoi.ini' in namelist: |
24 | 533 | raise osv.except_osv(_('Warning'), _('No envoi.ini file found in given ZIP file!')) | 535 | raise osv.except_osv(_('Warning'), _('No envoi.ini file found in given ZIP file!')) |
25 | 534 | # Read information from 'envoi.ini' file | 536 | # Read information from 'envoi.ini' file |
26 | @@ -542,8 +544,8 @@ | |||
27 | 542 | raise osv.except_osv(_('Error'), _('Could not read envoi.ini file in given ZIP file.')) | 544 | raise osv.except_osv(_('Error'), _('Could not read envoi.ini file in given ZIP file.')) |
28 | 543 | if not field: | 545 | if not field: |
29 | 544 | raise osv.except_osv(_('Warning'), _('Field not found in envoi.ini file.')) | 546 | raise osv.except_osv(_('Warning'), _('Field not found in envoi.ini file.')) |
32 | 545 | # Read CSV file | 547 | # Read CSV files |
33 | 546 | if csvfile: | 548 | for csvfile in csvfiles: |
34 | 547 | try: | 549 | try: |
35 | 548 | reader = csv.reader(zipobj.open(csvfile, 'r', xyargv), delimiter=';', quotechar='"', doublequote=False, escapechar='\\') | 550 | reader = csv.reader(zipobj.open(csvfile, 'r', xyargv), delimiter=';', quotechar='"', doublequote=False, escapechar='\\') |
36 | 549 | reader.next() | 551 | reader.next() |
37 | @@ -553,8 +555,10 @@ | |||
38 | 553 | res = True | 555 | res = True |
39 | 554 | res_amount = 0.0 | 556 | res_amount = 0.0 |
40 | 555 | amount = 0.0 | 557 | amount = 0.0 |
42 | 556 | error_msg = "" | 558 | num_line = 1 # the header line is not taken into account |
43 | 559 | file_error_msg = "" # store the error/warning messages for the current file | ||
44 | 557 | for line in reader: | 560 | for line in reader: |
45 | 561 | num_line += 1 | ||
46 | 558 | processed += 1 | 562 | processed += 1 |
47 | 559 | update, amount, nb_created, vals, ccy, msg = self.update_payroll_entries( | 563 | update, amount, nb_created, vals, ccy, msg = self.update_payroll_entries( |
48 | 560 | cr, uid, data=line, field=field, | 564 | cr, uid, data=line, field=field, |
49 | @@ -563,13 +567,22 @@ | |||
50 | 563 | res_amount += round(amount, 2) | 567 | res_amount += round(amount, 2) |
51 | 564 | if not update: | 568 | if not update: |
52 | 565 | res = False | 569 | res = False |
54 | 566 | if created == 0: | 570 | if num_line == 2: # the first line containing data |
55 | 567 | header_vals = vals | 571 | header_vals = vals |
57 | 568 | header_vals['currency_code'] = ccy | 572 | header_vals['currency_code'] = ccy # note that the curr. is different from one file to another |
58 | 573 | if ccy in currency_list: | ||
59 | 574 | raise osv.except_osv(_('Error'), _('Several files contain lines with the currency %s. ' | ||
60 | 575 | 'Please use one file per currency.') % ccy) | ||
61 | 576 | currency_list.append(ccy) | ||
62 | 569 | created += nb_created | 577 | created += nb_created |
63 | 570 | 578 | ||
64 | 571 | if msg: | 579 | if msg: |
66 | 572 | error_msg += "Line " + str(processed) + ": " + msg + " \n" | 580 | file_error_msg += _("Line %s: %s\n") % (str(num_line), msg) |
67 | 581 | |||
68 | 582 | # complete the list of error messages with the ones from this file if any | ||
69 | 583 | if file_error_msg: | ||
70 | 584 | # add a line break between files | ||
71 | 585 | error_msg += _("%sFile %s:\n%s") % (error_msg and "\n" or "", csvfile, file_error_msg) | ||
72 | 573 | 586 | ||
73 | 574 | # Check balance | 587 | # Check balance |
74 | 575 | res_amount_rounded = round(res_amount, 2) | 588 | res_amount_rounded = round(res_amount, 2) |
75 | @@ -585,7 +598,8 @@ | |||
76 | 585 | pr_ids = self.pool.get('hr.payroll.msf').search( | 598 | pr_ids = self.pool.get('hr.payroll.msf').search( |
77 | 586 | cr, uid, [ | 599 | cr, uid, [ |
78 | 587 | ('state', '=', 'draft'), | 600 | ('state', '=', 'draft'), |
80 | 588 | ('name', '=', 'Payroll rounding') | 601 | ('name', '=', 'Payroll rounding'), |
81 | 602 | ('currency_id', '=', header_vals['currency_id']), | ||
82 | 589 | ]) | 603 | ]) |
83 | 590 | if not pr_ids: | 604 | if not pr_ids: |
84 | 591 | # no SAGA BALANCE rounding line in file | 605 | # no SAGA BALANCE rounding line in file |
85 | @@ -611,7 +625,7 @@ | |||
86 | 611 | # - add both | 625 | # - add both |
87 | 612 | new_amount = round(pr.amount, 2) + (-1 * res_amount_rounded) | 626 | new_amount = round(pr.amount, 2) + (-1 * res_amount_rounded) |
88 | 613 | self.pool.get('hr.payroll.msf').write(cr, uid, pr_ids[0], {'amount': round(new_amount, 2),}) | 627 | self.pool.get('hr.payroll.msf').write(cr, uid, pr_ids[0], {'amount': round(new_amount, 2),}) |
90 | 614 | else: | 628 | if not csvfiles: |
91 | 615 | raise osv.except_osv(_('Error'), _('Right CSV is not present in this zip file. Please use "File > File sending > Monthly" in Homère.')) | 629 | raise osv.except_osv(_('Error'), _('Right CSV is not present in this zip file. Please use "File > File sending > Monthly" in Homère.')) |
92 | 616 | fileobj.close() | 630 | fileobj.close() |
93 | 617 | 631 | ||
94 | 618 | 632 | ||
95 | === modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py' | |||
96 | --- bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py 2017-10-24 08:45:55 +0000 | |||
97 | +++ bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py 2019-03-28 11:11:55 +0000 | |||
98 | @@ -159,8 +159,12 @@ | |||
99 | 159 | self.check(cr, uid, context=context) # check expense lines | 159 | self.check(cr, uid, context=context) # check expense lines |
100 | 160 | account_partner_not_compat_log = [] | 160 | account_partner_not_compat_log = [] |
101 | 161 | self._update_message(cr, uid, ids, _('Checking account/partner compatibility...'), context, use_new_cursor) | 161 | self._update_message(cr, uid, ids, _('Checking account/partner compatibility...'), context, use_new_cursor) |
102 | 162 | currency_list = [] | ||
103 | 162 | for line in self.pool.get('hr.payroll.msf').read(cr, uid, line_ids, | 163 | for line in self.pool.get('hr.payroll.msf').read(cr, uid, line_ids, |
105 | 163 | ['name', 'ref', 'partner_id', 'account_id', 'amount', 'employee_id', ]): | 164 | ['name', 'ref', 'partner_id', 'account_id', 'amount', 'employee_id', 'currency_id']): |
106 | 165 | # store all the currencies used | ||
107 | 166 | if line['currency_id'] and line['currency_id'][0] not in currency_list: | ||
108 | 167 | currency_list.append(line['currency_id'][0]) | ||
109 | 164 | account_id = line.get('account_id', False) and line.get('account_id')[0] or False | 168 | account_id = line.get('account_id', False) and line.get('account_id')[0] or False |
110 | 165 | if not account_id: | 169 | if not account_id: |
111 | 166 | raise osv.except_osv(_('Error'), _('No account found!')) | 170 | raise osv.except_osv(_('Error'), _('No account found!')) |
112 | @@ -206,7 +210,12 @@ | |||
113 | 206 | 'date': period_obj.get_date_in_period(cr, uid, move_date, period_id) or False, | 210 | 'date': period_obj.get_date_in_period(cr, uid, move_date, period_id) or False, |
114 | 207 | 'ref': 'Salaries' + ' ' + field, | 211 | 'ref': 'Salaries' + ' ' + field, |
115 | 208 | } | 212 | } |
117 | 209 | move_id = self.pool.get('account.move').create(cr, uid, move_vals, context=context) | 213 | # create one JE per currency (note that the JE currency_id depends on the currency of its lines) |
118 | 214 | am_by_curr = {} | ||
119 | 215 | for curr in currency_list: | ||
120 | 216 | move_vals_copy = move_vals.copy() # avoids using the same Sequence for the different moves | ||
121 | 217 | move_id = self.pool.get('account.move').create(cr, uid, move_vals_copy, context=context) | ||
122 | 218 | am_by_curr[curr] = move_id | ||
123 | 210 | 219 | ||
124 | 211 | # Create lines into this move | 220 | # Create lines into this move |
125 | 212 | current_line_position = 0 | 221 | current_line_position = 0 |
126 | @@ -275,8 +284,9 @@ | |||
127 | 275 | 284 | ||
128 | 276 | # UTP-1042: Specific partner's accounts are not needed. | 285 | # UTP-1042: Specific partner's accounts are not needed. |
129 | 277 | # create move line values | 286 | # create move line values |
130 | 287 | line_curr = line.get('currency_id')[0] # mandatory field | ||
131 | 278 | line_vals = { | 288 | line_vals = { |
133 | 279 | 'move_id': move_id, | 289 | 'move_id': am_by_curr.get(line_curr), |
134 | 280 | 'name': line.get('name', ''), | 290 | 'name': line.get('name', ''), |
135 | 281 | 'date': line.get('date', ''), | 291 | 'date': line.get('date', ''), |
136 | 282 | 'document_date': line.get('date', ''), | 292 | 'document_date': line.get('date', ''), |
137 | @@ -289,14 +299,19 @@ | |||
138 | 289 | 'credit_currency': credit, | 299 | 'credit_currency': credit, |
139 | 290 | 'journal_id': journal_id, | 300 | 'journal_id': journal_id, |
140 | 291 | 'period_id': line.get('period_id', False) and line.get('period_id')[0] or period_id, | 301 | 'period_id': line.get('period_id', False) and line.get('period_id')[0] or period_id, |
142 | 292 | 'currency_id': line.get('currency_id', False) and line.get('currency_id')[0] or False, | 302 | 'currency_id': line_curr, |
143 | 293 | 'analytic_distribution_id': distrib_id or False, | 303 | 'analytic_distribution_id': distrib_id or False, |
144 | 294 | } | 304 | } |
145 | 295 | # create move line | 305 | # create move line |
146 | 296 | self.pool.get('account.move.line').create(cr, uid, line_vals, check=False) | 306 | self.pool.get('account.move.line').create(cr, uid, line_vals, check=False) |
148 | 297 | self._update_message(cr, uid, ids, _('Posting of the Journal Entry. This may take a while...'), context, use_new_cursor) | 307 | if len(am_by_curr) > 1: |
149 | 308 | msg = _('Posting of the Journal Entries. This may take a while...') | ||
150 | 309 | else: | ||
151 | 310 | msg = _('Posting of the Journal Entry. This may take a while...') | ||
152 | 311 | self._update_message(cr, uid, ids, msg, context, use_new_cursor) | ||
153 | 298 | context['do_not_create_analytic_line'] = True | 312 | context['do_not_create_analytic_line'] = True |
155 | 299 | self.pool.get('account.move').post(cr, uid, [move_id], context=context) | 313 | for am_curr in am_by_curr: |
156 | 314 | self.pool.get('account.move').post(cr, uid, am_by_curr[am_curr], context=context) | ||
157 | 300 | # Update payroll lines status | 315 | # Update payroll lines status |
158 | 301 | self._update_percent(cr, uid, ids, 90, context, use_new_cursor) # 90% of the total process time | 316 | self._update_percent(cr, uid, ids, 90, context, use_new_cursor) # 90% of the total process time |
159 | 302 | self._update_message(cr, uid, ids, _('Updating the status of the Journal Items...'), context, use_new_cursor) | 317 | self._update_message(cr, uid, ids, _('Updating the status of the Journal Items...'), context, use_new_cursor) |
160 | 303 | 318 | ||
161 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' | |||
162 | --- bin/addons/msf_profile/i18n/fr_MF.po 2019-03-04 11:05:48 +0000 | |||
163 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2019-03-28 11:11:55 +0000 | |||
164 | @@ -47622,6 +47622,12 @@ | |||
165 | 47622 | msgid "Posting of the Journal Entry. This may take a while..." | 47622 | msgid "Posting of the Journal Entry. This may take a while..." |
166 | 47623 | msgstr "Comptabilisation de l'Ecriture Comptable. Cela peut prendre un certain temps..." | 47623 | msgstr "Comptabilisation de l'Ecriture Comptable. Cela peut prendre un certain temps..." |
167 | 47624 | 47624 | ||
168 | 47625 | #. module: msf_homere_interface | ||
169 | 47626 | #: code:addons/msf_homere_interface/wizard/hr_payroll_validation.py:307 | ||
170 | 47627 | #, python-format | ||
171 | 47628 | msgid "Posting of the Journal Entries. This may take a while..." | ||
172 | 47629 | msgstr "Comptabilisation des Ecritures Comptables. Cela peut prendre un certain temps..." | ||
173 | 47630 | |||
174 | 47625 | #. module: account | 47631 | #. module: account |
175 | 47626 | #: model:process.transition,note:account.process_transition_statemententries0 | 47632 | #: model:process.transition,note:account.process_transition_statemententries0 |
176 | 47627 | msgid "Manual or automatic creation of payment entries according to the statements" | 47633 | msgid "Manual or automatic creation of payment entries according to the statements" |
177 | @@ -105335,3 +105341,25 @@ | |||
178 | 105335 | msgstr "\n" | 105341 | msgstr "\n" |
179 | 105336 | " Attention: Les lignes suivantes ont des qté ou des montants sur plus de 15 chiffres. Veuillez vérifier la qté et le prix unitaire pour éviter des pertes d'information:\n" | 105342 | " Attention: Les lignes suivantes ont des qté ou des montants sur plus de 15 chiffres. Veuillez vérifier la qté et le prix unitaire pour éviter des pertes d'information:\n" |
180 | 105337 | " " | 105343 | " " |
181 | 105344 | |||
182 | 105345 | #. module: msf_homere_interface | ||
183 | 105346 | #: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:580 | ||
184 | 105347 | #, python-format | ||
185 | 105348 | msgid "Line %s: %s\n" | ||
186 | 105349 | "" | ||
187 | 105350 | msgstr "Ligne %s : %s\n" | ||
188 | 105351 | "" | ||
189 | 105352 | |||
190 | 105353 | #. module: msf_homere_interface | ||
191 | 105354 | #: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:585 | ||
192 | 105355 | #, python-format | ||
193 | 105356 | msgid "%sFile %s:\n" | ||
194 | 105357 | "%s" | ||
195 | 105358 | msgstr "%sFichier %s :\n" | ||
196 | 105359 | "%s" | ||
197 | 105360 | |||
198 | 105361 | #. module: msf_homere_interface | ||
199 | 105362 | #: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:574 | ||
200 | 105363 | #, python-format | ||
201 | 105364 | msgid "Several files contain lines with the currency %s. Please use one file per currency." | ||
202 | 105365 | msgstr "Plusieurs fichiers contiennent des lignes avec la devise %s. Veuillez utiliser un fichier par devise." | ||
203 | 105338 | 105366 | ||
204 | === modified file 'bin/addons/sync_client/orm.py' | |||
205 | --- bin/addons/sync_client/orm.py 2019-03-04 11:05:48 +0000 | |||
206 | +++ bin/addons/sync_client/orm.py 2019-03-28 11:11:55 +0000 | |||
207 | @@ -132,6 +132,7 @@ | |||
208 | 132 | FROM ir_model_data | 132 | FROM ir_model_data |
209 | 133 | WHERE module = 'sd' AND | 133 | WHERE module = 'sd' AND |
210 | 134 | model = %s AND | 134 | model = %s AND |
211 | 135 | COALESCE(touched, '') != '[]' AND | ||
212 | 135 | """+add_sql+""" | 136 | """+add_sql+""" |
213 | 136 | ("""+field+""" < last_modification OR """+field+""" IS NULL)""", | 137 | ("""+field+""" < last_modification OR """+field+""" IS NULL)""", |
214 | 137 | sql_params) # not_a_user_entry | 138 | sql_params) # not_a_user_entry |