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

Proposed by jftempo
Status: Merged
Merged at revision: 4906
Proposed branch: lp:~julie-w/unifield-server/US-4546
Merge into: lp:unifield-server
Diff against target: 401 lines (+127/-46)
7 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+3/-3)
bin/addons/vertical_integration/report/hq_report_ocb.py (+2/-2)
bin/addons/vertical_integration/report/hq_report_ocb_matching.py (+1/-1)
bin/addons/vertical_integration/report/hq_report_ocp.py (+108/-32)
bin/addons/vertical_integration/report/hq_report_ocp_matching.py (+9/-4)
bin/addons/vertical_integration/wizard/ocp_export.py (+2/-2)
bin/addons/vertical_integration/wizard/ocp_matching_export.py (+2/-2)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-4546
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+345486@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
1=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
2--- bin/addons/msf_profile/i18n/fr_MF.po 2018-04-27 09:58:55 +0000
3+++ bin/addons/msf_profile/i18n/fr_MF.po 2018-05-14 07:59:07 +0000
4@@ -18679,7 +18679,7 @@
5 #: model:ir.actions.act_window,name:vertical_integration.action_hq_export_ocp
6 #: model:ir.ui.menu,name:vertical_integration.menu_action_hq_export_ocp
7 msgid "Export to HQ system (OCP)"
8-msgstr "Export to HQ system (OCP)"
9+msgstr "Export au système HQ (OCP)"
10
11 #. module: stock
12 #: code:addons/stock/physical_inventory.py:1313
13@@ -30434,7 +30434,7 @@
14 #: field:wizard.hq.report.ocg,fiscalyear_id:0
15 #, python-format
16 msgid "Fiscal year"
17-msgstr "Fiscal year"
18+msgstr "Exercice comptable"
19
20 #. module: account
21 #: help:account.installer.modules,account_voucher:0
22@@ -78256,7 +78256,7 @@
23 #: field:wizard.hq.report.ocg,period_id:0
24 #, python-format
25 msgid "Period"
26-msgstr "Period"
27+msgstr "Période"
28
29 #. module: export_import_lang
30 #: code:addons/export_import_lang/lang_tools.py:26
31
32=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb.py'
33--- bin/addons/vertical_integration/report/hq_report_ocb.py 2018-04-18 09:35:06 +0000
34+++ bin/addons/vertical_integration/report/hq_report_ocb.py 2018-05-14 07:59:07 +0000
35@@ -248,7 +248,7 @@
36 return self.postprocess_selection_columns(cr, uid, new_data, [('account.bank.statement', 'state', 6)], column_deletion=column_deletion)
37
38
39-# request used for OCB VI and for Liquidity Balances report
40+# request used for OCB VI, OCP VI and for Liquidity Balances report
41 liquidity_sql = """
42 SELECT i.code AS instance, j.code, j.name, %s AS period, req.opening, req.calculated, req.closing, c.name AS currency
43 FROM res_currency c,
44@@ -321,7 +321,7 @@
45 context = {}
46 # Prepare some values
47 pool = pooler.get_pool(cr.dbname)
48- excluded_journal_types = ['hq'] # journal types that should not be used to take lines
49+ excluded_journal_types = ['hq', 'migration'] # journal types that should not be used to take lines
50 # Fetch data from wizard
51 if not data.get('form', False):
52 raise osv.except_osv(_('Error'), _('No data retrieved. Check that the wizard is filled in.'))
53
54=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb_matching.py'
55--- bin/addons/vertical_integration/report/hq_report_ocb_matching.py 2017-04-19 13:01:56 +0000
56+++ bin/addons/vertical_integration/report/hq_report_ocb_matching.py 2018-05-14 07:59:07 +0000
57@@ -71,7 +71,7 @@
58 if context is None:
59 context = {}
60 # Prepare some values
61- excluded_journal_types = ['hq']
62+ excluded_journal_types = ['hq', 'migration']
63 # Fetch data from wizard
64 if not data.get('form', False):
65 raise osv.except_osv(_('Error'), _('No data retrieved. Check that the wizard is filled in.'))
66
67=== modified file 'bin/addons/vertical_integration/report/hq_report_ocp.py'
68--- bin/addons/vertical_integration/report/hq_report_ocp.py 2018-04-18 09:35:06 +0000
69+++ bin/addons/vertical_integration/report/hq_report_ocp.py 2018-05-14 07:59:07 +0000
70@@ -25,7 +25,6 @@
71 import time
72 from time import strftime
73 from time import strptime
74-import re
75
76 from account_override import finance_export
77 import hq_report_ocb
78@@ -36,6 +35,8 @@
79 class finance_archive(finance_export.finance_archive):
80 """
81 Extend existing class with new methods for this particular export.
82+
83+ Note: this report has NOT been translated: headers of all reports for OCP VI remain in English whatever the language selected
84 """
85
86 _journal_types = None
87@@ -63,8 +64,8 @@
88 Takes data in parameter corresponding to ACCOUNT MOVE LINES (results from 'bs_entries' or 'plresult' requests)
89 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
90 2) Modifies it for all OD entries that originate from HQ entry corrections:
91- - instance: becomes 'SIEG'
92- - journal: for the journal name, the description field is used: we take the 3 digits starting from the 11th one
93+ - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
94+ - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
95 Returns a list of tuples (same format as data)
96 """
97 new_data = []
98@@ -75,6 +76,7 @@
99 instance_code = 1
100 journal = 2
101 description = 4
102+ reference = 5
103 journal_type = 22
104 for line in data:
105 line_list = list(line)
106@@ -97,17 +99,9 @@
107 if corr_aml.journal_id.type == 'hq':
108 od_hq_entry = True
109 if od_hq_entry:
110- line_list[instance_code] = 'SIEG'
111- # for the 3 characters of the journal name taken from the 11th character of the description field:
112- # exclude the "CORx - " or "REV - " or "REV - CORx - " part
113- descr = ''
114- if re.match('^COR\d - ', line_list[description]):
115- descr = line_list[description][7:]
116- elif re.match('^REV - COR\d - ', line_list[description]):
117- descr = line_list[description][13:]
118- elif line_list[description].startswith('REV - '):
119- descr = line_list[description][6:]
120- line_list[journal] = descr and descr[10:13] or ''
121+ original_ref = corr_aml.ref or ''
122+ line_list[instance_code] = original_ref.startswith('EAUD') and 'EAUD' or 'SIEG'
123+ line_list[journal] = original_ref[8:11] or ''
124 new_data.append(tuple(line_list))
125 return new_data
126
127@@ -116,8 +110,8 @@
128 Takes data in parameter corresponding to ACCOUNT ANALYTIC LINES (results from 'rawdata' request)
129 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
130 2) Modifies it for all OD entries that originate from HQ entry corrections:
131- - instance: becomes 'SIEG'
132- - journal: for the journal name, the description field is used: we take the 3 digits starting from the 11th one
133+ - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
134+ - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
135 Returns a list of tuples (same format as data)
136 """
137 new_data = []
138@@ -128,6 +122,7 @@
139 instance_code = 1
140 journal = 2
141 description = 4
142+ reference = 5
143 journal_type = 22
144 for line in data:
145 line_list = list(line)
146@@ -150,17 +145,9 @@
147 if corr_aal.journal_id.type == 'hq':
148 od_hq_entry = True
149 if od_hq_entry:
150- line_list[instance_code] = 'SIEG'
151- # for the 3 characters of the journal name taken from the 11th character of the description field:
152- # exclude the "CORx - " or "REV - " or "REV - CORx - " part
153- descr = ''
154- if re.match('^COR\d - ', line_list[description]):
155- descr = line_list[description][7:]
156- elif re.match('^REV - COR\d - ', line_list[description]):
157- descr = line_list[description][13:]
158- elif line_list[description].startswith('REV - '):
159- descr = line_list[description][6:]
160- line_list[journal] = descr and descr[10:13] or ''
161+ original_ref = corr_aal.ref or ''
162+ line_list[instance_code] = original_ref.startswith('EAUD') and 'EAUD' or 'SIEG'
163+ line_list[journal] = original_ref[8:11] or ''
164 new_data.append(tuple(line_list))
165 return new_data
166
167@@ -227,7 +214,8 @@
168 mi_obj = pool.get('msf.instance')
169 m_obj = pool.get('account.move')
170 ml_obj = pool.get('account.move.line')
171- excluded_journal_types = ['hq', 'cur_adj'] # journal types that should not be used to take lines
172+ excluded_journal_types = ['hq', 'migration'] # journal types that should not be used to take lines
173+ reg_types = ('cash', 'bank', 'cheque')
174 # Fetch data from wizard
175 if not data.get('form', False):
176 raise osv.except_osv(_('Error'), _('No data retrieved. Check that the wizard is filled in.'))
177@@ -241,8 +229,12 @@
178 period = pool.get('account.period').browse(cr, uid, period_id, context=context,
179 fields_to_fetch=['date_start', 'date_stop', 'number'])
180 first_day_of_period = period.date_start
181+ last_day_of_period = period.date_stop
182 tm = strptime(first_day_of_period, '%Y-%m-%d')
183 year_num = tm.tm_year
184+ year = str(year_num)
185+ month = '%02d' % (tm.tm_mon)
186+ period_yyyymm = "{0}{1}".format(year, month)
187
188 # US-822: if December is picked should:
189 # - include Period 16 action 2 Year end PL RESULT entries
190@@ -276,7 +268,7 @@
191 # - key: name of the SQL request
192 # - value: the SQL request to use
193 sqlrequests = {
194- # Pay attention to take analytic lines that are not on HQ, MIGRATION and FXA journals.
195+ # Pay attention to take analytic lines that are not on HQ and MIGRATION journals.
196 'rawdata': """
197 SELECT al.id, SUBSTR(i.code, 1, 3),
198 CASE WHEN j.code = 'OD' THEN j.code ELSE aj.code END AS journal,
199@@ -322,7 +314,7 @@
200 AND j.type not in %s
201 AND al.instance_id in %s;
202 """,
203- # Exclude lines that come from a HQ, MIGRATION or FXA journal
204+ # Exclude lines that come from a HQ or MIGRATION journal
205 # Take all lines that are on account that is "shrink_entries_for_hq" which will make a consolidation of them (with a second SQL request)
206 # Don't include the lines that have analytic lines. This is to not retrieve expense/income accounts
207 'bs_entries_consolidated': """
208@@ -363,6 +355,72 @@
209 AND m.state = 'posted'
210 ORDER BY aml.id;
211 """,
212+ 'liquidity': hq_report_ocb.liquidity_sql,
213+ # Migration journals ONLY are excluded from the Account Balances
214+ 'account_balances_per_currency': """
215+ SELECT i.code AS instance, acc.code, acc.name, %s AS period, req.opening, req.calculated, req.closing,
216+ c.name AS currency
217+ FROM
218+ (
219+ SELECT instance_id, account_id, currency_id, SUM(col1) AS opening,
220+ SUM(col2) AS calculated, SUM(col3) AS closing
221+ FROM (
222+ (
223+ SELECT aml.instance_id AS instance_id, aml.account_id AS account_id,
224+ aml.currency_id AS currency_id,
225+ ROUND(SUM(amount_currency), 2) as col1, 0.00 as col2, 0.00 as col3
226+ FROM account_move_line AS aml
227+ LEFT JOIN account_journal j ON aml.journal_id = j.id
228+ LEFT JOIN account_account acc ON aml.account_id = acc.id
229+ LEFT JOIN res_currency curr ON aml.currency_id = curr.id
230+ WHERE acc.active = 't'
231+ AND curr.active = 't'
232+ AND aml.date < %s
233+ AND j.instance_id IN %s
234+ AND j.type != 'migration'
235+ GROUP BY aml.instance_id, aml.account_id, aml.currency_id
236+ )
237+ UNION
238+ (
239+ SELECT aml.instance_id AS instance_id, aml.account_id AS account_id,
240+ aml.currency_id AS currency_id,
241+ 0.00 as col1, ROUND(SUM(amount_currency), 2) as col2, 0.00 as col3
242+ FROM account_move_line AS aml
243+ LEFT JOIN account_journal j ON aml.journal_id = j.id
244+ LEFT JOIN account_account acc ON aml.account_id = acc.id
245+ LEFT JOIN res_currency curr ON aml.currency_id = curr.id
246+ WHERE acc.active = 't'
247+ AND curr.active = 't'
248+ AND aml.period_id = %s
249+ AND j.instance_id IN %s
250+ AND j.type != 'migration'
251+ GROUP BY aml.instance_id, aml.account_id, aml.currency_id
252+ )
253+ UNION
254+ (
255+ SELECT aml.instance_id AS instance_id, aml.account_id AS account_id,
256+ aml.currency_id AS currency_id,
257+ 0.00 as col1, 0.00 as col2, ROUND(SUM(amount_currency), 2) as col3
258+ FROM account_move_line AS aml
259+ LEFT JOIN account_journal j ON aml.journal_id = j.id
260+ LEFT JOIN account_account acc ON aml.account_id = acc.id
261+ LEFT JOIN res_currency curr ON aml.currency_id = curr.id
262+ WHERE acc.active = 't'
263+ AND curr.active = 't'
264+ AND aml.date <= %s
265+ AND j.instance_id IN %s
266+ AND j.type != 'migration'
267+ GROUP BY aml.instance_id, aml.account_id, aml.currency_id
268+ )
269+ ) AS ssreq
270+ GROUP BY instance_id, account_id, currency_id
271+ ORDER BY instance_id, account_id, currency_id
272+ ) AS req
273+ INNER JOIN account_account acc ON req.account_id = acc.id
274+ INNER JOIN res_currency c ON req.currency_id = c.id
275+ INNER JOIN msf_instance i ON req.instance_id = i.id
276+ WHERE (req.opening != 0.0 OR req.calculated != 0.0 OR req.closing != 0.0);
277+ """,
278 }
279 if plresult_ji_in_ids:
280 # NOTE: for these entries: booking and functional ccy are the same
281@@ -406,12 +464,14 @@
282 # + If you cannot do a SQL request to create the content of the file, do a simple request (with key) and add a postprocess function that returns the result you want
283
284 # Define the file name according to the following format:
285- # First3DigitsOfInstanceCode_chosenPeriod_currentDatetime_Monthly Export.csv (ex: KE1_201609_171116110306_Monthly Export.csv)
286+ # First3DigitsOfInstanceCode_chosenPeriod_currentDatetime_Monthly_Export.csv (ex: KE1_201609_171116110306_Monthly_Export.csv)
287 inst = mi_obj.browse(cr, uid, instance_id, context=context, fields_to_fetch=['code'])
288 instance_code = inst and inst.code[:3] or ''
289 selected_period = strftime('%Y%m', strptime(first_day_of_period, '%Y-%m-%d')) or ''
290 current_time = time.strftime('%d%m%y%H%M%S')
291- monthly_export_filename = '%s_%s_%s_Monthly Export.csv' % (instance_code, selected_period, current_time)
292+ monthly_export_filename = '%s_%s_%s_Monthly_Export.csv' % (instance_code, selected_period, current_time)
293+ liquidity_balance_filename = '%s_%s_%s_Liquidity_Balances.csv' % (instance_code, selected_period, current_time)
294+ account_balance_filename = '%s_%s_%s_Account_Balances.csv' % (instance_code, selected_period, current_time)
295
296 processrequests = [
297 {
298@@ -442,6 +502,22 @@
299 'id': 0,
300 'object': 'account.move.line',
301 },
302+ {
303+ 'headers': ['Instance', 'Code', 'Name', 'Period', 'Opening balance', 'Calculated balance',
304+ 'Closing balance', 'Currency'],
305+ 'filename': liquidity_balance_filename,
306+ 'key': 'liquidity',
307+ 'query_params': (tuple([period_yyyymm]), reg_types, first_day_of_period, reg_types, period.id,
308+ reg_types, last_day_of_period, tuple(instance_ids)),
309+ },
310+ {
311+ 'headers': ['Instance', 'Account', 'Account Name', 'Period', 'Opening balance', 'Calculated balance',
312+ 'Closing balance', 'Booking Currency'],
313+ 'filename': account_balance_filename,
314+ 'key': 'account_balances_per_currency',
315+ 'query_params': (tuple([period_yyyymm]), first_day_of_period, tuple(instance_ids), period.id,
316+ tuple(instance_ids), last_day_of_period, tuple(instance_ids)),
317+ },
318 ]
319 if plresult_ji_in_ids:
320 processrequests.append({
321
322=== modified file 'bin/addons/vertical_integration/report/hq_report_ocp_matching.py'
323--- bin/addons/vertical_integration/report/hq_report_ocp_matching.py 2017-02-09 10:35:44 +0000
324+++ bin/addons/vertical_integration/report/hq_report_ocp_matching.py 2018-05-14 07:59:07 +0000
325@@ -33,6 +33,11 @@
326 from report import report_sxw
327
328 class finance_archive(finance_export.finance_archive):
329+ """
330+ Extends existing class with new methods for OCP Matching Export.
331+
332+ Note: this report has NOT been translated: headers of all reports for OCP VI remain in English whatever the language selected
333+ """
334
335 def postprocess_reconciliable(self, cr, uid, data, model, column_deletion=False):
336 """
337@@ -125,7 +130,7 @@
338 pool = pooler.get_pool(cr.dbname)
339 instance_obj = pool.get('msf.instance')
340 period_obj = pool.get('account.period')
341- excluded_journal_types = ['hq', 'cur_adj']
342+ excluded_journal_types = ['hq', 'migration']
343 # Fetch data from wizard
344 if not data.get('form', False):
345 raise osv.except_osv(_('Error'), _('No data retrieved. Check that the wizard is filled in.'))
346@@ -167,8 +172,8 @@
347 }
348
349 # Define the file name according to the following format:
350- # First3DigitsOfInstanceCode_chosenPeriod_currentDatetime_Check on reconcilable entries.csv
351- # (ex: KE1_201610_171116110306_Check on reconcilable entries.csv)
352+ # First3DigitsOfInstanceCode_chosenPeriod_currentDatetime_Check_on_reconcilable_entries.csv
353+ # (ex: KE1_201610_171116110306_Check_on_reconcilable_entries.csv)
354 instance = instance_obj.browse(cr, uid, instance_id, context=context, fields_to_fetch=['code'])
355 instance_code = instance and instance.code[:3] or ''
356 period = period_obj.browse(cr, uid, period_id, context=context, fields_to_fetch=['date_start', 'date_stop'])
357@@ -176,7 +181,7 @@
358 date_stop = period.date_stop
359 selected_period = strftime('%Y%m', strptime(date_start, '%Y-%m-%d')) or ''
360 current_time = time.strftime('%d%m%y%H%M%S')
361- reconcilable_entries_filename = '%s_%s_%s_Check on reconcilable entries.csv' % (instance_code, selected_period, current_time)
362+ reconcilable_entries_filename = '%s_%s_%s_Check_on_reconcilable_entries.csv' % (instance_code, selected_period, current_time)
363
364 processrequests = [
365 {
366
367=== modified file 'bin/addons/vertical_integration/wizard/ocp_export.py'
368--- bin/addons/vertical_integration/wizard/ocp_export.py 2017-02-09 10:35:44 +0000
369+++ bin/addons/vertical_integration/wizard/ocp_export.py 2018-05-14 07:59:07 +0000
370@@ -81,11 +81,11 @@
371 # - the first 3 digits of the Prop. Instance code
372 # - the year and month of the selected period
373 # - the current datetime
374- # Ex: KE1_201609_171116110306_Monthly Export
375+ # Ex: KE1_201609_171116110306_Formatted_data_UF_to_OCP_HQ_System
376 instance_code = inst and inst.code[:3] or ''
377 selected_period = period and strftime('%Y%m', strptime(period.date_start, '%Y-%m-%d')) or ''
378 current_time = time.strftime('%d%m%y%H%M%S')
379- data['target_filename'] = '%s_%s_%s_Monthly Export' % (instance_code, selected_period, current_time)
380+ data['target_filename'] = '%s_%s_%s_Formatted_data_UF_to_OCP_HQ_System' % (instance_code, selected_period, current_time)
381
382 background_id = self.pool.get('memory.background.report').create(cr, uid, {
383 'file_name': data['target_filename'],
384
385=== modified file 'bin/addons/vertical_integration/wizard/ocp_matching_export.py'
386--- bin/addons/vertical_integration/wizard/ocp_matching_export.py 2017-02-09 10:35:44 +0000
387+++ bin/addons/vertical_integration/wizard/ocp_matching_export.py 2018-05-14 07:59:07 +0000
388@@ -68,11 +68,11 @@
389 # - the first 3 digits of the Prop. Instance code
390 # - the year and month of the selected period
391 # - the current datetime
392- # Ex: KE1_201610_171116110306_Check on reconcilable entries
393+ # Ex: KE1_201610_171116110306_Check_on_reconcilable_entries
394 instance_code = inst and inst.code[:3] or ''
395 selected_period = period and strftime('%Y%m', strptime(period.date_start, '%Y-%m-%d')) or ''
396 current_time = time.strftime('%d%m%y%H%M%S')
397- data['target_filename'] = '%s_%s_%s_Check on reconcilable entries' % (instance_code, selected_period, current_time)
398+ data['target_filename'] = '%s_%s_%s_Check_on_reconcilable_entries' % (instance_code, selected_period, current_time)
399
400 background_id = self.pool.get('memory.background.report').create(cr, uid, {
401 'file_name': data['target_filename'],

Subscribers

People subscribed via source and target branches