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

Proposed by jftempo
Status: Merged
Merged at revision: 5583
Proposed branch: lp:~julie-w/unifield-server/US-6898
Merge into: lp:unifield-server
Diff against target: 951 lines (+412/-116) (has conflicts)
20 files modified
bin/addons/account/project/project.py (+55/-0)
bin/addons/account_corrections/account_move_line.py (+16/-18)
bin/addons/account_corrections/wizard/analytic_distribution_wizard.py (+13/-20)
bin/addons/account_hq_entries/wizard/hq_entries_validation.py (+17/-30)
bin/addons/account_journal/account_journal.py (+71/-1)
bin/addons/account_journal/project/project.py (+3/-1)
bin/addons/account_override/account.py (+5/-1)
bin/addons/analytic_distribution/analytic_line.py (+28/-21)
bin/addons/msf_doc_import/__init__.py (+2/-2)
bin/addons/msf_doc_import/account.py (+1/-1)
bin/addons/msf_profile/data/patches.xml (+8/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+103/-12)
bin/addons/msf_profile/msf_profile.py (+73/-0)
bin/addons/msf_sync_data_coordo/__openerp__.py (+2/-0)
bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv (+2/-0)
bin/addons/msf_sync_data_coordo/data/account.journal.csv (+2/-0)
bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv (+1/-0)
bin/addons/msf_sync_data_post_synchro/data/account.journal.csv (+1/-0)
bin/addons/vertical_integration/report/hq_report_ocb.py (+1/-1)
bin/addons/vertical_integration/report/hq_report_ocp.py (+8/-8)
Text conflict in bin/addons/msf_profile/data/patches.xml
Text conflict in bin/addons/msf_profile/msf_profile.py
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-6898
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+378097@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/account/project/project.py'
2--- bin/addons/account/project/project.py 2011-01-14 00:11:01 +0000
3+++ bin/addons/account/project/project.py 2020-01-27 10:41:30 +0000
4@@ -39,8 +39,63 @@
5 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
6 }
7
8+ def _check_corr_type(self, cr, uid, ids, context=None):
9+ """
10+ Check that only one "Correction" and one "Correction HQ" analytic journals exist per instance
11+ """
12+ if context is None:
13+ context = {}
14+ for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
15+ if analytic_journal.type in ('correction', 'correction_hq'):
16+ analytic_journal_dom = [('type', '=', analytic_journal.type),
17+ ('instance_id', '=', analytic_journal.instance_id.id),
18+ ('id', '!=', analytic_journal.id)]
19+ if self.search_exist(cr, uid, analytic_journal_dom, context=context):
20+ return False
21+ return True
22+
23+ def _check_hq_corr(self, cr, uid, ids, context=None):
24+ """
25+ Check that the prop. instance of the "Correction HQ" analytic journal is a coordo
26+ """
27+ if context is None:
28+ context = {}
29+ for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
30+ if analytic_journal.type == 'correction_hq' and analytic_journal.instance_id.level != 'coordo':
31+ return False
32+ return True
33+
34+ _constraints = [
35+ (_check_corr_type, 'An analytic journal with this type already exists for this instance.', ['type', 'instance_id']),
36+ (_check_hq_corr, 'The prop. instance of the "Correction HQ" analytic journal must be a coordination.', ['type', 'instance_id']),
37+ ]
38+
39+ def get_correction_analytic_journal(self, cr, uid, corr_type=False, context=None):
40+ """
41+ Returns the correction analytic journal of the current instance (or False if not found):
42+ - by default => standard Correction journal
43+ - corr_type 'hq' => Correction HQ journal
44+ - corr_type 'extra' => OD-Extra Accounting journal
45+ - corr_type 'manual' => Correction Manual journal
46+ """
47+ if context is None:
48+ context = {}
49+ if corr_type == 'hq':
50+ analytic_journal_type = 'correction_hq'
51+ elif corr_type == 'extra':
52+ analytic_journal_type = 'extra'
53+ elif corr_type == 'manual':
54+ analytic_journal_type = 'correction_manual'
55+ else:
56+ analytic_journal_type = 'correction'
57+ analytic_journal_ids = self.search(cr, uid, [('type', '=', analytic_journal_type), ('is_current_instance', '=', True)],
58+ order='id', limit=1, context=context)
59+ return analytic_journal_ids and analytic_journal_ids[0] or False
60+
61+
62 account_analytic_journal()
63
64+
65 class account_journal(osv.osv):
66 _inherit="account.journal"
67
68
69=== modified file 'bin/addons/account_corrections/account_move_line.py'
70--- bin/addons/account_corrections/account_move_line.py 2019-10-30 16:33:21 +0000
71+++ bin/addons/account_corrections/account_move_line.py 2020-01-27 10:41:30 +0000
72@@ -448,19 +448,11 @@
73 ana_j_obj = self.pool.get('account.analytic.journal')
74 aal_obj = self.pool.get('account.analytic.line')
75 # Search correction journal
76- j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'),
77- ('is_current_instance', '=', True)], order='id', limit=1, context=context)
78- j_corr_id = j_corr_ids and j_corr_ids[0] or False
79- j_ana_corr_ids = ana_j_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],
80- order='id', limit=1, context=context)
81- j_ana_corr_id = j_ana_corr_ids and j_ana_corr_ids[0] or False
82+ j_corr_id = j_obj.get_correction_journal(cr, uid, context=context)
83+ j_ana_corr_id = ana_j_obj.get_correction_analytic_journal(cr, uid, context=context)
84 # Search extra-accounting journal
85- j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'),
86- ('is_current_instance', '=', True)], order='id', limit=1)
87- j_extra_id = j_extra_ids and j_extra_ids[0] or False
88- j_ana_extra_ids = ana_j_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],
89- order='id', limit=1, context=context)
90- j_ana_extra_id = j_ana_extra_ids and j_ana_extra_ids[0] or False
91+ j_extra_id = j_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
92+ j_ana_extra_id = ana_j_obj.get_correction_analytic_journal(cr, uid, corr_type='extra', context=context)
93
94 # Search attached period
95 period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)], context=context,
96@@ -662,14 +654,13 @@
97 new_account_id, context=context)
98
99 # Search correction journal
100- j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'),
101- ('is_current_instance', '=', True)], order='id', limit=1, context=context)
102- j_corr_id = j_corr_ids and j_corr_ids[0] or False
103+ j_corr_id = j_obj.get_correction_journal(cr, uid, context=context)
104
105 # Search extra-accounting journal
106- j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'),
107- ('is_current_instance', '=', True)], order='id', limit=1)
108- j_extra_id = j_extra_ids and j_extra_ids[0] or False
109+ j_extra_id = j_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
110+
111+ # Search for the "Correction HQ" journal
112+ hq_corr_journal_id = j_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
113
114 # Search attached period
115 period_obj = self.pool.get('account.period')
116@@ -718,6 +709,13 @@
117 raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!'))
118 if new_account.type_for_register != 'donation':
119 raise osv.except_osv(_('Error'), _('You come from a donation account. And new one is not a Donation account. You should give a Donation account!'))
120+
121+ # Correction: of an HQ entry, or of a correction of an HQ entry
122+ if ml.journal_id.type in ('hq', 'correction_hq'):
123+ journal_id = hq_corr_journal_id
124+ if not journal_id:
125+ raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
126+
127 if not journal_id:
128 raise osv.except_osv(_('Error'), _('No correction journal found!'))
129
130
131=== modified file 'bin/addons/account_corrections/wizard/analytic_distribution_wizard.py'
132--- bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2019-10-31 14:53:19 +0000
133+++ bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2020-01-27 10:41:30 +0000
134@@ -150,6 +150,8 @@
135 wizard = self.browse(cr, uid, wizard_id)
136 ad_obj = self.pool.get('analytic.distribution')
137 ana_line_obj = self.pool.get('account.analytic.line')
138+ journal_obj = self.pool.get('account.journal')
139+ analytic_journal_obj = self.pool.get('account.analytic.journal')
140 company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
141 ml = wizard.move_line_id
142 # US-5848: orig_date left unchanged not to break historical behavior,
143@@ -176,12 +178,12 @@
144 entry_seq_data['sequence'] = biggest_reversal_aji.entry_sequence
145
146 jtype = 'correction'
147- if wizard.move_line_id.account_id and wizard.move_line_id.account_id.type_for_register == 'donation':
148+ if ml.account_id.type_for_register == 'donation':
149 jtype = 'extra'
150- correction_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid,
151- [('type', '=', jtype), ('is_current_instance', '=', True)],
152- order='id', limit=1)
153- correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False
154+ # Correction: of an HQ entry, or of a correction of an HQ entry
155+ elif ml.journal_id.type in ('hq', 'correction_hq'):
156+ jtype = 'hq'
157+ correction_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type=jtype, context=context)
158 if not correction_journal_id:
159 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))
160 to_create = []
161@@ -191,19 +193,11 @@
162 old_line_ok = []
163 any_reverse = False
164 # Prepare journal and period information for entry sequences
165- journal_sql = """
166- SELECT id, code
167- FROM account_journal
168- WHERE type = %s
169- AND is_current_instance = true
170- ORDER BY id
171- LIMIT 1;
172- """
173- cr.execute(journal_sql, (jtype,))
174- journal_sql_res = cr.fetchone()
175- journal_id = journal_sql_res[0]
176- code = journal_sql_res[1]
177- journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
178+ journal_id = journal_obj.get_correction_journal(cr, uid, corr_type=jtype, context=context)
179+ if not journal_id:
180+ raise osv.except_osv(_('Error'), _('No journal found for corrections!'))
181+ journal = journal_obj.browse(cr, uid, journal_id, context=context)
182+ code = journal.code
183 period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date=posting_date, context=context)
184 if not period_ids:
185 raise osv.except_osv(_('Warning'), _('No period found for creating sequence on the given date: %s') % (posting_date or ''))
186@@ -248,8 +242,7 @@
187 # US-1343/2: flag that the chain origin is an HQ
188 # entry: in other terms OD AJI from a HQ JI
189 is_HQ_origin = {
190- 'from_od': \
191- original_al.journal_id.type == 'correction',
192+ 'from_od': original_al.journal_id.type in ('correction', 'correction_hq'),
193 }
194 break
195
196
197=== modified file 'bin/addons/account_hq_entries/wizard/hq_entries_validation.py'
198--- bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2019-10-30 16:33:21 +0000
199+++ bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2020-01-27 10:41:30 +0000
200@@ -262,12 +262,9 @@
201 original_lines = set()
202 original_move_ids = []
203 ana_line_obj = self.pool.get('account.analytic.line')
204- od_journal_ids = self.pool.get('account.journal').search(cr, uid,
205- [('type', '=', 'correction'), ('is_current_instance', '=', True)],
206- order='id', limit=1)
207- if not od_journal_ids:
208- raise osv.except_osv(_('Error'), _('No correction journal found!'))
209- od_journal_id = od_journal_ids[0]
210+ odhq_journal_id = self.pool.get('account.journal').get_correction_journal(cr, uid, corr_type='hq', context=context)
211+ if not odhq_journal_id:
212+ raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
213 all_lines = set()
214 pure_ad_cor_ji_ids = []
215 original_aji_ids = []
216@@ -302,7 +299,7 @@
217 curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
218 new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id,
219 line.currency_id.id, date=line.date, doc_date=line.document_date, source_date=curr_date,
220- journal=od_journal_id, orig_acct=original_account_id, split=True, context=context)
221+ journal=odhq_journal_id, orig_acct=original_account_id, split=True, context=context)
222 # original move line
223 original_ml_result = res_move[line.id]
224 # Mark new journal items as corrections for the first one
225@@ -343,14 +340,10 @@
226 initial_ana_ids = ana_line_obj.search(cr, uid, [('move_id.move_id', '=', move_id)]) # original move_id
227 original_aji_ids += initial_ana_ids
228 res_reverse = ana_line_obj.reverse(cr, uid, initial_ana_ids, posting_date=line.date, context=context)
229- acor_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid,
230- [('type', '=', 'correction'), ('is_current_instance', '=', True)],
231- order='id', limit=1)
232- if not acor_journal_ids:
233- raise osv.except_osv(_('Error'), _('No correction journal found!'))
234- acor_journal_id = acor_journal_ids[0]
235+ acor_journal_id = self.pool.get('account.analytic.journal').get_correction_analytic_journal(cr, uid,
236+ corr_type='hq', context=context)
237 if not acor_journal_id:
238- raise osv.except_osv(_('Warning'), _('No analytic correction journal found!'))
239+ raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!'))
240 ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id, 'move_id': counterpart_id[0]}) # UTP-1106: change move_id link as it's wrong one
241
242 # Mark new analytic items as correction for original line
243@@ -368,7 +361,7 @@
244 for aal in browse_aals:
245 cor_name = 'COR1 - ' + aal.name
246 ana_line_obj.write(cr, uid, aal.id, {'last_corrected_id': original_aal_ids[0],'name': cor_name, 'ref': cor_ref})
247- # also write the OD entry_sequence to the REV aal
248+ # also write the ODHQ entry_sequence to the REV aal
249 # ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id, 'entry_sequence': aal.entry_sequence})
250 cr.execute('''UPDATE account_analytic_line SET entry_sequence=%s WHERE id=%s''', (aal.entry_sequence, res_reverse[0]))
251
252@@ -408,13 +401,10 @@
253 ana_line_obj = self.pool.get('account.analytic.line')
254 distrib_fp_line_obj = self.pool.get('funding.pool.distribution.line')
255 distrib_cc_line_obj = self.pool.get('cost.center.distribution.line')
256- # Search an analytic correction journal
257- acor_journal_id = False
258- acor_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type', '=', 'correction'),
259- ('is_current_instance', '=', True)],
260- order='id', limit=1)
261- if acor_journal_ids:
262- acor_journal_id = acor_journal_ids[0]
263+ journal_obj = self.pool.get('account.journal')
264+ analytic_journal_obj = self.pool.get('account.analytic.journal')
265+ # Search for the "Correction HQ" analytic journal
266+ acor_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context)
267 # Tag active_ids as user validated
268 account_change = []
269 cc_change = []
270@@ -529,7 +519,7 @@
271 # Give them analytic correction journal (UF-1385 in comments)
272 if not acor_journal_id:
273 self.write(cr, uid, [wiz.id], {'running': False})
274- raise osv.except_osv(_('Warning'), _('No analytic correction journal found!'))
275+ raise osv.except_osv(_('Warning'), _('No "correction HQ" analytic journal found!'))
276 ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id})
277 # create new lines
278 if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation
279@@ -560,14 +550,11 @@
280 if isinstance(cor_ids, (int, long)):
281 cor_ids = [cor_ids]
282 cor_ids += res_reverse
283-
284- gl_journal_ids = self.pool.get('account.journal').search(cr, uid,
285- [('type', '=', 'correction'), ('is_current_instance', '=', True)],
286- order='id', limit=1)
287- if not gl_journal_ids:
288+ odhq_journal_id = journal_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
289+ if not odhq_journal_id:
290 self.write(cr, uid, [wiz.id], {'running': False})
291- raise osv.except_osv(_('Error'), _('No correction journal found!'))
292- gl_journal_obj = self.pool.get('account.journal').browse(cr, uid, gl_journal_ids[0], context=context)
293+ raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
294+ gl_journal_obj = journal_obj.browse(cr, uid, odhq_journal_id, fields_to_fetch=['sequence_id', 'code'], context=context)
295 journal_sequence_id = gl_journal_obj.sequence_id.id
296 journal_code = gl_journal_obj.code
297 seq_obj = self.pool.get('ir.sequence')
298
299=== modified file 'bin/addons/account_journal/account_journal.py'
300--- bin/addons/account_journal/account_journal.py 2017-08-03 19:14:48 +0000
301+++ bin/addons/account_journal/account_journal.py 2020-01-27 10:41:30 +0000
302@@ -60,7 +60,9 @@
303 ('bank', 'Bank'),
304 ('cash','Cash'),
305 ('cheque', 'Cheque'),
306- ('correction','Correction'),
307+ ('correction', 'Correction Auto'),
308+ ('correction_hq', 'Correction HQ'),
309+ ('correction_manual', 'Correction Manual'),
310 ('cur_adj', 'Currency Adjustment'),
311 ('depreciation', 'Depreciation'),
312 ('general', 'General'),
313@@ -111,6 +113,51 @@
314 'group_invoice_lines': False,
315 }
316
317+ def _check_correction_type(self, cr, uid, ids, context=None):
318+ """
319+ Check that only one "Correction" and one "Correction HQ" journals exist per instance
320+ """
321+ if context is None:
322+ context = {}
323+ for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
324+ if journal.type in ('correction', 'correction_hq') and journal.instance_id:
325+ journal_dom = [('type', '=', journal.type), ('instance_id', '=', journal.instance_id.id), ('id', '!=', journal.id)]
326+ if self.search_exist(cr, uid, journal_dom, context=context):
327+ return False
328+ return True
329+
330+ def _check_correction_analytic_journal(self, cr, uid, ids, context=None):
331+ """
332+ In case of Correction journal or Correction HQ journal, check that the analytic journal selected is the right one
333+ """
334+ if context is None:
335+ context = {}
336+ for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'analytic_journal_id', 'instance_id'], context=context):
337+ if journal.type in ('correction', 'correction_hq'):
338+ if not journal.analytic_journal_id:
339+ return False
340+ elif journal.type != journal.analytic_journal_id.type or journal.instance_id != journal.analytic_journal_id.instance_id:
341+ return False
342+ return True
343+
344+ def _check_hq_correction(self, cr, uid, ids, context=None):
345+ """
346+ Check that the prop. instance of the "Correction HQ" journal is a coordo
347+ """
348+ if context is None:
349+ context = {}
350+ for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
351+ if journal.type == 'correction_hq' and (not journal.instance_id or journal.instance_id.level != 'coordo'):
352+ return False
353+ return True
354+
355+ _constraints = [
356+ (_check_correction_type, 'A journal with this type already exists for this instance.', ['type', 'instance_id']),
357+ (_check_correction_analytic_journal, 'The analytic journal selected must have the same type and prop. instance as this journal.',
358+ ['type', 'analytic_journal_id', 'instance_id']),
359+ (_check_hq_correction, 'The prop. instance of the "Correction HQ" journal must be a coordination.', ['type', 'instance_id']),
360+ ]
361+
362 def get_current_period(self, cr, uid, context=None):
363 periods = self.pool.get('account.period').find(cr, uid, datetime.date.today())
364 if periods:
365@@ -397,5 +444,28 @@
366 'target': 'crush',
367 }
368
369+ def get_correction_journal(self, cr, uid, corr_type=False, context=None):
370+ """
371+ Returns the correction journal of the current instance (or False if not found):
372+ - by default => standard Correction journal
373+ - corr_type 'hq' => Correction HQ journal
374+ - corr_type 'extra' => OD-Extra Accounting journal
375+ - corr_type 'manual' => Correction Manual journal
376+ """
377+ if context is None:
378+ context = {}
379+ if corr_type == 'hq':
380+ journal_type = 'correction_hq'
381+ elif corr_type == 'extra':
382+ journal_type = 'extra'
383+ elif corr_type == 'manual':
384+ journal_type = 'correction_manual'
385+ else:
386+ journal_type = 'correction'
387+ journal_ids = self.search(cr, uid, [('type', '=', journal_type), ('is_current_instance', '=', True)],
388+ order='id', limit=1, context=context)
389+ return journal_ids and journal_ids[0] or False
390+
391+
392 account_journal()
393 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
394
395=== modified file 'bin/addons/account_journal/project/project.py'
396--- bin/addons/account_journal/project/project.py 2019-05-07 16:21:42 +0000
397+++ bin/addons/account_journal/project/project.py 2020-01-27 10:41:30 +0000
398@@ -37,7 +37,9 @@
399 """
400 return [
401 ('cash','Cash'),
402- ('correction', 'Correction'),
403+ ('correction', 'Correction Auto'),
404+ ('correction_hq', 'Correction HQ'),
405+ ('correction_manual', 'Correction Manual'),
406 ('cur_adj', 'Currency Adjustment'),
407 ('engagement', 'Engagement'),
408 ('general','General'),
409
410=== modified file 'bin/addons/account_override/account.py'
411--- bin/addons/account_override/account.py 2019-10-31 15:54:47 +0000
412+++ bin/addons/account_override/account.py 2020-01-27 10:41:30 +0000
413@@ -887,7 +887,9 @@
414 domain="[('state', '=', 'draft')]", hide_default_menu=True),
415 'journal_id': fields.many2one('account.journal', 'Journal',
416 required=True, states={'posted':[('readonly',True)]},
417- domain="[('type', 'not in', ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra']), ('instance_filter', '=', True)]",
418+ domain="[('type', 'not in', "
419+ " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq']),"
420+ "('instance_filter', '=', True)]",
421 hide_default_menu=True),
422 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"),
423 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \
424@@ -1192,6 +1194,8 @@
425 # UFTP-105: Do not permit to validate a journal entry on a period that is not open
426 if m.period_id and m.period_id.state != 'draft':
427 raise osv.except_osv(_('Warning'), _('You cannot post entries in a non-opened period: %s') % (m.period_id.name))
428+ if m.journal_id.type in ('correction', 'correction_hq'):
429+ raise osv.except_osv(_('Warning'), _('The journal %s is forbidden in manual entries.') % (m.journal_id.code))
430 prev_currency_id = False
431 for ml in m.line_id:
432 # Check that the currency and type of the (journal) third party is correct
433
434=== modified file 'bin/addons/analytic_distribution/analytic_line.py'
435--- bin/addons/analytic_distribution/analytic_line.py 2019-10-30 16:33:21 +0000
436+++ bin/addons/analytic_distribution/analytic_line.py 2020-01-27 10:41:30 +0000
437@@ -282,24 +282,23 @@
438 context.update({'from': 'mass_reallocation'}) # this permits reallocation to be accepted when rewrite analaytic lines
439 move_prefix = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id.move_prefix
440
441+ ir_seq_obj = self.pool.get('ir.sequence')
442+
443 aaj_obj = self.pool.get('account.analytic.journal')
444- correction_journal_ids = aaj_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],
445- order='id', limit=1)
446- correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False
447- if not correction_journal_id:
448+ od_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, context=context)
449+ if not od_analytic_journal_id:
450 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))
451
452 # sequence info from GL journal
453 aj_obj = self.pool.get('account.journal')
454- gl_correction_journal_ids = aj_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],
455- order='id', limit=1)
456- gl_correction_journal_id = gl_correction_journal_ids and gl_correction_journal_ids[0] or False
457+ gl_correction_journal_id = aj_obj.get_correction_journal(cr, uid, context=context)
458 if not gl_correction_journal_id:
459 raise osv.except_osv(_('Error'), _('No GL journal found for corrections!'))
460 gl_correction_journal_rec = aj_obj.browse(cr, uid, gl_correction_journal_id, context=context)
461
462 is_donation = {}
463 gl_correction_odx_journal_rec = False
464+ gl_correction_odhq_journal_rec = False
465 # Process lines
466 for aline in self.browse(cr, uid, ids, context=context):
467 curr_date = currency_date.get_date(self, cr, aline.document_date, aline.date, source_date=aline.source_date)
468@@ -336,28 +335,36 @@
469
470 if is_donation[aline.move_id.account_id.id]:
471 if not gl_correction_odx_journal_rec:
472- odx_aji = aj_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],
473- order='id', limit=1)
474- if not odx_aji:
475+ gl_correction_odx_journal_id = aj_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
476+ if not gl_correction_odx_journal_id:
477 raise osv.except_osv(_('Error'), _('No GL journal found for ODX'))
478- gl_correction_odx_journal_id = odx_aji[0]
479 gl_correction_odx_journal_rec = aj_obj.browse(cr, uid, gl_correction_odx_journal_id, context=context)
480-
481- correction_odx_journal_ids = aaj_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],
482- order='id', limit=1)
483- correction_odx_journal_id = correction_odx_journal_ids and correction_odx_journal_ids[0] or False
484- if not correction_odx_journal_id:
485+ odx_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='extra', context=context)
486+ if not odx_analytic_journal_id:
487 raise osv.except_osv(_('Error'), _('No analytic journal found for ODX!'))
488
489-
490- seqnum = self.pool.get('ir.sequence').get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx)
491+ seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx)
492 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odx_journal_rec.code, seqnum)
493- corr_j = correction_odx_journal_id
494+ corr_j = odx_analytic_journal_id
495+ # Correction: of an HQ entry, or of a correction of an HQ entry
496+ elif aline.journal_id.type in ('hq', 'correction_hq'):
497+ if not gl_correction_odhq_journal_rec:
498+ gl_correction_odhq_journal_id = aj_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
499+ if not gl_correction_odhq_journal_id:
500+ raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
501+ gl_correction_odhq_journal_rec = aj_obj.browse(cr, uid, gl_correction_odhq_journal_id,
502+ fields_to_fetch=['sequence_id', 'code'], context=context)
503+ odhq_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context)
504+ if not odhq_analytic_journal_id:
505+ raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!'))
506+ seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odhq_journal_rec.sequence_id.id, context=seq_num_ctx)
507+ entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odhq_journal_rec.code, seqnum)
508+ corr_j = odhq_analytic_journal_id
509 else:
510 # compute entry sequence
511- seqnum = self.pool.get('ir.sequence').get_id(cr, uid, gl_correction_journal_rec.sequence_id.id, context=seq_num_ctx)
512+ seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_journal_rec.sequence_id.id, context=seq_num_ctx)
513 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_journal_rec.code, seqnum)
514- corr_j = correction_journal_id
515+ corr_j = od_analytic_journal_id
516
517 # First reverse line
518 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date)
519
520=== modified file 'bin/addons/msf_doc_import/__init__.py'
521--- bin/addons/msf_doc_import/__init__.py 2019-05-03 13:44:52 +0000
522+++ bin/addons/msf_doc_import/__init__.py 2020-01-27 10:41:30 +0000
523@@ -28,10 +28,10 @@
524 The file should be in XML 2003 format.
525
526 The columns should be in this values: """)
527-# Authorized analytic journal in Accounting import
528+# Authorized journals in Accounting import
529 ACCOUNTING_IMPORT_JOURNALS = [
530 'intermission',
531- 'correction',
532+ 'correction_manual',
533 'hr',
534 'migration',
535 'sale', # US-70/3
536
537=== modified file 'bin/addons/msf_doc_import/account.py'
538--- bin/addons/msf_doc_import/account.py 2019-10-30 16:33:21 +0000
539+++ bin/addons/msf_doc_import/account.py 2020-01-27 10:41:30 +0000
540@@ -358,7 +358,7 @@
541 money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit
542 r_credit = book_credit
543
544- # Check which journal it is to be posted to: should be of type OD, MIG or INT
545+ # Check the journal code which must match with one of the journal types listed in ACCOUNTING_IMPORT_JOURNALS
546 if not line[cols['Journal Code']]:
547 errors.append(_('Line %s. No Journal Code specified') % (current_line_num,))
548 continue
549
550=== modified file 'bin/addons/msf_profile/data/patches.xml'
551--- bin/addons/msf_profile/data/patches.xml 2020-01-14 16:49:14 +0000
552+++ bin/addons/msf_profile/data/patches.xml 2020-01-27 10:41:30 +0000
553@@ -477,6 +477,7 @@
554 <field name="method">us_6768_trigger_FP_sync</field>
555 </record>
556
557+<<<<<<< TREE
558 <!-- UF15.1 -->
559 <record id="us_6930_gen_unreconcile" model="patch.scripts">
560 <field name="method">us_6930_gen_unreconcile</field>
561@@ -490,5 +491,12 @@
562 <field name="method">rec_entries_uf14_1_uf15</field>
563 </record>
564
565+=======
566+ <!-- UF16.0 -->
567+ <record id="us_6692_new_od_journals" model="patch.scripts">
568+ <field name="method">us_6692_new_od_journals</field>
569+ </record>
570+
571+>>>>>>> MERGE-SOURCE
572 </data>
573 </openerp>
574
575=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
576--- bin/addons/msf_profile/i18n/fr_MF.po 2019-11-21 16:33:04 +0000
577+++ bin/addons/msf_profile/i18n/fr_MF.po 2020-01-27 10:41:30 +0000
578@@ -42164,13 +42164,10 @@
579 msgid "Field Information"
580 msgstr "Information Champ "
581
582-#. modules: account_corrections, account_hq_entries
583+#. module: account_corrections
584 #: code:addons/account_corrections/account_move_line.py:499
585 #: code:addons/account_corrections/account_move_line.py:707
586 #: code:addons/account_corrections/account_move_line.py:855
587-#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:261
588-#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:340
589-#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:542
590 #, python-format
591 msgid "No correction journal found!"
592 msgstr "Le système n'a pas trouvé de Journal des corrections !"
593@@ -91142,7 +91139,13 @@
594 #: code:addons/analytic_distribution/analytic_line.py:288
595 #, python-format
596 msgid "No analytic journal found for corrections!"
597-msgstr "No analytic journal found for corrections!"
598+msgstr "Pas de journal analytique trouvé pour les corrections !"
599+
600+#. module: account_corrections
601+#: code:addons/account_corrections/wizard/analytic_distribution_wizard.py:198
602+#, python-format
603+msgid "No journal found for corrections!"
604+msgstr "Pas de journal trouvé pour les corrections !"
605
606 #. module: stock
607 #: selection:physical.inventory.select.products,second_filter:0
608@@ -100290,13 +100293,6 @@
609 msgstr "Aucun journal HQ trouvé!"
610
611 #. module: account_hq_entries
612-#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:343
613-#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:506
614-#, python-format
615-msgid "No analytic correction journal found!"
616-msgstr "Aucun Journal Analytique de correction n'a été trouvé!"
617-
618-#. module: account_hq_entries
619 #: code:addons/account_hq_entries/hq_entries.py:311
620 #, python-format
621 msgid "No line found!"
622@@ -106586,3 +106582,98 @@
623 msgid "Funding Pool not found."
624 msgstr "Funding Pool non trouvé."
625
626+#. modules: account_override, account, register_accounting, msf_instance, finance
627+#: selection:account.analytic.journal,type:0
628+#: selection:account.journal,type:0
629+#: selection:account.analytic.line,journal_type:0
630+#: selection:account.move,journal_type:0
631+#: selection:account.move.line,journal_type:0
632+#: selection:cash.request.liquidity,type:0
633+#: selection:cash.request.liquidity.bank,type:0
634+#: selection:cash.request.liquidity.cash,type:0
635+#: selection:cash.request.liquidity.cheque,type:0
636+#: selection:account.analytic.journal.fake,type:0
637+#: selection:account.journal.fake,type:0
638+#: selection:wizard.register.opening.confirmation,register_type:0
639+msgid "Correction Auto"
640+msgstr "Correction Auto"
641+
642+#. modules: account_override, account, register_accounting, msf_instance, finance
643+#: selection:account.analytic.journal,type:0
644+#: selection:account.journal,type:0
645+#: selection:account.analytic.line,journal_type:0
646+#: selection:account.move,journal_type:0
647+#: selection:account.move.line,journal_type:0
648+#: selection:cash.request.liquidity,type:0
649+#: selection:cash.request.liquidity.bank,type:0
650+#: selection:cash.request.liquidity.cash,type:0
651+#: selection:cash.request.liquidity.cheque,type:0
652+#: selection:account.analytic.journal.fake,type:0
653+#: selection:account.journal.fake,type:0
654+#: selection:wizard.register.opening.confirmation,register_type:0
655+msgid "Correction Manual"
656+msgstr "Correction Manuelle"
657+
658+#. modules: account_override, account, register_accounting, msf_instance, finance
659+#: selection:account.analytic.journal,type:0
660+#: selection:account.journal,type:0
661+#: selection:account.analytic.line,journal_type:0
662+#: selection:account.move,journal_type:0
663+#: selection:account.move.line,journal_type:0
664+#: selection:cash.request.liquidity,type:0
665+#: selection:cash.request.liquidity.bank,type:0
666+#: selection:cash.request.liquidity.cash,type:0
667+#: selection:cash.request.liquidity.cheque,type:0
668+#: selection:account.analytic.journal.fake,type:0
669+#: selection:account.journal.fake,type:0
670+#: selection:wizard.register.opening.confirmation,register_type:0
671+msgid "Correction HQ"
672+msgstr "Correction HQ"
673+
674+#. module: account_journal
675+#: constraint:account.journal:0
676+msgid "The analytic journal selected must have the same type and prop. instance as this journal."
677+msgstr "Le journal analytique sélectionné doit avoir le même type et la même instance prop. que ce journal."
678+
679+#. module: account_journal
680+#: constraint:account.journal:0
681+msgid "A journal with this type already exists for this instance."
682+msgstr "Un journal de ce type existe déjà pour cette instance."
683+
684+#. module: account
685+#: constraint:account.analytic.journal:0
686+msgid "An analytic journal with this type already exists for this instance."
687+msgstr "Un journal analytique de ce type existe déjà pour cette instance."
688+
689+#. module: account_journal
690+#: constraint:account.journal:0
691+msgid "The prop. instance of the \"Correction HQ\" journal must be a coordination."
692+msgstr "L'instance prop. du journal de type \"Correction HQ\" doit être une coordination."
693+
694+#. module: account
695+#: constraint:account.analytic.journal:0
696+msgid "The prop. instance of the \"Correction HQ\" analytic journal must be a coordination."
697+msgstr "L'instance prop. du journal analytique de type \"Correction HQ\" doit être une coordination."
698+
699+#. module: account_override
700+#: code:addons/account_override/account.py:1198
701+#, python-format
702+msgid "The journal %s is forbidden in manual entries."
703+msgstr "Le journal %s est interdit dans les écritures manuelles."
704+
705+#. modules: account_hq_entries, account_corrections, analytic_distribution
706+#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:269
707+#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:568
708+#: code:addons/account_corrections/account_move_line.py:731
709+#: code:addons/analytic_distribution/analytic_line.py:354
710+#, python-format
711+msgid "No \"correction HQ\" journal found!"
712+msgstr "Aucun journal de type \"correction HQ\" n'a été trouvé !"
713+
714+#. modules: account_hq_entries, analytic_distribution
715+#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:350
716+#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:531
717+#: code:addons/analytic_distribution/analytic_line.py:359
718+#, python-format
719+msgid "No \"correction HQ\" analytic journal found!"
720+msgstr "Aucun journal analytique de type \"correction HQ\" n'a été trouvé !"
721
722=== modified file 'bin/addons/msf_profile/msf_profile.py'
723--- bin/addons/msf_profile/msf_profile.py 2020-01-17 13:25:56 +0000
724+++ bin/addons/msf_profile/msf_profile.py 2020-01-27 10:41:30 +0000
725@@ -52,6 +52,7 @@
726 'model': lambda *a: 'patch.scripts',
727 }
728
729+<<<<<<< TREE
730 # UF15.2
731 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):
732 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
733@@ -130,6 +131,78 @@
734
735 return True
736
737+=======
738+ # UF16.0
739+ def us_6692_new_od_journals(self, cr, uid, *a, **b):
740+ """
741+ 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable
742+
743+ 2. Create:
744+ - ODM journals in all existing instances
745+ - ODHQ journals in existing coordo instances
746+
747+ Notes:
748+ - creations are done in Python as the objects created must sync normally
749+ - none of these journals already exists in prod. DB.
750+ """
751+ user_obj = self.pool.get('res.users')
752+ analytic_journal_obj = self.pool.get('account.analytic.journal')
753+ journal_obj = self.pool.get('account.journal')
754+ current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
755+ if current_instance: # existing instances only
756+ # existing correction journals
757+ cr.execute("""
758+ UPDATE account_analytic_journal
759+ SET type = 'correction_manual'
760+ WHERE type = 'correction'
761+ AND code != 'OD';
762+ """)
763+ self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,))
764+ cr.execute("""
765+ UPDATE account_journal
766+ SET type = 'correction_manual'
767+ WHERE type = 'correction'
768+ AND code != 'OD';
769+ """)
770+ self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,))
771+ # ODM analytic journal
772+ odm_analytic_vals = {
773+ # Prop. Instance: by default the current one is used
774+ 'code': 'ODM',
775+ 'name': 'Correction manual',
776+ 'type': 'correction_manual',
777+ }
778+ odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals)
779+ # ODM G/L journal
780+ odm_vals = {
781+ # Prop. Instance: by default the current one is used
782+ 'code': 'ODM',
783+ 'name': 'Correction manual',
784+ 'type': 'correction_manual',
785+ 'analytic_journal_id': odm_analytic_journal_id,
786+ }
787+ journal_obj.create(cr, uid, odm_vals)
788+ if current_instance.level == 'coordo':
789+ # ODHQ analytic journal
790+ odhq_analytic_vals = {
791+ # Prop. Instance: by default the current one is used
792+ 'code': 'ODHQ',
793+ 'name': 'Correction automatic HQ',
794+ 'type': 'correction_hq',
795+ }
796+ odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals)
797+ # ODHQ G/L journal
798+ odhq_vals = {
799+ # Prop. Instance: by default the current one is used
800+ 'code': 'ODHQ',
801+ 'name': 'Correction automatic HQ',
802+ 'type': 'correction_hq',
803+ 'analytic_journal_id': odhq_analytic_journal_id,
804+ }
805+ journal_obj.create(cr, uid, odhq_vals)
806+ return True
807+
808+>>>>>>> MERGE-SOURCE
809 # UF15.0
810 def us_6768_trigger_FP_sync(self, cr, uid, *a, **b):
811 """
812
813=== modified file 'bin/addons/msf_sync_data_coordo/__openerp__.py'
814--- bin/addons/msf_sync_data_coordo/__openerp__.py 2012-09-05 16:20:12 +0000
815+++ bin/addons/msf_sync_data_coordo/__openerp__.py 2020-01-27 10:41:30 +0000
816@@ -31,6 +31,8 @@
817 'init_xml': [],
818 'data': [
819 'data/res.partner.csv',
820+ 'data/account.analytic.journal.csv',
821+ 'data/account.journal.csv',
822 ],
823 'demo_xml': [],
824 'test':[],
825
826=== added file 'bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv'
827--- bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv 1970-01-01 00:00:00 +0000
828+++ bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv 2020-01-27 10:41:30 +0000
829@@ -0,0 +1,2 @@
830+active,code,name,type
831+TRUE,ODHQ,Correction automatic HQ,correction_hq
832
833=== added file 'bin/addons/msf_sync_data_coordo/data/account.journal.csv'
834--- bin/addons/msf_sync_data_coordo/data/account.journal.csv 1970-01-01 00:00:00 +0000
835+++ bin/addons/msf_sync_data_coordo/data/account.journal.csv 2020-01-27 10:41:30 +0000
836@@ -0,0 +1,2 @@
837+code,currency,default_credit_account_id,default_debit_account_id,name,type,analytic_journal_id
838+ODHQ,,,,Correction automatic HQ,correction_hq,Correction automatic HQ
839
840=== modified file 'bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv'
841--- bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv 2019-08-02 15:32:08 +0000
842+++ bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv 2020-01-27 10:41:30 +0000
843@@ -4,6 +4,7 @@
844 TRUE,SAL,Sales,sale
845 TRUE,SAR,Sales Refund,sale
846 TRUE,OD,Corrections,correction
847+TRUE,ODM,Correction manual,correction_manual
848 TRUE,HQ,Headquarters,hq
849 TRUE,HR,Human Resources,hr
850 TRUE,ENG,Engagement,engagement
851
852=== modified file 'bin/addons/msf_sync_data_post_synchro/data/account.journal.csv'
853--- bin/addons/msf_sync_data_post_synchro/data/account.journal.csv 2014-02-13 15:11:50 +0000
854+++ bin/addons/msf_sync_data_post_synchro/data/account.journal.csv 2020-01-27 10:41:30 +0000
855@@ -4,6 +4,7 @@
856 HR,,,,Human Resources,hr,Human Resources
857 FXA,,67040,67040,FX adjustment,cur_adj,FX adjustment
858 OD,,,,Corrections,correction,Corrections
859+ODM,,,,Correction manual,correction_manual,Correction manual
860 PUR,,,,Purchase,purchase,Purchase
861 PUF,,,,Purchase Refund,purchase_refund,Purchase Refund
862 SAL,,,,Sales,sale,Sales
863
864=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb.py'
865--- bin/addons/vertical_integration/report/hq_report_ocb.py 2019-09-25 12:57:25 +0000
866+++ bin/addons/vertical_integration/report/hq_report_ocb.py 2020-01-27 10:41:30 +0000
867@@ -549,7 +549,7 @@
868 # Pay attention to take analytic line that are not on HQ and MIGRATION journals.
869 'rawdata': """
870 SELECT al.id, i.code,
871- CASE WHEN j.code = 'OD' THEN j.code ELSE aj.code END AS journal,
872+ CASE WHEN j.code IN ('OD', 'ODHQ', 'ODX') THEN j.code ELSE aj.code END AS journal,
873 al.entry_sequence, al.name, al.ref, al.document_date, al.date,
874 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool,
875 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit,
876
877=== modified file 'bin/addons/vertical_integration/report/hq_report_ocp.py'
878--- bin/addons/vertical_integration/report/hq_report_ocp.py 2019-09-25 12:57:25 +0000
879+++ bin/addons/vertical_integration/report/hq_report_ocp.py 2020-01-27 10:41:30 +0000
880@@ -63,7 +63,7 @@
881 """
882 Takes data in parameter corresponding to ACCOUNT MOVE LINES (results from 'bs_entries' or 'plresult' requests)
883 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
884- 2) Modifies it for all OD entries that originate from HQ entry corrections:
885+ 2) Modifies it for all entries that originate from HQ entry corrections:
886 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
887 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
888 Returns a list of tuples (same format as data)
889@@ -80,7 +80,7 @@
890 line_list = list(line)
891 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])
892 od_hq_entry = False
893- if line_list[journal] == 'OD':
894+ if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692
895 aml = aml_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['corrected_line_id', 'reversal_line_id'])
896 corrected_aml = aml.corrected_line_id
897 reversed_aml = aml.reversal_line_id
898@@ -107,7 +107,7 @@
899 """
900 Takes data in parameter corresponding to ACCOUNT ANALYTIC LINES (results from 'rawdata' request)
901 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
902- 2) Modifies it for all OD entries that originate from HQ entry corrections:
903+ 2) Modifies it for all entries that originate from HQ entry corrections:
904 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
905 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
906 Returns a list of tuples (same format as data)
907@@ -124,7 +124,7 @@
908 line_list = list(line)
909 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])
910 od_hq_entry = False
911- if line_list[journal] == 'OD':
912+ if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692
913 aal = aal_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['last_corrected_id', 'reversal_origin'])
914 corrected_aal = aal.last_corrected_id
915 reversed_aal = aal.reversal_origin
916@@ -151,7 +151,7 @@
917 """
918 ##### WARNING #####
919 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###
920- - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections
921+ - first modify the data for all lines corresponding to entries originating from HQ entry corrections
922 - then call OCB method on the new data to change first column for the DB ID
923 """
924 new_data = self._handle_od_ji_entries(cr, uid, data) # we handle account move lines
925@@ -162,7 +162,7 @@
926 """
927 ##### WARNING #####
928 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###
929- - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections
930+ - first modify the data for all lines corresponding to entries originating from HQ entry corrections
931 - then call OCB method on the new data to change first column for the DB ID
932 """
933 new_data = self._handle_od_aji_entries(cr, uid, data) # we handle account analytic lines
934@@ -341,7 +341,7 @@
935 # Pay attention to take analytic lines that are not on HQ, MIGRATION, IN-KIND and ODX journals.
936 'rawdata': """
937 SELECT al.id, SUBSTR(i.code, 1, 3),
938- CASE WHEN j.code = 'OD' THEN j.code ELSE aj.code END AS journal,
939+ CASE WHEN j.code IN ('OD', 'ODHQ') THEN j.code ELSE aj.code END AS journal,
940 al.entry_sequence, al.name, al.ref, al.document_date, al.date,
941 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool,
942 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit,
943@@ -350,7 +350,7 @@
944 CASE WHEN al.amount < 0 THEN ABS(ROUND(al.amount, 2)) ELSE 0.0 END AS debit,
945 CASE WHEN al.amount > 0 THEN ROUND(al.amount, 2) ELSE 0.0 END AS credit,
946 cc.name AS "functional_currency", hr.identification_id as "emplid", aml.partner_id, hr.name_resource as hr_name,
947- CASE WHEN j.code = 'OD' THEN j.type ELSE aj.type END AS journal_type
948+ CASE WHEN j.code IN ('OD', 'ODHQ') THEN j.type ELSE aj.type END AS journal_type
949 FROM account_analytic_line AS al,
950 account_account AS a,
951 account_analytic_account AS aa,

Subscribers

People subscribed via source and target branches