Merge lp:~julie-w/unifield-server/US-5756 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5357
Proposed branch: lp:~julie-w/unifield-server/US-5756
Merge into: lp:unifield-server
Diff against target: 249 lines (+72/-45) (has conflicts)
2 files modified
bin/addons/msf_doc_import/account.py (+48/-36)
bin/addons/msf_profile/i18n/fr_MF.po (+24/-9)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-5756
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+367327@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_doc_import/account.py'
--- bin/addons/msf_doc_import/account.py 2019-01-03 09:17:52 +0000
+++ bin/addons/msf_doc_import/account.py 2019-05-13 07:25:22 +0000
@@ -71,33 +71,34 @@
71 # Browse result71 # Browse result
72 b_entries = self.pool.get('msf.doc.import.accounting.lines').browse(cr, uid, entries)72 b_entries = self.pool.get('msf.doc.import.accounting.lines').browse(cr, uid, entries)
73 # Update wizard73 # Update wizard
74 self.write(cr, uid, [w.id], {'message': _('Grouping by currencies…'), 'progression': 10.0})74 self.write(cr, uid, [w.id], {'message': _('Grouping by currency and date…'), 'progression': 10.0})
75 # Search all currencies (to create moves)75 # Group entries by currency, period and doc date (to create moves)
76 available_currencies = {}76 curr_date_group = {}
77 for entry in b_entries:77 for entry in b_entries:
78 if (entry.currency_id.id, entry.period_id.id) not in available_currencies:78 # note: having different periods is possible only for December dates (ex: Period 13 and 14)
79 available_currencies[(entry.currency_id.id, entry.period_id.id)] = []79 if (entry.currency_id.id, entry.period_id.id, entry.document_date) not in curr_date_group:
80 available_currencies[(entry.currency_id.id, entry.period_id.id)].append(entry)80 curr_date_group[(entry.currency_id.id, entry.period_id.id, entry.document_date)] = []
81 curr_date_group[(entry.currency_id.id, entry.period_id.id, entry.document_date)].append(entry)
81 # Update wizard82 # Update wizard
82 self.write(cr, uid, ids, {'message': _('Writing a move for each currency…'), 'progression': 20.0})83 self.write(cr, uid, ids, {'message': _('Writing of the Journal Entries…'), 'progression': 20.0})
83 num = 184 num = 1
84 nb_currencies = float(len(available_currencies))85 nb_entries = float(len(curr_date_group))
85 remaining_percent = 80.086 remaining_percent = 80.0
86 step = float(remaining_percent / nb_currencies)87 step = float(remaining_percent / nb_entries)
87 for c_id, p_id in available_currencies:88 for currency_id, period_id, document_date in curr_date_group:
88 # Create a move89 # Create a move
89 move_vals = {90 move_vals = {
90 'currency_id': c_id,91 'currency_id': currency_id,
91 'manual_currency_id': c_id,92 'manual_currency_id': currency_id,
92 'journal_id': journal_id,93 'journal_id': journal_id,
93 'document_date': w.date,94 'document_date': document_date,
94 'date': w.date,95 'date': w.date,
95 'period_id': p_id,96 'period_id': period_id,
96 'status': 'manu',97 'status': 'manu',
97 'imported': True,98 'imported': True,
98 }99 }
99 move_id = self.pool.get('account.move').create(cr, uid, move_vals, context)100 move_id = self.pool.get('account.move').create(cr, uid, move_vals, context)
100 for l_num, l in enumerate(available_currencies[(c_id, p_id)]):101 for l_num, l in enumerate(curr_date_group[(currency_id, period_id, document_date)]):
101 # Update wizard102 # Update wizard
102 progression = 20.0 + ((float(l_num) / float(len(b_entries))) * step) + (float(num - 1) * step)103 progression = 20.0 + ((float(l_num) / float(len(b_entries))) * step) + (float(num - 1) * step)
103 self.write(cr, uid, [w.id], {'progression': progression})104 self.write(cr, uid, [w.id], {'progression': progression})
@@ -107,7 +108,7 @@
107 distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {}, context)108 distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {}, context)
108 common_vals = {109 common_vals = {
109 'distribution_id': distrib_id,110 'distribution_id': distrib_id,
110 'currency_id': c_id,111 'currency_id': currency_id,
111 'percentage': 100.0,112 'percentage': 100.0,
112 'date': l.date,113 'date': l.date,
113 'source_date': l.date,114 'source_date': l.date,
@@ -123,13 +124,13 @@
123 'name': l.description,124 'name': l.description,
124 'reference': l.ref,125 'reference': l.ref,
125 'account_id': l.account_id.id,126 'account_id': l.account_id.id,
126 'period_id': p_id,127 'period_id': period_id,
127 'document_date': l.document_date,128 'document_date': l.document_date,
128 'date': l.date,129 'date': l.date,
129 'journal_id': journal_id,130 'journal_id': journal_id,
130 'debit_currency': l.debit,131 'debit_currency': l.debit,
131 'credit_currency': l.credit,132 'credit_currency': l.credit,
132 'currency_id': c_id,133 'currency_id': currency_id,
133 'analytic_distribution_id': distrib_id,134 'analytic_distribution_id': distrib_id,
134 'partner_id': l.partner_id and l.partner_id.id or False,135 'partner_id': l.partner_id and l.partner_id.id or False,
135 'employee_id': l.employee_id and l.employee_id.id or False,136 'employee_id': l.employee_id and l.employee_id.id or False,
@@ -246,6 +247,7 @@
246 raise osv.except_osv(_('Error'), _("'%s' column not found in file.") % (el or '',))247 raise osv.except_osv(_('Error'), _("'%s' column not found in file.") % (el or '',))
247 # All lines248 # All lines
248 money = {}249 money = {}
250 doc_date_periods = set()
249 # Update wizard251 # Update wizard
250 self.write(cr, uid, [wiz.id], {'message': _('Reading lines…'), 'progression': 6.00})252 self.write(cr, uid, [wiz.id], {'message': _('Reading lines…'), 'progression': 6.00})
251 # Check file's content253 # Check file's content
@@ -284,6 +286,9 @@
284 errors.append(_('Line %s, the column \'Document Date\' have to be of type DateTime. Check the spreadsheet format (or export a document to have an example).') % (current_line_num,))286 errors.append(_('Line %s, the column \'Document Date\' have to be of type DateTime. Check the spreadsheet format (or export a document to have an example).') % (current_line_num,))
285 continue287 continue
286 r_document_date = line[cols['Document Date']].strftime('%Y-%m-%d')288 r_document_date = line[cols['Document Date']].strftime('%Y-%m-%d')
289 doc_date_period_ids = period_obj.get_period_from_date(cr, uid, r_document_date, context=context)
290 if doc_date_period_ids:
291 doc_date_periods.add(doc_date_period_ids[0])
287 # Check on booking amounts: ensure that one (and only one) value exists and that its amount isn't negative292 # Check on booking amounts: ensure that one (and only one) value exists and that its amount isn't negative
288 book_debit = 0293 book_debit = 0
289 book_credit = 0294 book_credit = 0
@@ -325,29 +330,32 @@
325 if not line[cols['Booking Currency']]:330 if not line[cols['Booking Currency']]:
326 errors.append(_('Line %s. No currency specified!') % (current_line_num,))331 errors.append(_('Line %s. No currency specified!') % (current_line_num,))
327 continue332 continue
328 curr_ids = self.pool.get('res.currency').search(cr, uid, [('name', '=', line[cols['Booking Currency']])])333 booking_curr = line[cols['Booking Currency']]
334 curr_ids = self.pool.get('res.currency').search(cr, uid, [('name', '=', booking_curr)])
329 if not curr_ids:335 if not curr_ids:
330 errors.append(_('Line %s. Currency not found: %s') % (current_line_num, line[cols['Booking Currency']],))336 errors.append(_('Line %s. Currency not found: %s') % (current_line_num, booking_curr,))
331 continue337 continue
332 for c in self.pool.get('res.currency').browse(cr, uid, curr_ids):338 for c in self.pool.get('res.currency').browse(cr, uid, curr_ids):
333 if not c.active:339 if not c.active:
334 errors.append(_('Line %s. Currency is not active: %s') % (current_line_num, line[cols['Booking Currency']],))340 errors.append(_('Line %s. Currency is not active: %s') % (current_line_num, booking_curr,))
335 continue341 continue
336 r_currency = curr_ids[0]342 r_currency = curr_ids[0]
337 if not line[cols['Booking Currency']] in money:343 if not line[cols['Period']]:
338 money[line[cols['Booking Currency']]] = {}344 errors.append(_('Line %s. Period is missing.') % (current_line_num))
339 if not 'debit' in money[line[cols['Booking Currency']]]:345 continue
340 money[line[cols['Booking Currency']]]['debit'] = 0346 period_name = line[cols['Period']]
341 if not 'credit' in money[line[cols['Booking Currency']]]:347 if not (booking_curr, period_name, r_document_date) in money:
342 money[line[cols['Booking Currency']]]['credit'] = 0348 money[(booking_curr, period_name, r_document_date)] = {}
343 if not 'name' in money[line[cols['Booking Currency']]]:349 if not 'debit' in money[(booking_curr, period_name, r_document_date)]:
344 money[line[cols['Booking Currency']]]['name'] = line[cols['Booking Currency']]350 money[(booking_curr, period_name, r_document_date)]['debit'] = 0
351 if not 'credit' in money[(booking_curr, period_name, r_document_date)]:
352 money[(booking_curr, period_name, r_document_date)]['credit'] = 0
345 # Increment global debit/credit353 # Increment global debit/credit
346 if book_debit:354 if book_debit:
347 money[line[cols['Booking Currency']]]['debit'] += book_debit355 money[(booking_curr, period_name, r_document_date)]['debit'] += book_debit
348 r_debit = book_debit356 r_debit = book_debit
349 if book_credit:357 if book_credit:
350 money[line[cols['Booking Currency']]]['credit'] += book_credit358 money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit
351 r_credit = book_credit359 r_credit = book_credit
352360
353 # Check which journal it is to be posted to: should be of type OD, MIG or INT361 # Check which journal it is to be posted to: should be of type OD, MIG or INT
@@ -504,12 +512,12 @@
504 continue512 continue
505513
506 # US-937: use period of import file514 # US-937: use period of import file
507 if line[cols['Period']].startswith('Period 16'):515 if period_name.startswith('Period 16'):
508 raise osv.except_osv(_('Warning'), _("You can't import entries in Period 16."))516 raise osv.except_osv(_('Warning'), _("You can't import entries in Period 16."))
509 period_ids = period_obj.search(517 period_ids = period_obj.search(
510 cr, uid, [518 cr, uid, [
511 ('id', 'in', wiz_period_ids),519 ('id', 'in', wiz_period_ids),
512 ('name', '=', line[cols['Period']]),520 ('name', '=', period_name),
513 ], limit=1, context=context)521 ], limit=1, context=context)
514 if not period_ids:522 if not period_ids:
515 raise osv.except_osv(_('Warning'),523 raise osv.except_osv(_('Warning'),
@@ -603,12 +611,16 @@
603 continue611 continue
604 created += 1612 created += 1
605 # Check if all is ok for the file613 # Check if all is ok for the file
614 if len(doc_date_periods) > 1:
615 errors.append(_('All Document Dates should be in the same period.'))
606 ## The lines should be balanced for each currency616 ## The lines should be balanced for each currency
607 if not errors:617 if not errors:
608 # to compare the right amounts do the check only if no line has been ignored because of an error618 # to compare the right amounts do the check only if no line has been ignored because of an error
609 for c in money:619 for curr, per, doc_date in money:
610 if abs(money[c]['debit'] - money[c]['credit']) > 10**-3:620 amount = money[(curr, per, doc_date)]['debit'] - money[(curr, per, doc_date)]['credit']
611 raise osv.except_osv(_('Error'), _('Currency %s is not balanced: %s') % (money[c]['name'], (money[c]['debit'] - money[c]['credit']),))621 if abs(amount) > 10**-3:
622 raise osv.except_osv(_('Error'), _('Amount unbalanced for the Currency %s and the Document Date %s (Period: %s): %s') %
623 (curr, doc_date, per, amount,))
612 # Update wizard624 # Update wizard
613 self.write(cr, uid, ids, {'message': _('Check complete. Reading potential errors or write needed changes.'), 'progression': 100.0})625 self.write(cr, uid, ids, {'message': _('Check complete. Reading potential errors or write needed changes.'), 'progression': 100.0})
614626
615627
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-05-10 15:26:36 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-05-13 07:25:22 +0000
@@ -23872,10 +23872,10 @@
23872msgstr "Derniers taux de change"23872msgstr "Derniers taux de change"
2387323873
23874#. module: msf_doc_import23874#. module: msf_doc_import
23875#: code:addons/msf_doc_import/account.py:7323875#: code:addons/msf_doc_import/account.py:74
23876#, python-format23876#, python-format
23877msgid "Grouping by currencies…"23877msgid "Grouping by currency and date…"
23878msgstr "Regroupement par monnaies…"23878msgstr "Regroupement par devise et date…"
2387923879
23880#. module: stock_override23880#. module: stock_override
23881#: field:stock.picking,incoming_id:023881#: field:stock.picking,incoming_id:0
@@ -41335,10 +41335,10 @@
41335msgstr "Retry from time"41335msgstr "Retry from time"
4133641336
41337#. module: msf_doc_import41337#. module: msf_doc_import
41338#: code:addons/msf_doc_import/account.py:58841338#: code:addons/msf_doc_import/account.py:622
41339#, python-format41339#, python-format
41340msgid "Currency %s is not balanced: %s"41340msgid "Amount unbalanced for the Currency %s and the Document Date %s (Period: %s): %s"
41341msgstr "La devise %s n'est pas équilibrée : %s"41341msgstr "Montant non équilibré pour la Devise %s et la Date de Document %s (Période : %s) : %s"
4134241342
41343#. module: msf_partner41343#. module: msf_partner
41344#: code:addons/msf_partner/partner.py:75441344#: code:addons/msf_partner/partner.py:754
@@ -58195,10 +58195,10 @@
58195msgstr "Valeurs d'origine"58195msgstr "Valeurs d'origine"
5819658196
58197#. module: msf_doc_import58197#. module: msf_doc_import
58198#: code:addons/msf_doc_import/account.py:8158198#: code:addons/msf_doc_import/account.py:83
58199#, python-format58199#, python-format
58200msgid "Writing a move for each currency…"58200msgid "Writing of the Journal Entries…"
58201msgstr "Enregistrement d'une écriture comptable pour chaque monnaie…"58201msgstr "Enregistrement des Écritures Comptables…"
5820258202
58203#. module: base58203#. module: base
58204#: code:addons/base/ir/ir_actions.py:67758204#: code:addons/base/ir/ir_actions.py:677
@@ -105896,6 +105896,7 @@
105896#: field:product.mass.update,empty_status:0105896#: field:product.mass.update,empty_status:0
105897msgid "Set Status as empty"105897msgid "Set Status as empty"
105898msgstr "Mettre le Statut à vide"105898msgstr "Mettre le Statut à vide"
105899<<<<<<< TREE
105899105900
105900#. module: sourcing105901#. module: sourcing
105901#: code:addons/sourcing/sale_order_line.py:1606105902#: code:addons/sourcing/sale_order_line.py:1606
@@ -105941,3 +105942,17 @@
105941#, python-format105942#, python-format
105942msgid "Please ensure that you selected the correct Source document because once the line is saved you will not be able to edit this field anymore. In case of mistake, the only option will be to Cancel the line and Create a new one with the correct Source document."105943msgid "Please ensure that you selected the correct Source document because once the line is saved you will not be able to edit this field anymore. In case of mistake, the only option will be to Cancel the line and Create a new one with the correct Source document."
105943msgstr "Veuillez vous assurer que vous avez selectionné la bonne valeur pour le champ \"Document d'origine\". Une fois enregistrée cette valeur ne sera plus modifiable. En cas d'erreur la seule solution sera d'Annuler cette ligne et d'en créer une nouvelle."105944msgstr "Veuillez vous assurer que vous avez selectionné la bonne valeur pour le champ \"Document d'origine\". Une fois enregistrée cette valeur ne sera plus modifiable. En cas d'erreur la seule solution sera d'Annuler cette ligne et d'en créer une nouvelle."
105945=======
105946
105947#. module: msf_doc_import
105948#: code:addons/msf_doc_import/account.py:343
105949#, python-format
105950msgid "Line %s. Period is missing."
105951msgstr "Ligne %s. Il manque la Période."
105952
105953#. module: msf_doc_import
105954#: code:addons/msf_doc_import/account.py:615
105955#, python-format
105956msgid "All Document Dates should be in the same period."
105957msgstr "Toutes les Dates de Document doivent être dans la même période."
105958>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches