Merge lp:~julie-w/unifield-server/US-5788 into lp:unifield-server/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
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+365218@code.launchpad.net
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
=== modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_import.py'
--- bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2018-12-07 13:34:24 +0000
+++ bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2019-03-28 11:11:55 +0000
@@ -503,6 +503,7 @@
503 xyargv = self._get_homere_password(cr, uid, pass_type='payroll')503 xyargv = self._get_homere_password(cr, uid, pass_type='payroll')
504504
505 filename = ""505 filename = ""
506 error_msg = ""
506 wiz_state = False507 wiz_state = False
507 # Browse all given wizard508 # Browse all given wizard
508 for wiz in self.browse(cr, uid, ids):509 for wiz in self.browse(cr, uid, ids):
@@ -525,10 +526,11 @@
525 if zipobj.namelist():526 if zipobj.namelist():
526 namelist = zipobj.namelist()527 namelist = zipobj.namelist()
527 # Search CSV528 # Search CSV
528 csvfile = None529 csvfiles = []
530 currency_list = []
529 for name in namelist:531 for name in namelist:
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:
531 csvfile = name533 csvfiles.append(name)
532 if not 'envoi.ini' in namelist:534 if not 'envoi.ini' in namelist:
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!'))
534 # Read information from 'envoi.ini' file536 # Read information from 'envoi.ini' file
@@ -542,8 +544,8 @@
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.'))
543 if not field:545 if not field:
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.'))
545 # Read CSV file547 # Read CSV files
546 if csvfile:548 for csvfile in csvfiles:
547 try:549 try:
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='\\')
549 reader.next()551 reader.next()
@@ -553,8 +555,10 @@
553 res = True555 res = True
554 res_amount = 0.0556 res_amount = 0.0
555 amount = 0.0557 amount = 0.0
556 error_msg = ""558 num_line = 1 # the header line is not taken into account
559 file_error_msg = "" # store the error/warning messages for the current file
557 for line in reader:560 for line in reader:
561 num_line += 1
558 processed += 1562 processed += 1
559 update, amount, nb_created, vals, ccy, msg = self.update_payroll_entries(563 update, amount, nb_created, vals, ccy, msg = self.update_payroll_entries(
560 cr, uid, data=line, field=field,564 cr, uid, data=line, field=field,
@@ -563,13 +567,22 @@
563 res_amount += round(amount, 2)567 res_amount += round(amount, 2)
564 if not update:568 if not update:
565 res = False569 res = False
566 if created == 0:570 if num_line == 2: # the first line containing data
567 header_vals = vals571 header_vals = vals
568 header_vals['currency_code'] = ccy572 header_vals['currency_code'] = ccy # note that the curr. is different from one file to another
573 if ccy in currency_list:
574 raise osv.except_osv(_('Error'), _('Several files contain lines with the currency %s. '
575 'Please use one file per currency.') % ccy)
576 currency_list.append(ccy)
569 created += nb_created577 created += nb_created
570578
571 if msg:579 if msg:
572 error_msg += "Line " + str(processed) + ": " + msg + " \n"580 file_error_msg += _("Line %s: %s\n") % (str(num_line), msg)
581
582 # complete the list of error messages with the ones from this file if any
583 if file_error_msg:
584 # add a line break between files
585 error_msg += _("%sFile %s:\n%s") % (error_msg and "\n" or "", csvfile, file_error_msg)
573586
574 # Check balance587 # Check balance
575 res_amount_rounded = round(res_amount, 2)588 res_amount_rounded = round(res_amount, 2)
@@ -585,7 +598,8 @@
585 pr_ids = self.pool.get('hr.payroll.msf').search(598 pr_ids = self.pool.get('hr.payroll.msf').search(
586 cr, uid, [599 cr, uid, [
587 ('state', '=', 'draft'),600 ('state', '=', 'draft'),
588 ('name', '=', 'Payroll rounding')601 ('name', '=', 'Payroll rounding'),
602 ('currency_id', '=', header_vals['currency_id']),
589 ])603 ])
590 if not pr_ids:604 if not pr_ids:
591 # no SAGA BALANCE rounding line in file605 # no SAGA BALANCE rounding line in file
@@ -611,7 +625,7 @@
611 # - add both625 # - add both
612 new_amount = round(pr.amount, 2) + (-1 * res_amount_rounded)626 new_amount = round(pr.amount, 2) + (-1 * res_amount_rounded)
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),})
614 else:628 if not csvfiles:
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.'))
616 fileobj.close()630 fileobj.close()
617631
618632
=== modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py'
--- bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py 2017-10-24 08:45:55 +0000
+++ bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py 2019-03-28 11:11:55 +0000
@@ -159,8 +159,12 @@
159 self.check(cr, uid, context=context) # check expense lines159 self.check(cr, uid, context=context) # check expense lines
160 account_partner_not_compat_log = []160 account_partner_not_compat_log = []
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)
162 currency_list = []
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,
163 ['name', 'ref', 'partner_id', 'account_id', 'amount', 'employee_id', ]):164 ['name', 'ref', 'partner_id', 'account_id', 'amount', 'employee_id', 'currency_id']):
165 # store all the currencies used
166 if line['currency_id'] and line['currency_id'][0] not in currency_list:
167 currency_list.append(line['currency_id'][0])
164 account_id = line.get('account_id', False) and line.get('account_id')[0] or False168 account_id = line.get('account_id', False) and line.get('account_id')[0] or False
165 if not account_id:169 if not account_id:
166 raise osv.except_osv(_('Error'), _('No account found!'))170 raise osv.except_osv(_('Error'), _('No account found!'))
@@ -206,7 +210,12 @@
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,
207 'ref': 'Salaries' + ' ' + field,211 'ref': 'Salaries' + ' ' + field,
208 }212 }
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)
214 am_by_curr = {}
215 for curr in currency_list:
216 move_vals_copy = move_vals.copy() # avoids using the same Sequence for the different moves
217 move_id = self.pool.get('account.move').create(cr, uid, move_vals_copy, context=context)
218 am_by_curr[curr] = move_id
210219
211 # Create lines into this move220 # Create lines into this move
212 current_line_position = 0221 current_line_position = 0
@@ -275,8 +284,9 @@
275284
276 # UTP-1042: Specific partner's accounts are not needed.285 # UTP-1042: Specific partner's accounts are not needed.
277 # create move line values286 # create move line values
287 line_curr = line.get('currency_id')[0] # mandatory field
278 line_vals = {288 line_vals = {
279 'move_id': move_id,289 'move_id': am_by_curr.get(line_curr),
280 'name': line.get('name', ''),290 'name': line.get('name', ''),
281 'date': line.get('date', ''),291 'date': line.get('date', ''),
282 'document_date': line.get('date', ''),292 'document_date': line.get('date', ''),
@@ -289,14 +299,19 @@
289 'credit_currency': credit,299 'credit_currency': credit,
290 'journal_id': journal_id,300 'journal_id': journal_id,
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,
292 'currency_id': line.get('currency_id', False) and line.get('currency_id')[0] or False,302 'currency_id': line_curr,
293 'analytic_distribution_id': distrib_id or False,303 'analytic_distribution_id': distrib_id or False,
294 }304 }
295 # create move line305 # create move line
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)
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:
308 msg = _('Posting of the Journal Entries. This may take a while...')
309 else:
310 msg = _('Posting of the Journal Entry. This may take a while...')
311 self._update_message(cr, uid, ids, msg, context, use_new_cursor)
298 context['do_not_create_analytic_line'] = True312 context['do_not_create_analytic_line'] = True
299 self.pool.get('account.move').post(cr, uid, [move_id], context=context)313 for am_curr in am_by_curr:
314 self.pool.get('account.move').post(cr, uid, am_by_curr[am_curr], context=context)
300 # Update payroll lines status315 # Update payroll lines status
301 self._update_percent(cr, uid, ids, 90, context, use_new_cursor) # 90% of the total process time316 self._update_percent(cr, uid, ids, 90, context, use_new_cursor) # 90% of the total process time
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)
303318
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-03-04 11:05:48 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-03-28 11:11:55 +0000
@@ -47622,6 +47622,12 @@
47622msgid "Posting of the Journal Entry. This may take a while..."47622msgid "Posting of the Journal Entry. This may take a while..."
47623msgstr "Comptabilisation de l'Ecriture Comptable. Cela peut prendre un certain temps..."47623msgstr "Comptabilisation de l'Ecriture Comptable. Cela peut prendre un certain temps..."
4762447624
47625#. module: msf_homere_interface
47626#: code:addons/msf_homere_interface/wizard/hr_payroll_validation.py:307
47627#, python-format
47628msgid "Posting of the Journal Entries. This may take a while..."
47629msgstr "Comptabilisation des Ecritures Comptables. Cela peut prendre un certain temps..."
47630
47625#. module: account47631#. module: account
47626#: model:process.transition,note:account.process_transition_statemententries047632#: model:process.transition,note:account.process_transition_statemententries0
47627msgid "Manual or automatic creation of payment entries according to the statements"47633msgid "Manual or automatic creation of payment entries according to the statements"
@@ -105335,3 +105341,25 @@
105335msgstr "\n"105341msgstr "\n"
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"
105337" "105343" "
105344
105345#. module: msf_homere_interface
105346#: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:580
105347#, python-format
105348msgid "Line %s: %s\n"
105349""
105350msgstr "Ligne %s : %s\n"
105351""
105352
105353#. module: msf_homere_interface
105354#: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:585
105355#, python-format
105356msgid "%sFile %s:\n"
105357"%s"
105358msgstr "%sFichier %s :\n"
105359"%s"
105360
105361#. module: msf_homere_interface
105362#: code:addons/msf_homere_interface/wizard/hr_payroll_import.py:574
105363#, python-format
105364msgid "Several files contain lines with the currency %s. Please use one file per currency."
105365msgstr "Plusieurs fichiers contiennent des lignes avec la devise %s. Veuillez utiliser un fichier par devise."
105338105366
=== modified file 'bin/addons/sync_client/orm.py'
--- bin/addons/sync_client/orm.py 2019-03-04 11:05:48 +0000
+++ bin/addons/sync_client/orm.py 2019-03-28 11:11:55 +0000
@@ -132,6 +132,7 @@
132 FROM ir_model_data132 FROM ir_model_data
133 WHERE module = 'sd' AND133 WHERE module = 'sd' AND
134 model = %s AND134 model = %s AND
135 COALESCE(touched, '') != '[]' AND
135 """+add_sql+"""136 """+add_sql+"""
136 ("""+field+""" < last_modification OR """+field+""" IS NULL)""",137 ("""+field+""" < last_modification OR """+field+""" IS NULL)""",
137 sql_params) # not_a_user_entry138 sql_params) # not_a_user_entry

Subscribers

People subscribed via source and target branches