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
=== modified file 'bin/addons/account/project/project.py'
--- bin/addons/account/project/project.py 2011-01-14 00:11:01 +0000
+++ bin/addons/account/project/project.py 2020-01-27 10:41:30 +0000
@@ -39,8 +39,63 @@
39 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,39 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
40 }40 }
4141
42 def _check_corr_type(self, cr, uid, ids, context=None):
43 """
44 Check that only one "Correction" and one "Correction HQ" analytic journals exist per instance
45 """
46 if context is None:
47 context = {}
48 for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
49 if analytic_journal.type in ('correction', 'correction_hq'):
50 analytic_journal_dom = [('type', '=', analytic_journal.type),
51 ('instance_id', '=', analytic_journal.instance_id.id),
52 ('id', '!=', analytic_journal.id)]
53 if self.search_exist(cr, uid, analytic_journal_dom, context=context):
54 return False
55 return True
56
57 def _check_hq_corr(self, cr, uid, ids, context=None):
58 """
59 Check that the prop. instance of the "Correction HQ" analytic journal is a coordo
60 """
61 if context is None:
62 context = {}
63 for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
64 if analytic_journal.type == 'correction_hq' and analytic_journal.instance_id.level != 'coordo':
65 return False
66 return True
67
68 _constraints = [
69 (_check_corr_type, 'An analytic journal with this type already exists for this instance.', ['type', 'instance_id']),
70 (_check_hq_corr, 'The prop. instance of the "Correction HQ" analytic journal must be a coordination.', ['type', 'instance_id']),
71 ]
72
73 def get_correction_analytic_journal(self, cr, uid, corr_type=False, context=None):
74 """
75 Returns the correction analytic journal of the current instance (or False if not found):
76 - by default => standard Correction journal
77 - corr_type 'hq' => Correction HQ journal
78 - corr_type 'extra' => OD-Extra Accounting journal
79 - corr_type 'manual' => Correction Manual journal
80 """
81 if context is None:
82 context = {}
83 if corr_type == 'hq':
84 analytic_journal_type = 'correction_hq'
85 elif corr_type == 'extra':
86 analytic_journal_type = 'extra'
87 elif corr_type == 'manual':
88 analytic_journal_type = 'correction_manual'
89 else:
90 analytic_journal_type = 'correction'
91 analytic_journal_ids = self.search(cr, uid, [('type', '=', analytic_journal_type), ('is_current_instance', '=', True)],
92 order='id', limit=1, context=context)
93 return analytic_journal_ids and analytic_journal_ids[0] or False
94
95
42account_analytic_journal()96account_analytic_journal()
4397
98
44class account_journal(osv.osv):99class account_journal(osv.osv):
45 _inherit="account.journal"100 _inherit="account.journal"
46101
47102
=== modified file 'bin/addons/account_corrections/account_move_line.py'
--- bin/addons/account_corrections/account_move_line.py 2019-10-30 16:33:21 +0000
+++ bin/addons/account_corrections/account_move_line.py 2020-01-27 10:41:30 +0000
@@ -448,19 +448,11 @@
448 ana_j_obj = self.pool.get('account.analytic.journal')448 ana_j_obj = self.pool.get('account.analytic.journal')
449 aal_obj = self.pool.get('account.analytic.line')449 aal_obj = self.pool.get('account.analytic.line')
450 # Search correction journal450 # Search correction journal
451 j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'),451 j_corr_id = j_obj.get_correction_journal(cr, uid, context=context)
452 ('is_current_instance', '=', True)], order='id', limit=1, context=context)452 j_ana_corr_id = ana_j_obj.get_correction_analytic_journal(cr, uid, context=context)
453 j_corr_id = j_corr_ids and j_corr_ids[0] or False
454 j_ana_corr_ids = ana_j_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],
455 order='id', limit=1, context=context)
456 j_ana_corr_id = j_ana_corr_ids and j_ana_corr_ids[0] or False
457 # Search extra-accounting journal453 # Search extra-accounting journal
458 j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'),454 j_extra_id = j_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
459 ('is_current_instance', '=', True)], order='id', limit=1)455 j_ana_extra_id = ana_j_obj.get_correction_analytic_journal(cr, uid, corr_type='extra', context=context)
460 j_extra_id = j_extra_ids and j_extra_ids[0] or False
461 j_ana_extra_ids = ana_j_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],
462 order='id', limit=1, context=context)
463 j_ana_extra_id = j_ana_extra_ids and j_ana_extra_ids[0] or False
464456
465 # Search attached period457 # Search attached period
466 period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)], context=context,458 period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)], context=context,
@@ -662,14 +654,13 @@
662 new_account_id, context=context)654 new_account_id, context=context)
663655
664 # Search correction journal656 # Search correction journal
665 j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'),657 j_corr_id = j_obj.get_correction_journal(cr, uid, context=context)
666 ('is_current_instance', '=', True)], order='id', limit=1, context=context)
667 j_corr_id = j_corr_ids and j_corr_ids[0] or False
668658
669 # Search extra-accounting journal659 # Search extra-accounting journal
670 j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'),660 j_extra_id = j_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
671 ('is_current_instance', '=', True)], order='id', limit=1)661
672 j_extra_id = j_extra_ids and j_extra_ids[0] or False662 # Search for the "Correction HQ" journal
663 hq_corr_journal_id = j_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
673664
674 # Search attached period665 # Search attached period
675 period_obj = self.pool.get('account.period')666 period_obj = self.pool.get('account.period')
@@ -718,6 +709,13 @@
718 raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!'))709 raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!'))
719 if new_account.type_for_register != 'donation':710 if new_account.type_for_register != 'donation':
720 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!'))711 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!'))
712
713 # Correction: of an HQ entry, or of a correction of an HQ entry
714 if ml.journal_id.type in ('hq', 'correction_hq'):
715 journal_id = hq_corr_journal_id
716 if not journal_id:
717 raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
718
721 if not journal_id:719 if not journal_id:
722 raise osv.except_osv(_('Error'), _('No correction journal found!'))720 raise osv.except_osv(_('Error'), _('No correction journal found!'))
723721
724722
=== modified file 'bin/addons/account_corrections/wizard/analytic_distribution_wizard.py'
--- bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2019-10-31 14:53:19 +0000
+++ bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2020-01-27 10:41:30 +0000
@@ -150,6 +150,8 @@
150 wizard = self.browse(cr, uid, wizard_id)150 wizard = self.browse(cr, uid, wizard_id)
151 ad_obj = self.pool.get('analytic.distribution')151 ad_obj = self.pool.get('analytic.distribution')
152 ana_line_obj = self.pool.get('account.analytic.line')152 ana_line_obj = self.pool.get('account.analytic.line')
153 journal_obj = self.pool.get('account.journal')
154 analytic_journal_obj = self.pool.get('account.analytic.journal')
153 company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id155 company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
154 ml = wizard.move_line_id156 ml = wizard.move_line_id
155 # US-5848: orig_date left unchanged not to break historical behavior,157 # US-5848: orig_date left unchanged not to break historical behavior,
@@ -176,12 +178,12 @@
176 entry_seq_data['sequence'] = biggest_reversal_aji.entry_sequence178 entry_seq_data['sequence'] = biggest_reversal_aji.entry_sequence
177179
178 jtype = 'correction'180 jtype = 'correction'
179 if wizard.move_line_id.account_id and wizard.move_line_id.account_id.type_for_register == 'donation':181 if ml.account_id.type_for_register == 'donation':
180 jtype = 'extra'182 jtype = 'extra'
181 correction_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid,183 # Correction: of an HQ entry, or of a correction of an HQ entry
182 [('type', '=', jtype), ('is_current_instance', '=', True)],184 elif ml.journal_id.type in ('hq', 'correction_hq'):
183 order='id', limit=1)185 jtype = 'hq'
184 correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False186 correction_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type=jtype, context=context)
185 if not correction_journal_id:187 if not correction_journal_id:
186 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))188 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))
187 to_create = []189 to_create = []
@@ -191,19 +193,11 @@
191 old_line_ok = []193 old_line_ok = []
192 any_reverse = False194 any_reverse = False
193 # Prepare journal and period information for entry sequences195 # Prepare journal and period information for entry sequences
194 journal_sql = """196 journal_id = journal_obj.get_correction_journal(cr, uid, corr_type=jtype, context=context)
195 SELECT id, code197 if not journal_id:
196 FROM account_journal198 raise osv.except_osv(_('Error'), _('No journal found for corrections!'))
197 WHERE type = %s 199 journal = journal_obj.browse(cr, uid, journal_id, context=context)
198 AND is_current_instance = true200 code = journal.code
199 ORDER BY id
200 LIMIT 1;
201 """
202 cr.execute(journal_sql, (jtype,))
203 journal_sql_res = cr.fetchone()
204 journal_id = journal_sql_res[0]
205 code = journal_sql_res[1]
206 journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
207 period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date=posting_date, context=context)201 period_ids = self.pool.get('account.period').get_period_from_date(cr, uid, date=posting_date, context=context)
208 if not period_ids:202 if not period_ids:
209 raise osv.except_osv(_('Warning'), _('No period found for creating sequence on the given date: %s') % (posting_date or ''))203 raise osv.except_osv(_('Warning'), _('No period found for creating sequence on the given date: %s') % (posting_date or ''))
@@ -248,8 +242,7 @@
248 # US-1343/2: flag that the chain origin is an HQ242 # US-1343/2: flag that the chain origin is an HQ
249 # entry: in other terms OD AJI from a HQ JI243 # entry: in other terms OD AJI from a HQ JI
250 is_HQ_origin = {244 is_HQ_origin = {
251 'from_od': \245 'from_od': original_al.journal_id.type in ('correction', 'correction_hq'),
252 original_al.journal_id.type == 'correction',
253 }246 }
254 break247 break
255248
256249
=== modified file 'bin/addons/account_hq_entries/wizard/hq_entries_validation.py'
--- bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2019-10-30 16:33:21 +0000
+++ bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2020-01-27 10:41:30 +0000
@@ -262,12 +262,9 @@
262 original_lines = set()262 original_lines = set()
263 original_move_ids = []263 original_move_ids = []
264 ana_line_obj = self.pool.get('account.analytic.line')264 ana_line_obj = self.pool.get('account.analytic.line')
265 od_journal_ids = self.pool.get('account.journal').search(cr, uid,265 odhq_journal_id = self.pool.get('account.journal').get_correction_journal(cr, uid, corr_type='hq', context=context)
266 [('type', '=', 'correction'), ('is_current_instance', '=', True)],266 if not odhq_journal_id:
267 order='id', limit=1)267 raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
268 if not od_journal_ids:
269 raise osv.except_osv(_('Error'), _('No correction journal found!'))
270 od_journal_id = od_journal_ids[0]
271 all_lines = set()268 all_lines = set()
272 pure_ad_cor_ji_ids = []269 pure_ad_cor_ji_ids = []
273 original_aji_ids = []270 original_aji_ids = []
@@ -302,7 +299,7 @@
302 curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)299 curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
303 new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id,300 new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id,
304 line.currency_id.id, date=line.date, doc_date=line.document_date, source_date=curr_date,301 line.currency_id.id, date=line.date, doc_date=line.document_date, source_date=curr_date,
305 journal=od_journal_id, orig_acct=original_account_id, split=True, context=context)302 journal=odhq_journal_id, orig_acct=original_account_id, split=True, context=context)
306 # original move line303 # original move line
307 original_ml_result = res_move[line.id]304 original_ml_result = res_move[line.id]
308 # Mark new journal items as corrections for the first one305 # Mark new journal items as corrections for the first one
@@ -343,14 +340,10 @@
343 initial_ana_ids = ana_line_obj.search(cr, uid, [('move_id.move_id', '=', move_id)]) # original move_id340 initial_ana_ids = ana_line_obj.search(cr, uid, [('move_id.move_id', '=', move_id)]) # original move_id
344 original_aji_ids += initial_ana_ids341 original_aji_ids += initial_ana_ids
345 res_reverse = ana_line_obj.reverse(cr, uid, initial_ana_ids, posting_date=line.date, context=context)342 res_reverse = ana_line_obj.reverse(cr, uid, initial_ana_ids, posting_date=line.date, context=context)
346 acor_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid,343 acor_journal_id = self.pool.get('account.analytic.journal').get_correction_analytic_journal(cr, uid,
347 [('type', '=', 'correction'), ('is_current_instance', '=', True)],344 corr_type='hq', context=context)
348 order='id', limit=1)
349 if not acor_journal_ids:
350 raise osv.except_osv(_('Error'), _('No correction journal found!'))
351 acor_journal_id = acor_journal_ids[0]
352 if not acor_journal_id:345 if not acor_journal_id:
353 raise osv.except_osv(_('Warning'), _('No analytic correction journal found!'))346 raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!'))
354 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 one347 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
355348
356 # Mark new analytic items as correction for original line349 # Mark new analytic items as correction for original line
@@ -368,7 +361,7 @@
368 for aal in browse_aals:361 for aal in browse_aals:
369 cor_name = 'COR1 - ' + aal.name362 cor_name = 'COR1 - ' + aal.name
370 ana_line_obj.write(cr, uid, aal.id, {'last_corrected_id': original_aal_ids[0],'name': cor_name, 'ref': cor_ref})363 ana_line_obj.write(cr, uid, aal.id, {'last_corrected_id': original_aal_ids[0],'name': cor_name, 'ref': cor_ref})
371 # also write the OD entry_sequence to the REV aal364 # also write the ODHQ entry_sequence to the REV aal
372 # ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id, 'entry_sequence': aal.entry_sequence})365 # ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id, 'entry_sequence': aal.entry_sequence})
373 cr.execute('''UPDATE account_analytic_line SET entry_sequence=%s WHERE id=%s''', (aal.entry_sequence, res_reverse[0]))366 cr.execute('''UPDATE account_analytic_line SET entry_sequence=%s WHERE id=%s''', (aal.entry_sequence, res_reverse[0]))
374367
@@ -408,13 +401,10 @@
408 ana_line_obj = self.pool.get('account.analytic.line')401 ana_line_obj = self.pool.get('account.analytic.line')
409 distrib_fp_line_obj = self.pool.get('funding.pool.distribution.line')402 distrib_fp_line_obj = self.pool.get('funding.pool.distribution.line')
410 distrib_cc_line_obj = self.pool.get('cost.center.distribution.line')403 distrib_cc_line_obj = self.pool.get('cost.center.distribution.line')
411 # Search an analytic correction journal404 journal_obj = self.pool.get('account.journal')
412 acor_journal_id = False405 analytic_journal_obj = self.pool.get('account.analytic.journal')
413 acor_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type', '=', 'correction'),406 # Search for the "Correction HQ" analytic journal
414 ('is_current_instance', '=', True)],407 acor_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context)
415 order='id', limit=1)
416 if acor_journal_ids:
417 acor_journal_id = acor_journal_ids[0]
418 # Tag active_ids as user validated408 # Tag active_ids as user validated
419 account_change = []409 account_change = []
420 cc_change = []410 cc_change = []
@@ -529,7 +519,7 @@
529 # Give them analytic correction journal (UF-1385 in comments)519 # Give them analytic correction journal (UF-1385 in comments)
530 if not acor_journal_id:520 if not acor_journal_id:
531 self.write(cr, uid, [wiz.id], {'running': False})521 self.write(cr, uid, [wiz.id], {'running': False})
532 raise osv.except_osv(_('Warning'), _('No analytic correction journal found!'))522 raise osv.except_osv(_('Warning'), _('No "correction HQ" analytic journal found!'))
533 ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id})523 ana_line_obj.write(cr, uid, res_reverse, {'journal_id': acor_journal_id})
534 # create new lines524 # create new lines
535 if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation525 if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation
@@ -560,14 +550,11 @@
560 if isinstance(cor_ids, (int, long)):550 if isinstance(cor_ids, (int, long)):
561 cor_ids = [cor_ids]551 cor_ids = [cor_ids]
562 cor_ids += res_reverse552 cor_ids += res_reverse
563553 odhq_journal_id = journal_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
564 gl_journal_ids = self.pool.get('account.journal').search(cr, uid,554 if not odhq_journal_id:
565 [('type', '=', 'correction'), ('is_current_instance', '=', True)],
566 order='id', limit=1)
567 if not gl_journal_ids:
568 self.write(cr, uid, [wiz.id], {'running': False})555 self.write(cr, uid, [wiz.id], {'running': False})
569 raise osv.except_osv(_('Error'), _('No correction journal found!'))556 raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
570 gl_journal_obj = self.pool.get('account.journal').browse(cr, uid, gl_journal_ids[0], context=context)557 gl_journal_obj = journal_obj.browse(cr, uid, odhq_journal_id, fields_to_fetch=['sequence_id', 'code'], context=context)
571 journal_sequence_id = gl_journal_obj.sequence_id.id558 journal_sequence_id = gl_journal_obj.sequence_id.id
572 journal_code = gl_journal_obj.code559 journal_code = gl_journal_obj.code
573 seq_obj = self.pool.get('ir.sequence')560 seq_obj = self.pool.get('ir.sequence')
574561
=== modified file 'bin/addons/account_journal/account_journal.py'
--- bin/addons/account_journal/account_journal.py 2017-08-03 19:14:48 +0000
+++ bin/addons/account_journal/account_journal.py 2020-01-27 10:41:30 +0000
@@ -60,7 +60,9 @@
60 ('bank', 'Bank'),60 ('bank', 'Bank'),
61 ('cash','Cash'),61 ('cash','Cash'),
62 ('cheque', 'Cheque'),62 ('cheque', 'Cheque'),
63 ('correction','Correction'),63 ('correction', 'Correction Auto'),
64 ('correction_hq', 'Correction HQ'),
65 ('correction_manual', 'Correction Manual'),
64 ('cur_adj', 'Currency Adjustment'),66 ('cur_adj', 'Currency Adjustment'),
65 ('depreciation', 'Depreciation'),67 ('depreciation', 'Depreciation'),
66 ('general', 'General'),68 ('general', 'General'),
@@ -111,6 +113,51 @@
111 'group_invoice_lines': False,113 'group_invoice_lines': False,
112 }114 }
113115
116 def _check_correction_type(self, cr, uid, ids, context=None):
117 """
118 Check that only one "Correction" and one "Correction HQ" journals exist per instance
119 """
120 if context is None:
121 context = {}
122 for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
123 if journal.type in ('correction', 'correction_hq') and journal.instance_id:
124 journal_dom = [('type', '=', journal.type), ('instance_id', '=', journal.instance_id.id), ('id', '!=', journal.id)]
125 if self.search_exist(cr, uid, journal_dom, context=context):
126 return False
127 return True
128
129 def _check_correction_analytic_journal(self, cr, uid, ids, context=None):
130 """
131 In case of Correction journal or Correction HQ journal, check that the analytic journal selected is the right one
132 """
133 if context is None:
134 context = {}
135 for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'analytic_journal_id', 'instance_id'], context=context):
136 if journal.type in ('correction', 'correction_hq'):
137 if not journal.analytic_journal_id:
138 return False
139 elif journal.type != journal.analytic_journal_id.type or journal.instance_id != journal.analytic_journal_id.instance_id:
140 return False
141 return True
142
143 def _check_hq_correction(self, cr, uid, ids, context=None):
144 """
145 Check that the prop. instance of the "Correction HQ" journal is a coordo
146 """
147 if context is None:
148 context = {}
149 for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context):
150 if journal.type == 'correction_hq' and (not journal.instance_id or journal.instance_id.level != 'coordo'):
151 return False
152 return True
153
154 _constraints = [
155 (_check_correction_type, 'A journal with this type already exists for this instance.', ['type', 'instance_id']),
156 (_check_correction_analytic_journal, 'The analytic journal selected must have the same type and prop. instance as this journal.',
157 ['type', 'analytic_journal_id', 'instance_id']),
158 (_check_hq_correction, 'The prop. instance of the "Correction HQ" journal must be a coordination.', ['type', 'instance_id']),
159 ]
160
114 def get_current_period(self, cr, uid, context=None):161 def get_current_period(self, cr, uid, context=None):
115 periods = self.pool.get('account.period').find(cr, uid, datetime.date.today())162 periods = self.pool.get('account.period').find(cr, uid, datetime.date.today())
116 if periods:163 if periods:
@@ -397,5 +444,28 @@
397 'target': 'crush',444 'target': 'crush',
398 }445 }
399446
447 def get_correction_journal(self, cr, uid, corr_type=False, context=None):
448 """
449 Returns the correction journal of the current instance (or False if not found):
450 - by default => standard Correction journal
451 - corr_type 'hq' => Correction HQ journal
452 - corr_type 'extra' => OD-Extra Accounting journal
453 - corr_type 'manual' => Correction Manual journal
454 """
455 if context is None:
456 context = {}
457 if corr_type == 'hq':
458 journal_type = 'correction_hq'
459 elif corr_type == 'extra':
460 journal_type = 'extra'
461 elif corr_type == 'manual':
462 journal_type = 'correction_manual'
463 else:
464 journal_type = 'correction'
465 journal_ids = self.search(cr, uid, [('type', '=', journal_type), ('is_current_instance', '=', True)],
466 order='id', limit=1, context=context)
467 return journal_ids and journal_ids[0] or False
468
469
400account_journal()470account_journal()
401# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:471# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
402472
=== modified file 'bin/addons/account_journal/project/project.py'
--- bin/addons/account_journal/project/project.py 2019-05-07 16:21:42 +0000
+++ bin/addons/account_journal/project/project.py 2020-01-27 10:41:30 +0000
@@ -37,7 +37,9 @@
37 """37 """
38 return [38 return [
39 ('cash','Cash'),39 ('cash','Cash'),
40 ('correction', 'Correction'),40 ('correction', 'Correction Auto'),
41 ('correction_hq', 'Correction HQ'),
42 ('correction_manual', 'Correction Manual'),
41 ('cur_adj', 'Currency Adjustment'),43 ('cur_adj', 'Currency Adjustment'),
42 ('engagement', 'Engagement'),44 ('engagement', 'Engagement'),
43 ('general','General'),45 ('general','General'),
4446
=== modified file 'bin/addons/account_override/account.py'
--- bin/addons/account_override/account.py 2019-10-31 15:54:47 +0000
+++ bin/addons/account_override/account.py 2020-01-27 10:41:30 +0000
@@ -887,7 +887,9 @@
887 domain="[('state', '=', 'draft')]", hide_default_menu=True),887 domain="[('state', '=', 'draft')]", hide_default_menu=True),
888 'journal_id': fields.many2one('account.journal', 'Journal',888 'journal_id': fields.many2one('account.journal', 'Journal',
889 required=True, states={'posted':[('readonly',True)]},889 required=True, states={'posted':[('readonly',True)]},
890 domain="[('type', 'not in', ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra']), ('instance_filter', '=', True)]",890 domain="[('type', 'not in', "
891 " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq']),"
892 "('instance_filter', '=', True)]",
891 hide_default_menu=True),893 hide_default_menu=True),
892 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"),894 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"),
893 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \895 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \
@@ -1192,6 +1194,8 @@
1192 # UFTP-105: Do not permit to validate a journal entry on a period that is not open1194 # UFTP-105: Do not permit to validate a journal entry on a period that is not open
1193 if m.period_id and m.period_id.state != 'draft':1195 if m.period_id and m.period_id.state != 'draft':
1194 raise osv.except_osv(_('Warning'), _('You cannot post entries in a non-opened period: %s') % (m.period_id.name))1196 raise osv.except_osv(_('Warning'), _('You cannot post entries in a non-opened period: %s') % (m.period_id.name))
1197 if m.journal_id.type in ('correction', 'correction_hq'):
1198 raise osv.except_osv(_('Warning'), _('The journal %s is forbidden in manual entries.') % (m.journal_id.code))
1195 prev_currency_id = False1199 prev_currency_id = False
1196 for ml in m.line_id:1200 for ml in m.line_id:
1197 # Check that the currency and type of the (journal) third party is correct1201 # Check that the currency and type of the (journal) third party is correct
11981202
=== modified file 'bin/addons/analytic_distribution/analytic_line.py'
--- bin/addons/analytic_distribution/analytic_line.py 2019-10-30 16:33:21 +0000
+++ bin/addons/analytic_distribution/analytic_line.py 2020-01-27 10:41:30 +0000
@@ -282,24 +282,23 @@
282 context.update({'from': 'mass_reallocation'}) # this permits reallocation to be accepted when rewrite analaytic lines282 context.update({'from': 'mass_reallocation'}) # this permits reallocation to be accepted when rewrite analaytic lines
283 move_prefix = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id.move_prefix283 move_prefix = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id.move_prefix
284284
285 ir_seq_obj = self.pool.get('ir.sequence')
286
285 aaj_obj = self.pool.get('account.analytic.journal')287 aaj_obj = self.pool.get('account.analytic.journal')
286 correction_journal_ids = aaj_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],288 od_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, context=context)
287 order='id', limit=1)289 if not od_analytic_journal_id:
288 correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False
289 if not correction_journal_id:
290 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))290 raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!'))
291291
292 # sequence info from GL journal292 # sequence info from GL journal
293 aj_obj = self.pool.get('account.journal')293 aj_obj = self.pool.get('account.journal')
294 gl_correction_journal_ids = aj_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)],294 gl_correction_journal_id = aj_obj.get_correction_journal(cr, uid, context=context)
295 order='id', limit=1)
296 gl_correction_journal_id = gl_correction_journal_ids and gl_correction_journal_ids[0] or False
297 if not gl_correction_journal_id:295 if not gl_correction_journal_id:
298 raise osv.except_osv(_('Error'), _('No GL journal found for corrections!'))296 raise osv.except_osv(_('Error'), _('No GL journal found for corrections!'))
299 gl_correction_journal_rec = aj_obj.browse(cr, uid, gl_correction_journal_id, context=context)297 gl_correction_journal_rec = aj_obj.browse(cr, uid, gl_correction_journal_id, context=context)
300298
301 is_donation = {}299 is_donation = {}
302 gl_correction_odx_journal_rec = False300 gl_correction_odx_journal_rec = False
301 gl_correction_odhq_journal_rec = False
303 # Process lines302 # Process lines
304 for aline in self.browse(cr, uid, ids, context=context):303 for aline in self.browse(cr, uid, ids, context=context):
305 curr_date = currency_date.get_date(self, cr, aline.document_date, aline.date, source_date=aline.source_date)304 curr_date = currency_date.get_date(self, cr, aline.document_date, aline.date, source_date=aline.source_date)
@@ -336,28 +335,36 @@
336335
337 if is_donation[aline.move_id.account_id.id]:336 if is_donation[aline.move_id.account_id.id]:
338 if not gl_correction_odx_journal_rec:337 if not gl_correction_odx_journal_rec:
339 odx_aji = aj_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],338 gl_correction_odx_journal_id = aj_obj.get_correction_journal(cr, uid, corr_type='extra', context=context)
340 order='id', limit=1)339 if not gl_correction_odx_journal_id:
341 if not odx_aji:
342 raise osv.except_osv(_('Error'), _('No GL journal found for ODX'))340 raise osv.except_osv(_('Error'), _('No GL journal found for ODX'))
343 gl_correction_odx_journal_id = odx_aji[0]
344 gl_correction_odx_journal_rec = aj_obj.browse(cr, uid, gl_correction_odx_journal_id, context=context)341 gl_correction_odx_journal_rec = aj_obj.browse(cr, uid, gl_correction_odx_journal_id, context=context)
345342 odx_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='extra', context=context)
346 correction_odx_journal_ids = aaj_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)],343 if not odx_analytic_journal_id:
347 order='id', limit=1)
348 correction_odx_journal_id = correction_odx_journal_ids and correction_odx_journal_ids[0] or False
349 if not correction_odx_journal_id:
350 raise osv.except_osv(_('Error'), _('No analytic journal found for ODX!'))344 raise osv.except_osv(_('Error'), _('No analytic journal found for ODX!'))
351345
352346 seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx)
353 seqnum = self.pool.get('ir.sequence').get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx)
354 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odx_journal_rec.code, seqnum)347 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odx_journal_rec.code, seqnum)
355 corr_j = correction_odx_journal_id348 corr_j = odx_analytic_journal_id
349 # Correction: of an HQ entry, or of a correction of an HQ entry
350 elif aline.journal_id.type in ('hq', 'correction_hq'):
351 if not gl_correction_odhq_journal_rec:
352 gl_correction_odhq_journal_id = aj_obj.get_correction_journal(cr, uid, corr_type='hq', context=context)
353 if not gl_correction_odhq_journal_id:
354 raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!'))
355 gl_correction_odhq_journal_rec = aj_obj.browse(cr, uid, gl_correction_odhq_journal_id,
356 fields_to_fetch=['sequence_id', 'code'], context=context)
357 odhq_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context)
358 if not odhq_analytic_journal_id:
359 raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!'))
360 seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odhq_journal_rec.sequence_id.id, context=seq_num_ctx)
361 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odhq_journal_rec.code, seqnum)
362 corr_j = odhq_analytic_journal_id
356 else:363 else:
357 # compute entry sequence364 # compute entry sequence
358 seqnum = self.pool.get('ir.sequence').get_id(cr, uid, gl_correction_journal_rec.sequence_id.id, context=seq_num_ctx)365 seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_journal_rec.sequence_id.id, context=seq_num_ctx)
359 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_journal_rec.code, seqnum)366 entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_journal_rec.code, seqnum)
360 corr_j = correction_journal_id367 corr_j = od_analytic_journal_id
361368
362 # First reverse line369 # First reverse line
363 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date)370 rev_ids = self.pool.get('account.analytic.line').reverse(cr, uid, [aline.id], posting_date=date)
364371
=== modified file 'bin/addons/msf_doc_import/__init__.py'
--- bin/addons/msf_doc_import/__init__.py 2019-05-03 13:44:52 +0000
+++ bin/addons/msf_doc_import/__init__.py 2020-01-27 10:41:30 +0000
@@ -28,10 +28,10 @@
28 The file should be in XML 2003 format.28 The file should be in XML 2003 format.
2929
30The columns should be in this values: """)30The columns should be in this values: """)
31# Authorized analytic journal in Accounting import31# Authorized journals in Accounting import
32ACCOUNTING_IMPORT_JOURNALS = [32ACCOUNTING_IMPORT_JOURNALS = [
33 'intermission',33 'intermission',
34 'correction',34 'correction_manual',
35 'hr',35 'hr',
36 'migration',36 'migration',
37 'sale', # US-70/337 'sale', # US-70/3
3838
=== modified file 'bin/addons/msf_doc_import/account.py'
--- bin/addons/msf_doc_import/account.py 2019-10-30 16:33:21 +0000
+++ bin/addons/msf_doc_import/account.py 2020-01-27 10:41:30 +0000
@@ -358,7 +358,7 @@
358 money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit358 money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit
359 r_credit = book_credit359 r_credit = book_credit
360360
361 # Check which journal it is to be posted to: should be of type OD, MIG or INT361 # Check the journal code which must match with one of the journal types listed in ACCOUNTING_IMPORT_JOURNALS
362 if not line[cols['Journal Code']]:362 if not line[cols['Journal Code']]:
363 errors.append(_('Line %s. No Journal Code specified') % (current_line_num,))363 errors.append(_('Line %s. No Journal Code specified') % (current_line_num,))
364 continue364 continue
365365
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2020-01-14 16:49:14 +0000
+++ bin/addons/msf_profile/data/patches.xml 2020-01-27 10:41:30 +0000
@@ -477,6 +477,7 @@
477 <field name="method">us_6768_trigger_FP_sync</field>477 <field name="method">us_6768_trigger_FP_sync</field>
478 </record>478 </record>
479479
480<<<<<<< TREE
480 <!-- UF15.1 -->481 <!-- UF15.1 -->
481 <record id="us_6930_gen_unreconcile" model="patch.scripts">482 <record id="us_6930_gen_unreconcile" model="patch.scripts">
482 <field name="method">us_6930_gen_unreconcile</field>483 <field name="method">us_6930_gen_unreconcile</field>
@@ -490,5 +491,12 @@
490 <field name="method">rec_entries_uf14_1_uf15</field>491 <field name="method">rec_entries_uf14_1_uf15</field>
491 </record>492 </record>
492493
494=======
495 <!-- UF16.0 -->
496 <record id="us_6692_new_od_journals" model="patch.scripts">
497 <field name="method">us_6692_new_od_journals</field>
498 </record>
499
500>>>>>>> MERGE-SOURCE
493 </data>501 </data>
494</openerp>502</openerp>
495503
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-11-21 16:33:04 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2020-01-27 10:41:30 +0000
@@ -42164,13 +42164,10 @@
42164msgid "Field Information"42164msgid "Field Information"
42165msgstr "Information Champ "42165msgstr "Information Champ "
4216642166
42167#. modules: account_corrections, account_hq_entries42167#. module: account_corrections
42168#: code:addons/account_corrections/account_move_line.py:49942168#: code:addons/account_corrections/account_move_line.py:499
42169#: code:addons/account_corrections/account_move_line.py:70742169#: code:addons/account_corrections/account_move_line.py:707
42170#: code:addons/account_corrections/account_move_line.py:85542170#: code:addons/account_corrections/account_move_line.py:855
42171#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:261
42172#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:340
42173#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:542
42174#, python-format42171#, python-format
42175msgid "No correction journal found!"42172msgid "No correction journal found!"
42176msgstr "Le système n'a pas trouvé de Journal des corrections !"42173msgstr "Le système n'a pas trouvé de Journal des corrections !"
@@ -91142,7 +91139,13 @@
91142#: code:addons/analytic_distribution/analytic_line.py:28891139#: code:addons/analytic_distribution/analytic_line.py:288
91143#, python-format91140#, python-format
91144msgid "No analytic journal found for corrections!"91141msgid "No analytic journal found for corrections!"
91145msgstr "No analytic journal found for corrections!"91142msgstr "Pas de journal analytique trouvé pour les corrections !"
91143
91144#. module: account_corrections
91145#: code:addons/account_corrections/wizard/analytic_distribution_wizard.py:198
91146#, python-format
91147msgid "No journal found for corrections!"
91148msgstr "Pas de journal trouvé pour les corrections !"
9114691149
91147#. module: stock91150#. module: stock
91148#: selection:physical.inventory.select.products,second_filter:091151#: selection:physical.inventory.select.products,second_filter:0
@@ -100290,13 +100293,6 @@
100290msgstr "Aucun journal HQ trouvé!"100293msgstr "Aucun journal HQ trouvé!"
100291100294
100292#. module: account_hq_entries100295#. module: account_hq_entries
100293#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:343
100294#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:506
100295#, python-format
100296msgid "No analytic correction journal found!"
100297msgstr "Aucun Journal Analytique de correction n'a été trouvé!"
100298
100299#. module: account_hq_entries
100300#: code:addons/account_hq_entries/hq_entries.py:311100296#: code:addons/account_hq_entries/hq_entries.py:311
100301#, python-format100297#, python-format
100302msgid "No line found!"100298msgid "No line found!"
@@ -106586,3 +106582,98 @@
106586msgid "Funding Pool not found."106582msgid "Funding Pool not found."
106587msgstr "Funding Pool non trouvé."106583msgstr "Funding Pool non trouvé."
106588106584
106585#. modules: account_override, account, register_accounting, msf_instance, finance
106586#: selection:account.analytic.journal,type:0
106587#: selection:account.journal,type:0
106588#: selection:account.analytic.line,journal_type:0
106589#: selection:account.move,journal_type:0
106590#: selection:account.move.line,journal_type:0
106591#: selection:cash.request.liquidity,type:0
106592#: selection:cash.request.liquidity.bank,type:0
106593#: selection:cash.request.liquidity.cash,type:0
106594#: selection:cash.request.liquidity.cheque,type:0
106595#: selection:account.analytic.journal.fake,type:0
106596#: selection:account.journal.fake,type:0
106597#: selection:wizard.register.opening.confirmation,register_type:0
106598msgid "Correction Auto"
106599msgstr "Correction Auto"
106600
106601#. modules: account_override, account, register_accounting, msf_instance, finance
106602#: selection:account.analytic.journal,type:0
106603#: selection:account.journal,type:0
106604#: selection:account.analytic.line,journal_type:0
106605#: selection:account.move,journal_type:0
106606#: selection:account.move.line,journal_type:0
106607#: selection:cash.request.liquidity,type:0
106608#: selection:cash.request.liquidity.bank,type:0
106609#: selection:cash.request.liquidity.cash,type:0
106610#: selection:cash.request.liquidity.cheque,type:0
106611#: selection:account.analytic.journal.fake,type:0
106612#: selection:account.journal.fake,type:0
106613#: selection:wizard.register.opening.confirmation,register_type:0
106614msgid "Correction Manual"
106615msgstr "Correction Manuelle"
106616
106617#. modules: account_override, account, register_accounting, msf_instance, finance
106618#: selection:account.analytic.journal,type:0
106619#: selection:account.journal,type:0
106620#: selection:account.analytic.line,journal_type:0
106621#: selection:account.move,journal_type:0
106622#: selection:account.move.line,journal_type:0
106623#: selection:cash.request.liquidity,type:0
106624#: selection:cash.request.liquidity.bank,type:0
106625#: selection:cash.request.liquidity.cash,type:0
106626#: selection:cash.request.liquidity.cheque,type:0
106627#: selection:account.analytic.journal.fake,type:0
106628#: selection:account.journal.fake,type:0
106629#: selection:wizard.register.opening.confirmation,register_type:0
106630msgid "Correction HQ"
106631msgstr "Correction HQ"
106632
106633#. module: account_journal
106634#: constraint:account.journal:0
106635msgid "The analytic journal selected must have the same type and prop. instance as this journal."
106636msgstr "Le journal analytique sélectionné doit avoir le même type et la même instance prop. que ce journal."
106637
106638#. module: account_journal
106639#: constraint:account.journal:0
106640msgid "A journal with this type already exists for this instance."
106641msgstr "Un journal de ce type existe déjà pour cette instance."
106642
106643#. module: account
106644#: constraint:account.analytic.journal:0
106645msgid "An analytic journal with this type already exists for this instance."
106646msgstr "Un journal analytique de ce type existe déjà pour cette instance."
106647
106648#. module: account_journal
106649#: constraint:account.journal:0
106650msgid "The prop. instance of the \"Correction HQ\" journal must be a coordination."
106651msgstr "L'instance prop. du journal de type \"Correction HQ\" doit être une coordination."
106652
106653#. module: account
106654#: constraint:account.analytic.journal:0
106655msgid "The prop. instance of the \"Correction HQ\" analytic journal must be a coordination."
106656msgstr "L'instance prop. du journal analytique de type \"Correction HQ\" doit être une coordination."
106657
106658#. module: account_override
106659#: code:addons/account_override/account.py:1198
106660#, python-format
106661msgid "The journal %s is forbidden in manual entries."
106662msgstr "Le journal %s est interdit dans les écritures manuelles."
106663
106664#. modules: account_hq_entries, account_corrections, analytic_distribution
106665#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:269
106666#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:568
106667#: code:addons/account_corrections/account_move_line.py:731
106668#: code:addons/analytic_distribution/analytic_line.py:354
106669#, python-format
106670msgid "No \"correction HQ\" journal found!"
106671msgstr "Aucun journal de type \"correction HQ\" n'a été trouvé !"
106672
106673#. modules: account_hq_entries, analytic_distribution
106674#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:350
106675#: code:addons/account_hq_entries/wizard/hq_entries_validation.py:531
106676#: code:addons/analytic_distribution/analytic_line.py:359
106677#, python-format
106678msgid "No \"correction HQ\" analytic journal found!"
106679msgstr "Aucun journal analytique de type \"correction HQ\" n'a été trouvé !"
106589106680
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2020-01-17 13:25:56 +0000
+++ bin/addons/msf_profile/msf_profile.py 2020-01-27 10:41:30 +0000
@@ -52,6 +52,7 @@
52 'model': lambda *a: 'patch.scripts',52 'model': lambda *a: 'patch.scripts',
53 }53 }
5454
55<<<<<<< TREE
55 # UF15.256 # UF15.2
56 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):57 def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b):
57 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id58 current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
@@ -130,6 +131,78 @@
130131
131 return True132 return True
132133
134=======
135 # UF16.0
136 def us_6692_new_od_journals(self, cr, uid, *a, **b):
137 """
138 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable
139
140 2. Create:
141 - ODM journals in all existing instances
142 - ODHQ journals in existing coordo instances
143
144 Notes:
145 - creations are done in Python as the objects created must sync normally
146 - none of these journals already exists in prod. DB.
147 """
148 user_obj = self.pool.get('res.users')
149 analytic_journal_obj = self.pool.get('account.analytic.journal')
150 journal_obj = self.pool.get('account.journal')
151 current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
152 if current_instance: # existing instances only
153 # existing correction journals
154 cr.execute("""
155 UPDATE account_analytic_journal
156 SET type = 'correction_manual'
157 WHERE type = 'correction'
158 AND code != 'OD';
159 """)
160 self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,))
161 cr.execute("""
162 UPDATE account_journal
163 SET type = 'correction_manual'
164 WHERE type = 'correction'
165 AND code != 'OD';
166 """)
167 self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,))
168 # ODM analytic journal
169 odm_analytic_vals = {
170 # Prop. Instance: by default the current one is used
171 'code': 'ODM',
172 'name': 'Correction manual',
173 'type': 'correction_manual',
174 }
175 odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals)
176 # ODM G/L journal
177 odm_vals = {
178 # Prop. Instance: by default the current one is used
179 'code': 'ODM',
180 'name': 'Correction manual',
181 'type': 'correction_manual',
182 'analytic_journal_id': odm_analytic_journal_id,
183 }
184 journal_obj.create(cr, uid, odm_vals)
185 if current_instance.level == 'coordo':
186 # ODHQ analytic journal
187 odhq_analytic_vals = {
188 # Prop. Instance: by default the current one is used
189 'code': 'ODHQ',
190 'name': 'Correction automatic HQ',
191 'type': 'correction_hq',
192 }
193 odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals)
194 # ODHQ G/L journal
195 odhq_vals = {
196 # Prop. Instance: by default the current one is used
197 'code': 'ODHQ',
198 'name': 'Correction automatic HQ',
199 'type': 'correction_hq',
200 'analytic_journal_id': odhq_analytic_journal_id,
201 }
202 journal_obj.create(cr, uid, odhq_vals)
203 return True
204
205>>>>>>> MERGE-SOURCE
133 # UF15.0206 # UF15.0
134 def us_6768_trigger_FP_sync(self, cr, uid, *a, **b):207 def us_6768_trigger_FP_sync(self, cr, uid, *a, **b):
135 """208 """
136209
=== modified file 'bin/addons/msf_sync_data_coordo/__openerp__.py'
--- bin/addons/msf_sync_data_coordo/__openerp__.py 2012-09-05 16:20:12 +0000
+++ bin/addons/msf_sync_data_coordo/__openerp__.py 2020-01-27 10:41:30 +0000
@@ -31,6 +31,8 @@
31 'init_xml': [],31 'init_xml': [],
32 'data': [32 'data': [
33 'data/res.partner.csv',33 'data/res.partner.csv',
34 'data/account.analytic.journal.csv',
35 'data/account.journal.csv',
34 ],36 ],
35 'demo_xml': [],37 'demo_xml': [],
36 'test':[],38 'test':[],
3739
=== added file 'bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv'
--- bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_sync_data_coordo/data/account.analytic.journal.csv 2020-01-27 10:41:30 +0000
@@ -0,0 +1,2 @@
1active,code,name,type
2TRUE,ODHQ,Correction automatic HQ,correction_hq
03
=== added file 'bin/addons/msf_sync_data_coordo/data/account.journal.csv'
--- bin/addons/msf_sync_data_coordo/data/account.journal.csv 1970-01-01 00:00:00 +0000
+++ bin/addons/msf_sync_data_coordo/data/account.journal.csv 2020-01-27 10:41:30 +0000
@@ -0,0 +1,2 @@
1code,currency,default_credit_account_id,default_debit_account_id,name,type,analytic_journal_id
2ODHQ,,,,Correction automatic HQ,correction_hq,Correction automatic HQ
03
=== modified file 'bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv'
--- bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv 2019-08-02 15:32:08 +0000
+++ bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv 2020-01-27 10:41:30 +0000
@@ -4,6 +4,7 @@
4TRUE,SAL,Sales,sale4TRUE,SAL,Sales,sale
5TRUE,SAR,Sales Refund,sale5TRUE,SAR,Sales Refund,sale
6TRUE,OD,Corrections,correction6TRUE,OD,Corrections,correction
7TRUE,ODM,Correction manual,correction_manual
7TRUE,HQ,Headquarters,hq8TRUE,HQ,Headquarters,hq
8TRUE,HR,Human Resources,hr9TRUE,HR,Human Resources,hr
9TRUE,ENG,Engagement,engagement10TRUE,ENG,Engagement,engagement
1011
=== modified file 'bin/addons/msf_sync_data_post_synchro/data/account.journal.csv'
--- bin/addons/msf_sync_data_post_synchro/data/account.journal.csv 2014-02-13 15:11:50 +0000
+++ bin/addons/msf_sync_data_post_synchro/data/account.journal.csv 2020-01-27 10:41:30 +0000
@@ -4,6 +4,7 @@
4HR,,,,Human Resources,hr,Human Resources4HR,,,,Human Resources,hr,Human Resources
5FXA,,67040,67040,FX adjustment,cur_adj,FX adjustment5FXA,,67040,67040,FX adjustment,cur_adj,FX adjustment
6OD,,,,Corrections,correction,Corrections6OD,,,,Corrections,correction,Corrections
7ODM,,,,Correction manual,correction_manual,Correction manual
7PUR,,,,Purchase,purchase,Purchase8PUR,,,,Purchase,purchase,Purchase
8PUF,,,,Purchase Refund,purchase_refund,Purchase Refund9PUF,,,,Purchase Refund,purchase_refund,Purchase Refund
9SAL,,,,Sales,sale,Sales10SAL,,,,Sales,sale,Sales
1011
=== modified file 'bin/addons/vertical_integration/report/hq_report_ocb.py'
--- bin/addons/vertical_integration/report/hq_report_ocb.py 2019-09-25 12:57:25 +0000
+++ bin/addons/vertical_integration/report/hq_report_ocb.py 2020-01-27 10:41:30 +0000
@@ -549,7 +549,7 @@
549 # Pay attention to take analytic line that are not on HQ and MIGRATION journals.549 # Pay attention to take analytic line that are not on HQ and MIGRATION journals.
550 'rawdata': """550 'rawdata': """
551 SELECT al.id, i.code,551 SELECT al.id, i.code,
552 CASE WHEN j.code = 'OD' THEN j.code ELSE aj.code END AS journal,552 CASE WHEN j.code IN ('OD', 'ODHQ', 'ODX') THEN j.code ELSE aj.code END AS journal,
553 al.entry_sequence, al.name, al.ref, al.document_date, al.date,553 al.entry_sequence, al.name, al.ref, al.document_date, al.date,
554 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool, 554 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool,
555 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit, 555 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit,
556556
=== modified file 'bin/addons/vertical_integration/report/hq_report_ocp.py'
--- bin/addons/vertical_integration/report/hq_report_ocp.py 2019-09-25 12:57:25 +0000
+++ bin/addons/vertical_integration/report/hq_report_ocp.py 2020-01-27 10:41:30 +0000
@@ -63,7 +63,7 @@
63 """63 """
64 Takes data in parameter corresponding to ACCOUNT MOVE LINES (results from 'bs_entries' or 'plresult' requests)64 Takes data in parameter corresponding to ACCOUNT MOVE LINES (results from 'bs_entries' or 'plresult' requests)
65 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)65 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
66 2) Modifies it for all OD entries that originate from HQ entry corrections:66 2) Modifies it for all entries that originate from HQ entry corrections:
67 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)67 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
68 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry68 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
69 Returns a list of tuples (same format as data)69 Returns a list of tuples (same format as data)
@@ -80,7 +80,7 @@
80 line_list = list(line)80 line_list = list(line)
81 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])81 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])
82 od_hq_entry = False82 od_hq_entry = False
83 if line_list[journal] == 'OD':83 if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692
84 aml = aml_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['corrected_line_id', 'reversal_line_id'])84 aml = aml_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['corrected_line_id', 'reversal_line_id'])
85 corrected_aml = aml.corrected_line_id85 corrected_aml = aml.corrected_line_id
86 reversed_aml = aml.reversal_line_id86 reversed_aml = aml.reversal_line_id
@@ -107,7 +107,7 @@
107 """107 """
108 Takes data in parameter corresponding to ACCOUNT ANALYTIC LINES (results from 'rawdata' request)108 Takes data in parameter corresponding to ACCOUNT ANALYTIC LINES (results from 'rawdata' request)
109 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)109 1) Replaces the journal type "key" by its corresponding "value" (ex: inkind => In-kind Donation)
110 2) Modifies it for all OD entries that originate from HQ entry corrections:110 2) Modifies it for all entries that originate from HQ entry corrections:
111 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)111 - instance: 'EAUD' or 'SIEG' if this matches the first 4 characters of the original HQ entry (if not: 'SIEG' by default)
112 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry112 - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry
113 Returns a list of tuples (same format as data)113 Returns a list of tuples (same format as data)
@@ -124,7 +124,7 @@
124 line_list = list(line)124 line_list = list(line)
125 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])125 line_list[journal_type] = self._get_journal_type_value(cr, uid, line_list[journal_type])
126 od_hq_entry = False126 od_hq_entry = False
127 if line_list[journal] == 'OD':127 if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692
128 aal = aal_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['last_corrected_id', 'reversal_origin'])128 aal = aal_obj.browse(cr, uid, line_list[id_from_db], fields_to_fetch=['last_corrected_id', 'reversal_origin'])
129 corrected_aal = aal.last_corrected_id129 corrected_aal = aal.last_corrected_id
130 reversed_aal = aal.reversal_origin130 reversed_aal = aal.reversal_origin
@@ -151,7 +151,7 @@
151 """151 """
152 ##### WARNING #####152 ##### WARNING #####
153 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###153 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###
154 - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections154 - first modify the data for all lines corresponding to entries originating from HQ entry corrections
155 - then call OCB method on the new data to change first column for the DB ID155 - then call OCB method on the new data to change first column for the DB ID
156 """156 """
157 new_data = self._handle_od_ji_entries(cr, uid, data) # we handle account move lines157 new_data = self._handle_od_ji_entries(cr, uid, data) # we handle account move lines
@@ -162,7 +162,7 @@
162 """162 """
163 ##### WARNING #####163 ##### WARNING #####
164 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###164 ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ###
165 - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections165 - first modify the data for all lines corresponding to entries originating from HQ entry corrections
166 - then call OCB method on the new data to change first column for the DB ID166 - then call OCB method on the new data to change first column for the DB ID
167 """167 """
168 new_data = self._handle_od_aji_entries(cr, uid, data) # we handle account analytic lines168 new_data = self._handle_od_aji_entries(cr, uid, data) # we handle account analytic lines
@@ -341,7 +341,7 @@
341 # Pay attention to take analytic lines that are not on HQ, MIGRATION, IN-KIND and ODX journals.341 # Pay attention to take analytic lines that are not on HQ, MIGRATION, IN-KIND and ODX journals.
342 'rawdata': """342 'rawdata': """
343 SELECT al.id, SUBSTR(i.code, 1, 3),343 SELECT al.id, SUBSTR(i.code, 1, 3),
344 CASE WHEN j.code = 'OD' THEN j.code ELSE aj.code END AS journal,344 CASE WHEN j.code IN ('OD', 'ODHQ') THEN j.code ELSE aj.code END AS journal,
345 al.entry_sequence, al.name, al.ref, al.document_date, al.date,345 al.entry_sequence, al.name, al.ref, al.document_date, al.date,
346 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool, 346 a.code, al.partner_txt, aa.code AS dest, aa2.code AS cost_center_id, aa3.code AS funding_pool,
347 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit, 347 CASE WHEN al.amount_currency < 0 AND aml.is_addendum_line = 'f' THEN ABS(al.amount_currency) ELSE 0.0 END AS debit,
@@ -350,7 +350,7 @@
350 CASE WHEN al.amount < 0 THEN ABS(ROUND(al.amount, 2)) ELSE 0.0 END AS debit, 350 CASE WHEN al.amount < 0 THEN ABS(ROUND(al.amount, 2)) ELSE 0.0 END AS debit,
351 CASE WHEN al.amount > 0 THEN ROUND(al.amount, 2) ELSE 0.0 END AS credit,351 CASE WHEN al.amount > 0 THEN ROUND(al.amount, 2) ELSE 0.0 END AS credit,
352 cc.name AS "functional_currency", hr.identification_id as "emplid", aml.partner_id, hr.name_resource as hr_name,352 cc.name AS "functional_currency", hr.identification_id as "emplid", aml.partner_id, hr.name_resource as hr_name,
353 CASE WHEN j.code = 'OD' THEN j.type ELSE aj.type END AS journal_type353 CASE WHEN j.code IN ('OD', 'ODHQ') THEN j.type ELSE aj.type END AS journal_type
354 FROM account_analytic_line AS al, 354 FROM account_analytic_line AS al,
355 account_account AS a, 355 account_account AS a,
356 account_analytic_account AS aa, 356 account_analytic_account AS aa,

Subscribers

People subscribed via source and target branches