Merge lp:~julie-w/unifield-server/US-5756 into lp:unifield-server
- US-5756
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+367327@code.launchpad.net |
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_doc_import/account.py' | |||
2 | --- bin/addons/msf_doc_import/account.py 2019-01-03 09:17:52 +0000 | |||
3 | +++ bin/addons/msf_doc_import/account.py 2019-05-13 07:25:22 +0000 | |||
4 | @@ -71,33 +71,34 @@ | |||
5 | 71 | # Browse result | 71 | # Browse result |
6 | 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) |
7 | 73 | # Update wizard | 73 | # Update wizard |
11 | 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}) |
12 | 75 | # Search all currencies (to create moves) | 75 | # Group entries by currency, period and doc date (to create moves) |
13 | 76 | available_currencies = {} | 76 | curr_date_group = {} |
14 | 77 | for entry in b_entries: | 77 | for entry in b_entries: |
18 | 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) |
19 | 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: |
20 | 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)] = [] |
21 | 81 | curr_date_group[(entry.currency_id.id, entry.period_id.id, entry.document_date)].append(entry) | ||
22 | 81 | # Update wizard | 82 | # Update wizard |
24 | 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}) |
25 | 83 | num = 1 | 84 | num = 1 |
27 | 84 | nb_currencies = float(len(available_currencies)) | 85 | nb_entries = float(len(curr_date_group)) |
28 | 85 | remaining_percent = 80.0 | 86 | remaining_percent = 80.0 |
31 | 86 | step = float(remaining_percent / nb_currencies) | 87 | step = float(remaining_percent / nb_entries) |
32 | 87 | for c_id, p_id in available_currencies: | 88 | for currency_id, period_id, document_date in curr_date_group: |
33 | 88 | # Create a move | 89 | # Create a move |
34 | 89 | move_vals = { | 90 | move_vals = { |
37 | 90 | 'currency_id': c_id, | 91 | 'currency_id': currency_id, |
38 | 91 | 'manual_currency_id': c_id, | 92 | 'manual_currency_id': currency_id, |
39 | 92 | 'journal_id': journal_id, | 93 | 'journal_id': journal_id, |
41 | 93 | 'document_date': w.date, | 94 | 'document_date': document_date, |
42 | 94 | 'date': w.date, | 95 | 'date': w.date, |
44 | 95 | 'period_id': p_id, | 96 | 'period_id': period_id, |
45 | 96 | 'status': 'manu', | 97 | 'status': 'manu', |
46 | 97 | 'imported': True, | 98 | 'imported': True, |
47 | 98 | } | 99 | } |
48 | 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) |
50 | 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)]): |
51 | 101 | # Update wizard | 102 | # Update wizard |
52 | 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) |
53 | 103 | self.write(cr, uid, [w.id], {'progression': progression}) | 104 | self.write(cr, uid, [w.id], {'progression': progression}) |
54 | @@ -107,7 +108,7 @@ | |||
55 | 107 | distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {}, context) | 108 | distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {}, context) |
56 | 108 | common_vals = { | 109 | common_vals = { |
57 | 109 | 'distribution_id': distrib_id, | 110 | 'distribution_id': distrib_id, |
59 | 110 | 'currency_id': c_id, | 111 | 'currency_id': currency_id, |
60 | 111 | 'percentage': 100.0, | 112 | 'percentage': 100.0, |
61 | 112 | 'date': l.date, | 113 | 'date': l.date, |
62 | 113 | 'source_date': l.date, | 114 | 'source_date': l.date, |
63 | @@ -123,13 +124,13 @@ | |||
64 | 123 | 'name': l.description, | 124 | 'name': l.description, |
65 | 124 | 'reference': l.ref, | 125 | 'reference': l.ref, |
66 | 125 | 'account_id': l.account_id.id, | 126 | 'account_id': l.account_id.id, |
68 | 126 | 'period_id': p_id, | 127 | 'period_id': period_id, |
69 | 127 | 'document_date': l.document_date, | 128 | 'document_date': l.document_date, |
70 | 128 | 'date': l.date, | 129 | 'date': l.date, |
71 | 129 | 'journal_id': journal_id, | 130 | 'journal_id': journal_id, |
72 | 130 | 'debit_currency': l.debit, | 131 | 'debit_currency': l.debit, |
73 | 131 | 'credit_currency': l.credit, | 132 | 'credit_currency': l.credit, |
75 | 132 | 'currency_id': c_id, | 133 | 'currency_id': currency_id, |
76 | 133 | 'analytic_distribution_id': distrib_id, | 134 | 'analytic_distribution_id': distrib_id, |
77 | 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, |
78 | 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, |
79 | @@ -246,6 +247,7 @@ | |||
80 | 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 '',)) |
81 | 247 | # All lines | 248 | # All lines |
82 | 248 | money = {} | 249 | money = {} |
83 | 250 | doc_date_periods = set() | ||
84 | 249 | # Update wizard | 251 | # Update wizard |
85 | 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}) |
86 | 251 | # Check file's content | 253 | # Check file's content |
87 | @@ -284,6 +286,9 @@ | |||
88 | 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,)) |
89 | 285 | continue | 287 | continue |
90 | 286 | r_document_date = line[cols['Document Date']].strftime('%Y-%m-%d') | 288 | r_document_date = line[cols['Document Date']].strftime('%Y-%m-%d') |
91 | 289 | doc_date_period_ids = period_obj.get_period_from_date(cr, uid, r_document_date, context=context) | ||
92 | 290 | if doc_date_period_ids: | ||
93 | 291 | doc_date_periods.add(doc_date_period_ids[0]) | ||
94 | 287 | # Check on booking amounts: ensure that one (and only one) value exists and that its amount isn't negative | 292 | # Check on booking amounts: ensure that one (and only one) value exists and that its amount isn't negative |
95 | 288 | book_debit = 0 | 293 | book_debit = 0 |
96 | 289 | book_credit = 0 | 294 | book_credit = 0 |
97 | @@ -325,29 +330,32 @@ | |||
98 | 325 | if not line[cols['Booking Currency']]: | 330 | if not line[cols['Booking Currency']]: |
99 | 326 | errors.append(_('Line %s. No currency specified!') % (current_line_num,)) | 331 | errors.append(_('Line %s. No currency specified!') % (current_line_num,)) |
100 | 327 | continue | 332 | continue |
102 | 328 | curr_ids = self.pool.get('res.currency').search(cr, uid, [('name', '=', line[cols['Booking Currency']])]) | 333 | booking_curr = line[cols['Booking Currency']] |
103 | 334 | curr_ids = self.pool.get('res.currency').search(cr, uid, [('name', '=', booking_curr)]) | ||
104 | 329 | if not curr_ids: | 335 | if not curr_ids: |
106 | 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,)) |
107 | 331 | continue | 337 | continue |
108 | 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): |
109 | 333 | if not c.active: | 339 | if not c.active: |
111 | 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,)) |
112 | 335 | continue | 341 | continue |
113 | 336 | r_currency = curr_ids[0] | 342 | r_currency = curr_ids[0] |
122 | 337 | if not line[cols['Booking Currency']] in money: | 343 | if not line[cols['Period']]: |
123 | 338 | money[line[cols['Booking Currency']]] = {} | 344 | errors.append(_('Line %s. Period is missing.') % (current_line_num)) |
124 | 339 | if not 'debit' in money[line[cols['Booking Currency']]]: | 345 | continue |
125 | 340 | money[line[cols['Booking Currency']]]['debit'] = 0 | 346 | period_name = line[cols['Period']] |
126 | 341 | if not 'credit' in money[line[cols['Booking Currency']]]: | 347 | if not (booking_curr, period_name, r_document_date) in money: |
127 | 342 | money[line[cols['Booking Currency']]]['credit'] = 0 | 348 | money[(booking_curr, period_name, r_document_date)] = {} |
128 | 343 | if not 'name' in money[line[cols['Booking Currency']]]: | 349 | if not 'debit' in money[(booking_curr, period_name, r_document_date)]: |
129 | 344 | money[line[cols['Booking Currency']]]['name'] = line[cols['Booking Currency']] | 350 | money[(booking_curr, period_name, r_document_date)]['debit'] = 0 |
130 | 351 | if not 'credit' in money[(booking_curr, period_name, r_document_date)]: | ||
131 | 352 | money[(booking_curr, period_name, r_document_date)]['credit'] = 0 | ||
132 | 345 | # Increment global debit/credit | 353 | # Increment global debit/credit |
133 | 346 | if book_debit: | 354 | if book_debit: |
135 | 347 | money[line[cols['Booking Currency']]]['debit'] += book_debit | 355 | money[(booking_curr, period_name, r_document_date)]['debit'] += book_debit |
136 | 348 | r_debit = book_debit | 356 | r_debit = book_debit |
137 | 349 | if book_credit: | 357 | if book_credit: |
139 | 350 | money[line[cols['Booking Currency']]]['credit'] += book_credit | 358 | money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit |
140 | 351 | r_credit = book_credit | 359 | r_credit = book_credit |
141 | 352 | 360 | ||
142 | 353 | # Check which journal it is to be posted to: should be of type OD, MIG or INT | 361 | # Check which journal it is to be posted to: should be of type OD, MIG or INT |
143 | @@ -504,12 +512,12 @@ | |||
144 | 504 | continue | 512 | continue |
145 | 505 | 513 | ||
146 | 506 | # US-937: use period of import file | 514 | # US-937: use period of import file |
148 | 507 | if line[cols['Period']].startswith('Period 16'): | 515 | if period_name.startswith('Period 16'): |
149 | 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.")) |
150 | 509 | period_ids = period_obj.search( | 517 | period_ids = period_obj.search( |
151 | 510 | cr, uid, [ | 518 | cr, uid, [ |
152 | 511 | ('id', 'in', wiz_period_ids), | 519 | ('id', 'in', wiz_period_ids), |
154 | 512 | ('name', '=', line[cols['Period']]), | 520 | ('name', '=', period_name), |
155 | 513 | ], limit=1, context=context) | 521 | ], limit=1, context=context) |
156 | 514 | if not period_ids: | 522 | if not period_ids: |
157 | 515 | raise osv.except_osv(_('Warning'), | 523 | raise osv.except_osv(_('Warning'), |
158 | @@ -603,12 +611,16 @@ | |||
159 | 603 | continue | 611 | continue |
160 | 604 | created += 1 | 612 | created += 1 |
161 | 605 | # Check if all is ok for the file | 613 | # Check if all is ok for the file |
162 | 614 | if len(doc_date_periods) > 1: | ||
163 | 615 | errors.append(_('All Document Dates should be in the same period.')) | ||
164 | 606 | ## The lines should be balanced for each currency | 616 | ## The lines should be balanced for each currency |
165 | 607 | if not errors: | 617 | if not errors: |
166 | 608 | # to compare the right amounts do the check only if no line has been ignored because of an error | 618 | # to compare the right amounts do the check only if no line has been ignored because of an error |
170 | 609 | for c in money: | 619 | for curr, per, doc_date in money: |
171 | 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'] |
172 | 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: |
173 | 622 | raise osv.except_osv(_('Error'), _('Amount unbalanced for the Currency %s and the Document Date %s (Period: %s): %s') % | ||
174 | 623 | (curr, doc_date, per, amount,)) | ||
175 | 612 | # Update wizard | 624 | # Update wizard |
176 | 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}) |
177 | 614 | 626 | ||
178 | 615 | 627 | ||
179 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' | |||
180 | --- bin/addons/msf_profile/i18n/fr_MF.po 2019-05-10 15:26:36 +0000 | |||
181 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2019-05-13 07:25:22 +0000 | |||
182 | @@ -23872,10 +23872,10 @@ | |||
183 | 23872 | msgstr "Derniers taux de change" | 23872 | msgstr "Derniers taux de change" |
184 | 23873 | 23873 | ||
185 | 23874 | #. module: msf_doc_import | 23874 | #. module: msf_doc_import |
187 | 23875 | #: code:addons/msf_doc_import/account.py:73 | 23875 | #: code:addons/msf_doc_import/account.py:74 |
188 | 23876 | #, python-format | 23876 | #, python-format |
191 | 23877 | msgid "Grouping by currencies…" | 23877 | msgid "Grouping by currency and date…" |
192 | 23878 | msgstr "Regroupement par monnaies…" | 23878 | msgstr "Regroupement par devise et date…" |
193 | 23879 | 23879 | ||
194 | 23880 | #. module: stock_override | 23880 | #. module: stock_override |
195 | 23881 | #: field:stock.picking,incoming_id:0 | 23881 | #: field:stock.picking,incoming_id:0 |
196 | @@ -41335,10 +41335,10 @@ | |||
197 | 41335 | msgstr "Retry from time" | 41335 | msgstr "Retry from time" |
198 | 41336 | 41336 | ||
199 | 41337 | #. module: msf_doc_import | 41337 | #. module: msf_doc_import |
201 | 41338 | #: code:addons/msf_doc_import/account.py:588 | 41338 | #: code:addons/msf_doc_import/account.py:622 |
202 | 41339 | #, python-format | 41339 | #, python-format |
205 | 41340 | msgid "Currency %s is not balanced: %s" | 41340 | msgid "Amount unbalanced for the Currency %s and the Document Date %s (Period: %s): %s" |
206 | 41341 | msgstr "La devise %s n'est pas équilibrée : %s" | 41341 | msgstr "Montant non équilibré pour la Devise %s et la Date de Document %s (Période : %s) : %s" |
207 | 41342 | 41342 | ||
208 | 41343 | #. module: msf_partner | 41343 | #. module: msf_partner |
209 | 41344 | #: code:addons/msf_partner/partner.py:754 | 41344 | #: code:addons/msf_partner/partner.py:754 |
210 | @@ -58195,10 +58195,10 @@ | |||
211 | 58195 | msgstr "Valeurs d'origine" | 58195 | msgstr "Valeurs d'origine" |
212 | 58196 | 58196 | ||
213 | 58197 | #. module: msf_doc_import | 58197 | #. module: msf_doc_import |
215 | 58198 | #: code:addons/msf_doc_import/account.py:81 | 58198 | #: code:addons/msf_doc_import/account.py:83 |
216 | 58199 | #, python-format | 58199 | #, python-format |
219 | 58200 | msgid "Writing a move for each currency…" | 58200 | msgid "Writing of the Journal Entries…" |
220 | 58201 | msgstr "Enregistrement d'une écriture comptable pour chaque monnaie…" | 58201 | msgstr "Enregistrement des Écritures Comptables…" |
221 | 58202 | 58202 | ||
222 | 58203 | #. module: base | 58203 | #. module: base |
223 | 58204 | #: code:addons/base/ir/ir_actions.py:677 | 58204 | #: code:addons/base/ir/ir_actions.py:677 |
224 | @@ -105896,6 +105896,7 @@ | |||
225 | 105896 | #: field:product.mass.update,empty_status:0 | 105896 | #: field:product.mass.update,empty_status:0 |
226 | 105897 | msgid "Set Status as empty" | 105897 | msgid "Set Status as empty" |
227 | 105898 | msgstr "Mettre le Statut à vide" | 105898 | msgstr "Mettre le Statut à vide" |
228 | 105899 | <<<<<<< TREE | ||
229 | 105899 | 105900 | ||
230 | 105900 | #. module: sourcing | 105901 | #. module: sourcing |
231 | 105901 | #: code:addons/sourcing/sale_order_line.py:1606 | 105902 | #: code:addons/sourcing/sale_order_line.py:1606 |
232 | @@ -105941,3 +105942,17 @@ | |||
233 | 105941 | #, python-format | 105942 | #, python-format |
234 | 105942 | msgid "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." | 105943 | msgid "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." |
235 | 105943 | msgstr "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." | 105944 | msgstr "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." |
236 | 105945 | ======= | ||
237 | 105946 | |||
238 | 105947 | #. module: msf_doc_import | ||
239 | 105948 | #: code:addons/msf_doc_import/account.py:343 | ||
240 | 105949 | #, python-format | ||
241 | 105950 | msgid "Line %s. Period is missing." | ||
242 | 105951 | msgstr "Ligne %s. Il manque la Période." | ||
243 | 105952 | |||
244 | 105953 | #. module: msf_doc_import | ||
245 | 105954 | #: code:addons/msf_doc_import/account.py:615 | ||
246 | 105955 | #, python-format | ||
247 | 105956 | msgid "All Document Dates should be in the same period." | ||
248 | 105957 | msgstr "Toutes les Dates de Document doivent être dans la même période." | ||
249 | 105958 | >>>>>>> MERGE-SOURCE |