Merge lp:~julie-w/unifield-server/US-6898 into lp:unifield-server
- US-6898
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+378097@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/addons/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 | 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, |
6 | 40 | } | 40 | } |
7 | 41 | 41 | ||
8 | 42 | def _check_corr_type(self, cr, uid, ids, context=None): | ||
9 | 43 | """ | ||
10 | 44 | Check that only one "Correction" and one "Correction HQ" analytic journals exist per instance | ||
11 | 45 | """ | ||
12 | 46 | if context is None: | ||
13 | 47 | context = {} | ||
14 | 48 | for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context): | ||
15 | 49 | if analytic_journal.type in ('correction', 'correction_hq'): | ||
16 | 50 | analytic_journal_dom = [('type', '=', analytic_journal.type), | ||
17 | 51 | ('instance_id', '=', analytic_journal.instance_id.id), | ||
18 | 52 | ('id', '!=', analytic_journal.id)] | ||
19 | 53 | if self.search_exist(cr, uid, analytic_journal_dom, context=context): | ||
20 | 54 | return False | ||
21 | 55 | return True | ||
22 | 56 | |||
23 | 57 | def _check_hq_corr(self, cr, uid, ids, context=None): | ||
24 | 58 | """ | ||
25 | 59 | Check that the prop. instance of the "Correction HQ" analytic journal is a coordo | ||
26 | 60 | """ | ||
27 | 61 | if context is None: | ||
28 | 62 | context = {} | ||
29 | 63 | for analytic_journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context): | ||
30 | 64 | if analytic_journal.type == 'correction_hq' and analytic_journal.instance_id.level != 'coordo': | ||
31 | 65 | return False | ||
32 | 66 | return True | ||
33 | 67 | |||
34 | 68 | _constraints = [ | ||
35 | 69 | (_check_corr_type, 'An analytic journal with this type already exists for this instance.', ['type', 'instance_id']), | ||
36 | 70 | (_check_hq_corr, 'The prop. instance of the "Correction HQ" analytic journal must be a coordination.', ['type', 'instance_id']), | ||
37 | 71 | ] | ||
38 | 72 | |||
39 | 73 | def get_correction_analytic_journal(self, cr, uid, corr_type=False, context=None): | ||
40 | 74 | """ | ||
41 | 75 | Returns the correction analytic journal of the current instance (or False if not found): | ||
42 | 76 | - by default => standard Correction journal | ||
43 | 77 | - corr_type 'hq' => Correction HQ journal | ||
44 | 78 | - corr_type 'extra' => OD-Extra Accounting journal | ||
45 | 79 | - corr_type 'manual' => Correction Manual journal | ||
46 | 80 | """ | ||
47 | 81 | if context is None: | ||
48 | 82 | context = {} | ||
49 | 83 | if corr_type == 'hq': | ||
50 | 84 | analytic_journal_type = 'correction_hq' | ||
51 | 85 | elif corr_type == 'extra': | ||
52 | 86 | analytic_journal_type = 'extra' | ||
53 | 87 | elif corr_type == 'manual': | ||
54 | 88 | analytic_journal_type = 'correction_manual' | ||
55 | 89 | else: | ||
56 | 90 | analytic_journal_type = 'correction' | ||
57 | 91 | analytic_journal_ids = self.search(cr, uid, [('type', '=', analytic_journal_type), ('is_current_instance', '=', True)], | ||
58 | 92 | order='id', limit=1, context=context) | ||
59 | 93 | return analytic_journal_ids and analytic_journal_ids[0] or False | ||
60 | 94 | |||
61 | 95 | |||
62 | 42 | account_analytic_journal() | 96 | account_analytic_journal() |
63 | 43 | 97 | ||
64 | 98 | |||
65 | 44 | class account_journal(osv.osv): | 99 | class account_journal(osv.osv): |
66 | 45 | _inherit="account.journal" | 100 | _inherit="account.journal" |
67 | 46 | 101 | ||
68 | 47 | 102 | ||
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 | 448 | ana_j_obj = self.pool.get('account.analytic.journal') | 448 | ana_j_obj = self.pool.get('account.analytic.journal') |
74 | 449 | aal_obj = self.pool.get('account.analytic.line') | 449 | aal_obj = self.pool.get('account.analytic.line') |
75 | 450 | # Search correction journal | 450 | # Search correction journal |
82 | 451 | j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'), | 451 | j_corr_id = j_obj.get_correction_journal(cr, uid, context=context) |
83 | 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) |
78 | 453 | j_corr_id = j_corr_ids and j_corr_ids[0] or False | ||
79 | 454 | j_ana_corr_ids = ana_j_obj.search(cr, uid, [('type', '=', 'correction'), ('is_current_instance', '=', True)], | ||
80 | 455 | order='id', limit=1, context=context) | ||
81 | 456 | j_ana_corr_id = j_ana_corr_ids and j_ana_corr_ids[0] or False | ||
84 | 457 | # Search extra-accounting journal | 453 | # Search extra-accounting journal |
91 | 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) |
92 | 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) |
87 | 460 | j_extra_id = j_extra_ids and j_extra_ids[0] or False | ||
88 | 461 | j_ana_extra_ids = ana_j_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)], | ||
89 | 462 | order='id', limit=1, context=context) | ||
90 | 463 | j_ana_extra_id = j_ana_extra_ids and j_ana_extra_ids[0] or False | ||
93 | 464 | 456 | ||
94 | 465 | # Search attached period | 457 | # Search attached period |
95 | 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, |
96 | @@ -662,14 +654,13 @@ | |||
97 | 662 | new_account_id, context=context) | 654 | new_account_id, context=context) |
98 | 663 | 655 | ||
99 | 664 | # Search correction journal | 656 | # Search correction journal |
103 | 665 | j_corr_ids = j_obj.search(cr, uid, [('type', '=', 'correction'), | 657 | j_corr_id = j_obj.get_correction_journal(cr, uid, context=context) |
101 | 666 | ('is_current_instance', '=', True)], order='id', limit=1, context=context) | ||
102 | 667 | j_corr_id = j_corr_ids and j_corr_ids[0] or False | ||
104 | 668 | 658 | ||
105 | 669 | # Search extra-accounting journal | 659 | # Search extra-accounting journal |
109 | 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) |
110 | 671 | ('is_current_instance', '=', True)], order='id', limit=1) | 661 | |
111 | 672 | j_extra_id = j_extra_ids and j_extra_ids[0] or False | 662 | # Search for the "Correction HQ" journal |
112 | 663 | hq_corr_journal_id = j_obj.get_correction_journal(cr, uid, corr_type='hq', context=context) | ||
113 | 673 | 664 | ||
114 | 674 | # Search attached period | 665 | # Search attached period |
115 | 675 | period_obj = self.pool.get('account.period') | 666 | period_obj = self.pool.get('account.period') |
116 | @@ -718,6 +709,13 @@ | |||
117 | 718 | raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!')) | 709 | raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!')) |
118 | 719 | if new_account.type_for_register != 'donation': | 710 | if new_account.type_for_register != 'donation': |
119 | 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!')) |
120 | 712 | |||
121 | 713 | # Correction: of an HQ entry, or of a correction of an HQ entry | ||
122 | 714 | if ml.journal_id.type in ('hq', 'correction_hq'): | ||
123 | 715 | journal_id = hq_corr_journal_id | ||
124 | 716 | if not journal_id: | ||
125 | 717 | raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!')) | ||
126 | 718 | |||
127 | 721 | if not journal_id: | 719 | if not journal_id: |
128 | 722 | raise osv.except_osv(_('Error'), _('No correction journal found!')) | 720 | raise osv.except_osv(_('Error'), _('No correction journal found!')) |
129 | 723 | 721 | ||
130 | 724 | 722 | ||
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 | 150 | wizard = self.browse(cr, uid, wizard_id) | 150 | wizard = self.browse(cr, uid, wizard_id) |
136 | 151 | ad_obj = self.pool.get('analytic.distribution') | 151 | ad_obj = self.pool.get('analytic.distribution') |
137 | 152 | ana_line_obj = self.pool.get('account.analytic.line') | 152 | ana_line_obj = self.pool.get('account.analytic.line') |
138 | 153 | journal_obj = self.pool.get('account.journal') | ||
139 | 154 | analytic_journal_obj = self.pool.get('account.analytic.journal') | ||
140 | 153 | company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id | 155 | company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id |
141 | 154 | ml = wizard.move_line_id | 156 | ml = wizard.move_line_id |
142 | 155 | # US-5848: orig_date left unchanged not to break historical behavior, | 157 | # US-5848: orig_date left unchanged not to break historical behavior, |
143 | @@ -176,12 +178,12 @@ | |||
144 | 176 | entry_seq_data['sequence'] = biggest_reversal_aji.entry_sequence | 178 | entry_seq_data['sequence'] = biggest_reversal_aji.entry_sequence |
145 | 177 | 179 | ||
146 | 178 | jtype = 'correction' | 180 | jtype = 'correction' |
148 | 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': |
149 | 180 | jtype = 'extra' | 182 | jtype = 'extra' |
154 | 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 |
155 | 182 | [('type', '=', jtype), ('is_current_instance', '=', True)], | 184 | elif ml.journal_id.type in ('hq', 'correction_hq'): |
156 | 183 | order='id', limit=1) | 185 | jtype = 'hq' |
157 | 184 | correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False | 186 | correction_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type=jtype, context=context) |
158 | 185 | if not correction_journal_id: | 187 | if not correction_journal_id: |
159 | 186 | raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!')) | 188 | raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!')) |
160 | 187 | to_create = [] | 189 | to_create = [] |
161 | @@ -191,19 +193,11 @@ | |||
162 | 191 | old_line_ok = [] | 193 | old_line_ok = [] |
163 | 192 | any_reverse = False | 194 | any_reverse = False |
164 | 193 | # Prepare journal and period information for entry sequences | 195 | # Prepare journal and period information for entry sequences |
178 | 194 | journal_sql = """ | 196 | journal_id = journal_obj.get_correction_journal(cr, uid, corr_type=jtype, context=context) |
179 | 195 | SELECT id, code | 197 | if not journal_id: |
180 | 196 | FROM account_journal | 198 | raise osv.except_osv(_('Error'), _('No journal found for corrections!')) |
181 | 197 | WHERE type = %s | 199 | journal = journal_obj.browse(cr, uid, journal_id, context=context) |
182 | 198 | AND is_current_instance = true | 200 | code = journal.code |
170 | 199 | ORDER BY id | ||
171 | 200 | LIMIT 1; | ||
172 | 201 | """ | ||
173 | 202 | cr.execute(journal_sql, (jtype,)) | ||
174 | 203 | journal_sql_res = cr.fetchone() | ||
175 | 204 | journal_id = journal_sql_res[0] | ||
176 | 205 | code = journal_sql_res[1] | ||
177 | 206 | journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) | ||
183 | 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) |
184 | 208 | if not period_ids: | 202 | if not period_ids: |
185 | 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 '')) |
186 | @@ -248,8 +242,7 @@ | |||
187 | 248 | # US-1343/2: flag that the chain origin is an HQ | 242 | # US-1343/2: flag that the chain origin is an HQ |
188 | 249 | # entry: in other terms OD AJI from a HQ JI | 243 | # entry: in other terms OD AJI from a HQ JI |
189 | 250 | is_HQ_origin = { | 244 | is_HQ_origin = { |
192 | 251 | 'from_od': \ | 245 | 'from_od': original_al.journal_id.type in ('correction', 'correction_hq'), |
191 | 252 | original_al.journal_id.type == 'correction', | ||
193 | 253 | } | 246 | } |
194 | 254 | break | 247 | break |
195 | 255 | 248 | ||
196 | 256 | 249 | ||
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 | 262 | original_lines = set() | 262 | original_lines = set() |
202 | 263 | original_move_ids = [] | 263 | original_move_ids = [] |
203 | 264 | ana_line_obj = self.pool.get('account.analytic.line') | 264 | ana_line_obj = self.pool.get('account.analytic.line') |
210 | 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) |
211 | 266 | [('type', '=', 'correction'), ('is_current_instance', '=', True)], | 266 | if not odhq_journal_id: |
212 | 267 | order='id', limit=1) | 267 | raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!')) |
207 | 268 | if not od_journal_ids: | ||
208 | 269 | raise osv.except_osv(_('Error'), _('No correction journal found!')) | ||
209 | 270 | od_journal_id = od_journal_ids[0] | ||
213 | 271 | all_lines = set() | 268 | all_lines = set() |
214 | 272 | pure_ad_cor_ji_ids = [] | 269 | pure_ad_cor_ji_ids = [] |
215 | 273 | original_aji_ids = [] | 270 | original_aji_ids = [] |
216 | @@ -302,7 +299,7 @@ | |||
217 | 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) |
218 | 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, |
219 | 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, |
221 | 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) |
222 | 306 | # original move line | 303 | # original move line |
223 | 307 | original_ml_result = res_move[line.id] | 304 | original_ml_result = res_move[line.id] |
224 | 308 | # Mark new journal items as corrections for the first one | 305 | # Mark new journal items as corrections for the first one |
225 | @@ -343,14 +340,10 @@ | |||
226 | 343 | initial_ana_ids = ana_line_obj.search(cr, uid, [('move_id.move_id', '=', move_id)]) # original move_id | 340 | initial_ana_ids = ana_line_obj.search(cr, uid, [('move_id.move_id', '=', move_id)]) # original move_id |
227 | 344 | original_aji_ids += initial_ana_ids | 341 | original_aji_ids += initial_ana_ids |
228 | 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) |
235 | 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, |
236 | 347 | [('type', '=', 'correction'), ('is_current_instance', '=', True)], | 344 | corr_type='hq', context=context) |
231 | 348 | order='id', limit=1) | ||
232 | 349 | if not acor_journal_ids: | ||
233 | 350 | raise osv.except_osv(_('Error'), _('No correction journal found!')) | ||
234 | 351 | acor_journal_id = acor_journal_ids[0] | ||
237 | 352 | if not acor_journal_id: | 345 | if not acor_journal_id: |
239 | 353 | raise osv.except_osv(_('Warning'), _('No analytic correction journal found!')) | 346 | raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!')) |
240 | 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 one | 347 | 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 | 355 | 348 | ||
242 | 356 | # Mark new analytic items as correction for original line | 349 | # Mark new analytic items as correction for original line |
243 | @@ -368,7 +361,7 @@ | |||
244 | 368 | for aal in browse_aals: | 361 | for aal in browse_aals: |
245 | 369 | cor_name = 'COR1 - ' + aal.name | 362 | cor_name = 'COR1 - ' + aal.name |
246 | 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}) |
248 | 371 | # also write the OD entry_sequence to the REV aal | 364 | # also write the ODHQ entry_sequence to the REV aal |
249 | 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}) |
250 | 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])) |
251 | 374 | 367 | ||
252 | @@ -408,13 +401,10 @@ | |||
253 | 408 | ana_line_obj = self.pool.get('account.analytic.line') | 401 | ana_line_obj = self.pool.get('account.analytic.line') |
254 | 409 | distrib_fp_line_obj = self.pool.get('funding.pool.distribution.line') | 402 | distrib_fp_line_obj = self.pool.get('funding.pool.distribution.line') |
255 | 410 | distrib_cc_line_obj = self.pool.get('cost.center.distribution.line') | 403 | distrib_cc_line_obj = self.pool.get('cost.center.distribution.line') |
263 | 411 | # Search an analytic correction journal | 404 | journal_obj = self.pool.get('account.journal') |
264 | 412 | acor_journal_id = False | 405 | analytic_journal_obj = self.pool.get('account.analytic.journal') |
265 | 413 | acor_journal_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type', '=', 'correction'), | 406 | # Search for the "Correction HQ" analytic journal |
266 | 414 | ('is_current_instance', '=', True)], | 407 | acor_journal_id = analytic_journal_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context) |
260 | 415 | order='id', limit=1) | ||
261 | 416 | if acor_journal_ids: | ||
262 | 417 | acor_journal_id = acor_journal_ids[0] | ||
267 | 418 | # Tag active_ids as user validated | 408 | # Tag active_ids as user validated |
268 | 419 | account_change = [] | 409 | account_change = [] |
269 | 420 | cc_change = [] | 410 | cc_change = [] |
270 | @@ -529,7 +519,7 @@ | |||
271 | 529 | # Give them analytic correction journal (UF-1385 in comments) | 519 | # Give them analytic correction journal (UF-1385 in comments) |
272 | 530 | if not acor_journal_id: | 520 | if not acor_journal_id: |
273 | 531 | self.write(cr, uid, [wiz.id], {'running': False}) | 521 | self.write(cr, uid, [wiz.id], {'running': False}) |
275 | 532 | raise osv.except_osv(_('Warning'), _('No analytic correction journal found!')) | 522 | raise osv.except_osv(_('Warning'), _('No "correction HQ" analytic journal found!')) |
276 | 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}) |
277 | 534 | # create new lines | 524 | # create new lines |
278 | 535 | if not fp_old_lines: # UTP-546 - this have been added because of sync that break analytic lines generation | 525 | 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 | 560 | if isinstance(cor_ids, (int, long)): | 550 | if isinstance(cor_ids, (int, long)): |
281 | 561 | cor_ids = [cor_ids] | 551 | cor_ids = [cor_ids] |
282 | 562 | cor_ids += res_reverse | 552 | cor_ids += res_reverse |
288 | 563 | 553 | odhq_journal_id = journal_obj.get_correction_journal(cr, uid, corr_type='hq', context=context) | |
289 | 564 | gl_journal_ids = self.pool.get('account.journal').search(cr, uid, | 554 | if not odhq_journal_id: |
285 | 565 | [('type', '=', 'correction'), ('is_current_instance', '=', True)], | ||
286 | 566 | order='id', limit=1) | ||
287 | 567 | if not gl_journal_ids: | ||
290 | 568 | self.write(cr, uid, [wiz.id], {'running': False}) | 555 | self.write(cr, uid, [wiz.id], {'running': False}) |
293 | 569 | raise osv.except_osv(_('Error'), _('No correction journal found!')) | 556 | raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!')) |
294 | 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) |
295 | 571 | journal_sequence_id = gl_journal_obj.sequence_id.id | 558 | journal_sequence_id = gl_journal_obj.sequence_id.id |
296 | 572 | journal_code = gl_journal_obj.code | 559 | journal_code = gl_journal_obj.code |
297 | 573 | seq_obj = self.pool.get('ir.sequence') | 560 | seq_obj = self.pool.get('ir.sequence') |
298 | 574 | 561 | ||
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 | 60 | ('bank', 'Bank'), | 60 | ('bank', 'Bank'), |
304 | 61 | ('cash','Cash'), | 61 | ('cash','Cash'), |
305 | 62 | ('cheque', 'Cheque'), | 62 | ('cheque', 'Cheque'), |
307 | 63 | ('correction','Correction'), | 63 | ('correction', 'Correction Auto'), |
308 | 64 | ('correction_hq', 'Correction HQ'), | ||
309 | 65 | ('correction_manual', 'Correction Manual'), | ||
310 | 64 | ('cur_adj', 'Currency Adjustment'), | 66 | ('cur_adj', 'Currency Adjustment'), |
311 | 65 | ('depreciation', 'Depreciation'), | 67 | ('depreciation', 'Depreciation'), |
312 | 66 | ('general', 'General'), | 68 | ('general', 'General'), |
313 | @@ -111,6 +113,51 @@ | |||
314 | 111 | 'group_invoice_lines': False, | 113 | 'group_invoice_lines': False, |
315 | 112 | } | 114 | } |
316 | 113 | 115 | ||
317 | 116 | def _check_correction_type(self, cr, uid, ids, context=None): | ||
318 | 117 | """ | ||
319 | 118 | Check that only one "Correction" and one "Correction HQ" journals exist per instance | ||
320 | 119 | """ | ||
321 | 120 | if context is None: | ||
322 | 121 | context = {} | ||
323 | 122 | for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context): | ||
324 | 123 | if journal.type in ('correction', 'correction_hq') and journal.instance_id: | ||
325 | 124 | journal_dom = [('type', '=', journal.type), ('instance_id', '=', journal.instance_id.id), ('id', '!=', journal.id)] | ||
326 | 125 | if self.search_exist(cr, uid, journal_dom, context=context): | ||
327 | 126 | return False | ||
328 | 127 | return True | ||
329 | 128 | |||
330 | 129 | def _check_correction_analytic_journal(self, cr, uid, ids, context=None): | ||
331 | 130 | """ | ||
332 | 131 | In case of Correction journal or Correction HQ journal, check that the analytic journal selected is the right one | ||
333 | 132 | """ | ||
334 | 133 | if context is None: | ||
335 | 134 | context = {} | ||
336 | 135 | for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'analytic_journal_id', 'instance_id'], context=context): | ||
337 | 136 | if journal.type in ('correction', 'correction_hq'): | ||
338 | 137 | if not journal.analytic_journal_id: | ||
339 | 138 | return False | ||
340 | 139 | elif journal.type != journal.analytic_journal_id.type or journal.instance_id != journal.analytic_journal_id.instance_id: | ||
341 | 140 | return False | ||
342 | 141 | return True | ||
343 | 142 | |||
344 | 143 | def _check_hq_correction(self, cr, uid, ids, context=None): | ||
345 | 144 | """ | ||
346 | 145 | Check that the prop. instance of the "Correction HQ" journal is a coordo | ||
347 | 146 | """ | ||
348 | 147 | if context is None: | ||
349 | 148 | context = {} | ||
350 | 149 | for journal in self.browse(cr, uid, ids, fields_to_fetch=['type', 'instance_id'], context=context): | ||
351 | 150 | if journal.type == 'correction_hq' and (not journal.instance_id or journal.instance_id.level != 'coordo'): | ||
352 | 151 | return False | ||
353 | 152 | return True | ||
354 | 153 | |||
355 | 154 | _constraints = [ | ||
356 | 155 | (_check_correction_type, 'A journal with this type already exists for this instance.', ['type', 'instance_id']), | ||
357 | 156 | (_check_correction_analytic_journal, 'The analytic journal selected must have the same type and prop. instance as this journal.', | ||
358 | 157 | ['type', 'analytic_journal_id', 'instance_id']), | ||
359 | 158 | (_check_hq_correction, 'The prop. instance of the "Correction HQ" journal must be a coordination.', ['type', 'instance_id']), | ||
360 | 159 | ] | ||
361 | 160 | |||
362 | 114 | def get_current_period(self, cr, uid, context=None): | 161 | def get_current_period(self, cr, uid, context=None): |
363 | 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()) |
364 | 116 | if periods: | 163 | if periods: |
365 | @@ -397,5 +444,28 @@ | |||
366 | 397 | 'target': 'crush', | 444 | 'target': 'crush', |
367 | 398 | } | 445 | } |
368 | 399 | 446 | ||
369 | 447 | def get_correction_journal(self, cr, uid, corr_type=False, context=None): | ||
370 | 448 | """ | ||
371 | 449 | Returns the correction journal of the current instance (or False if not found): | ||
372 | 450 | - by default => standard Correction journal | ||
373 | 451 | - corr_type 'hq' => Correction HQ journal | ||
374 | 452 | - corr_type 'extra' => OD-Extra Accounting journal | ||
375 | 453 | - corr_type 'manual' => Correction Manual journal | ||
376 | 454 | """ | ||
377 | 455 | if context is None: | ||
378 | 456 | context = {} | ||
379 | 457 | if corr_type == 'hq': | ||
380 | 458 | journal_type = 'correction_hq' | ||
381 | 459 | elif corr_type == 'extra': | ||
382 | 460 | journal_type = 'extra' | ||
383 | 461 | elif corr_type == 'manual': | ||
384 | 462 | journal_type = 'correction_manual' | ||
385 | 463 | else: | ||
386 | 464 | journal_type = 'correction' | ||
387 | 465 | journal_ids = self.search(cr, uid, [('type', '=', journal_type), ('is_current_instance', '=', True)], | ||
388 | 466 | order='id', limit=1, context=context) | ||
389 | 467 | return journal_ids and journal_ids[0] or False | ||
390 | 468 | |||
391 | 469 | |||
392 | 400 | account_journal() | 470 | account_journal() |
393 | 401 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 471 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
394 | 402 | 472 | ||
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 | 37 | """ | 37 | """ |
400 | 38 | return [ | 38 | return [ |
401 | 39 | ('cash','Cash'), | 39 | ('cash','Cash'), |
403 | 40 | ('correction', 'Correction'), | 40 | ('correction', 'Correction Auto'), |
404 | 41 | ('correction_hq', 'Correction HQ'), | ||
405 | 42 | ('correction_manual', 'Correction Manual'), | ||
406 | 41 | ('cur_adj', 'Currency Adjustment'), | 43 | ('cur_adj', 'Currency Adjustment'), |
407 | 42 | ('engagement', 'Engagement'), | 44 | ('engagement', 'Engagement'), |
408 | 43 | ('general','General'), | 45 | ('general','General'), |
409 | 44 | 46 | ||
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 | 887 | domain="[('state', '=', 'draft')]", hide_default_menu=True), | 887 | domain="[('state', '=', 'draft')]", hide_default_menu=True), |
415 | 888 | 'journal_id': fields.many2one('account.journal', 'Journal', | 888 | 'journal_id': fields.many2one('account.journal', 'Journal', |
416 | 889 | required=True, states={'posted':[('readonly',True)]}, | 889 | required=True, states={'posted':[('readonly',True)]}, |
418 | 890 | domain="[('type', 'not in', ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra']), ('instance_filter', '=', True)]", | 890 | domain="[('type', 'not in', " |
419 | 891 | " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq'])," | ||
420 | 892 | "('instance_filter', '=', True)]", | ||
421 | 891 | hide_default_menu=True), | 893 | hide_default_menu=True), |
422 | 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"), |
423 | 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", \ |
424 | @@ -1192,6 +1194,8 @@ | |||
425 | 1192 | # UFTP-105: Do not permit to validate a journal entry on a period that is not open | 1194 | # UFTP-105: Do not permit to validate a journal entry on a period that is not open |
426 | 1193 | if m.period_id and m.period_id.state != 'draft': | 1195 | if m.period_id and m.period_id.state != 'draft': |
427 | 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)) |
428 | 1197 | if m.journal_id.type in ('correction', 'correction_hq'): | ||
429 | 1198 | raise osv.except_osv(_('Warning'), _('The journal %s is forbidden in manual entries.') % (m.journal_id.code)) | ||
430 | 1195 | prev_currency_id = False | 1199 | prev_currency_id = False |
431 | 1196 | for ml in m.line_id: | 1200 | for ml in m.line_id: |
432 | 1197 | # Check that the currency and type of the (journal) third party is correct | 1201 | # Check that the currency and type of the (journal) third party is correct |
433 | 1198 | 1202 | ||
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 | 282 | context.update({'from': 'mass_reallocation'}) # this permits reallocation to be accepted when rewrite analaytic lines | 282 | context.update({'from': 'mass_reallocation'}) # this permits reallocation to be accepted when rewrite analaytic lines |
439 | 283 | move_prefix = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id.move_prefix | 283 | move_prefix = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id.move_prefix |
440 | 284 | 284 | ||
441 | 285 | ir_seq_obj = self.pool.get('ir.sequence') | ||
442 | 286 | |||
443 | 285 | aaj_obj = self.pool.get('account.analytic.journal') | 287 | aaj_obj = self.pool.get('account.analytic.journal') |
448 | 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) |
449 | 287 | order='id', limit=1) | 289 | if not od_analytic_journal_id: |
446 | 288 | correction_journal_id = correction_journal_ids and correction_journal_ids[0] or False | ||
447 | 289 | if not correction_journal_id: | ||
450 | 290 | raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!')) | 290 | raise osv.except_osv(_('Error'), _('No analytic journal found for corrections!')) |
451 | 291 | 291 | ||
452 | 292 | # sequence info from GL journal | 292 | # sequence info from GL journal |
453 | 293 | aj_obj = self.pool.get('account.journal') | 293 | aj_obj = self.pool.get('account.journal') |
457 | 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) |
455 | 295 | order='id', limit=1) | ||
456 | 296 | gl_correction_journal_id = gl_correction_journal_ids and gl_correction_journal_ids[0] or False | ||
458 | 297 | if not gl_correction_journal_id: | 295 | if not gl_correction_journal_id: |
459 | 298 | raise osv.except_osv(_('Error'), _('No GL journal found for corrections!')) | 296 | raise osv.except_osv(_('Error'), _('No GL journal found for corrections!')) |
460 | 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) |
461 | 300 | 298 | ||
462 | 301 | is_donation = {} | 299 | is_donation = {} |
463 | 302 | gl_correction_odx_journal_rec = False | 300 | gl_correction_odx_journal_rec = False |
464 | 301 | gl_correction_odhq_journal_rec = False | ||
465 | 303 | # Process lines | 302 | # Process lines |
466 | 304 | for aline in self.browse(cr, uid, ids, context=context): | 303 | for aline in self.browse(cr, uid, ids, context=context): |
467 | 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) |
468 | @@ -336,28 +335,36 @@ | |||
469 | 336 | 335 | ||
470 | 337 | if is_donation[aline.move_id.account_id.id]: | 336 | if is_donation[aline.move_id.account_id.id]: |
471 | 338 | if not gl_correction_odx_journal_rec: | 337 | if not gl_correction_odx_journal_rec: |
475 | 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) |
476 | 340 | order='id', limit=1) | 339 | if not gl_correction_odx_journal_id: |
474 | 341 | if not odx_aji: | ||
477 | 342 | raise osv.except_osv(_('Error'), _('No GL journal found for ODX')) | 340 | raise osv.except_osv(_('Error'), _('No GL journal found for ODX')) |
478 | 343 | gl_correction_odx_journal_id = odx_aji[0] | ||
479 | 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) |
485 | 345 | 342 | odx_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='extra', context=context) | |
486 | 346 | correction_odx_journal_ids = aaj_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)], | 343 | if not odx_analytic_journal_id: |
482 | 347 | order='id', limit=1) | ||
483 | 348 | correction_odx_journal_id = correction_odx_journal_ids and correction_odx_journal_ids[0] or False | ||
484 | 349 | if not correction_odx_journal_id: | ||
487 | 350 | raise osv.except_osv(_('Error'), _('No analytic journal found for ODX!')) | 344 | raise osv.except_osv(_('Error'), _('No analytic journal found for ODX!')) |
488 | 351 | 345 | ||
491 | 352 | 346 | seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx) | |
490 | 353 | seqnum = self.pool.get('ir.sequence').get_id(cr, uid, gl_correction_odx_journal_rec.sequence_id.id, context=seq_num_ctx) | ||
492 | 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) |
494 | 355 | corr_j = correction_odx_journal_id | 348 | corr_j = odx_analytic_journal_id |
495 | 349 | # Correction: of an HQ entry, or of a correction of an HQ entry | ||
496 | 350 | elif aline.journal_id.type in ('hq', 'correction_hq'): | ||
497 | 351 | if not gl_correction_odhq_journal_rec: | ||
498 | 352 | gl_correction_odhq_journal_id = aj_obj.get_correction_journal(cr, uid, corr_type='hq', context=context) | ||
499 | 353 | if not gl_correction_odhq_journal_id: | ||
500 | 354 | raise osv.except_osv(_('Error'), _('No "correction HQ" journal found!')) | ||
501 | 355 | gl_correction_odhq_journal_rec = aj_obj.browse(cr, uid, gl_correction_odhq_journal_id, | ||
502 | 356 | fields_to_fetch=['sequence_id', 'code'], context=context) | ||
503 | 357 | odhq_analytic_journal_id = aaj_obj.get_correction_analytic_journal(cr, uid, corr_type='hq', context=context) | ||
504 | 358 | if not odhq_analytic_journal_id: | ||
505 | 359 | raise osv.except_osv(_('Error'), _('No "correction HQ" analytic journal found!')) | ||
506 | 360 | seqnum = ir_seq_obj.get_id(cr, uid, gl_correction_odhq_journal_rec.sequence_id.id, context=seq_num_ctx) | ||
507 | 361 | entry_seq = "%s-%s-%s" % (move_prefix, gl_correction_odhq_journal_rec.code, seqnum) | ||
508 | 362 | corr_j = odhq_analytic_journal_id | ||
509 | 356 | else: | 363 | else: |
510 | 357 | # compute entry sequence | 364 | # compute entry sequence |
512 | 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) |
513 | 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) |
515 | 360 | corr_j = correction_journal_id | 367 | corr_j = od_analytic_journal_id |
516 | 361 | 368 | ||
517 | 362 | # First reverse line | 369 | # First reverse line |
518 | 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) |
519 | 364 | 371 | ||
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 | 28 | The file should be in XML 2003 format. | 28 | The file should be in XML 2003 format. |
525 | 29 | 29 | ||
526 | 30 | The columns should be in this values: """) | 30 | The columns should be in this values: """) |
528 | 31 | # Authorized analytic journal in Accounting import | 31 | # Authorized journals in Accounting import |
529 | 32 | ACCOUNTING_IMPORT_JOURNALS = [ | 32 | ACCOUNTING_IMPORT_JOURNALS = [ |
530 | 33 | 'intermission', | 33 | 'intermission', |
532 | 34 | 'correction', | 34 | 'correction_manual', |
533 | 35 | 'hr', | 35 | 'hr', |
534 | 36 | 'migration', | 36 | 'migration', |
535 | 37 | 'sale', # US-70/3 | 37 | 'sale', # US-70/3 |
536 | 38 | 38 | ||
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 | 358 | money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit | 358 | money[(booking_curr, period_name, r_document_date)]['credit'] += book_credit |
542 | 359 | r_credit = book_credit | 359 | r_credit = book_credit |
543 | 360 | 360 | ||
545 | 361 | # Check which journal it is to be posted to: should be of type OD, MIG or INT | 361 | # Check the journal code which must match with one of the journal types listed in ACCOUNTING_IMPORT_JOURNALS |
546 | 362 | if not line[cols['Journal Code']]: | 362 | if not line[cols['Journal Code']]: |
547 | 363 | errors.append(_('Line %s. No Journal Code specified') % (current_line_num,)) | 363 | errors.append(_('Line %s. No Journal Code specified') % (current_line_num,)) |
548 | 364 | continue | 364 | continue |
549 | 365 | 365 | ||
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 | 477 | <field name="method">us_6768_trigger_FP_sync</field> | 477 | <field name="method">us_6768_trigger_FP_sync</field> |
555 | 478 | </record> | 478 | </record> |
556 | 479 | 479 | ||
557 | 480 | <<<<<<< TREE | ||
558 | 480 | <!-- UF15.1 --> | 481 | <!-- UF15.1 --> |
559 | 481 | <record id="us_6930_gen_unreconcile" model="patch.scripts"> | 482 | <record id="us_6930_gen_unreconcile" model="patch.scripts"> |
560 | 482 | <field name="method">us_6930_gen_unreconcile</field> | 483 | <field name="method">us_6930_gen_unreconcile</field> |
561 | @@ -490,5 +491,12 @@ | |||
562 | 490 | <field name="method">rec_entries_uf14_1_uf15</field> | 491 | <field name="method">rec_entries_uf14_1_uf15</field> |
563 | 491 | </record> | 492 | </record> |
564 | 492 | 493 | ||
565 | 494 | ======= | ||
566 | 495 | <!-- UF16.0 --> | ||
567 | 496 | <record id="us_6692_new_od_journals" model="patch.scripts"> | ||
568 | 497 | <field name="method">us_6692_new_od_journals</field> | ||
569 | 498 | </record> | ||
570 | 499 | |||
571 | 500 | >>>>>>> MERGE-SOURCE | ||
572 | 493 | </data> | 501 | </data> |
573 | 494 | </openerp> | 502 | </openerp> |
574 | 495 | 503 | ||
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 | 42164 | msgid "Field Information" | 42164 | msgid "Field Information" |
580 | 42165 | msgstr "Information Champ " | 42165 | msgstr "Information Champ " |
581 | 42166 | 42166 | ||
583 | 42167 | #. modules: account_corrections, account_hq_entries | 42167 | #. module: account_corrections |
584 | 42168 | #: code:addons/account_corrections/account_move_line.py:499 | 42168 | #: code:addons/account_corrections/account_move_line.py:499 |
585 | 42169 | #: code:addons/account_corrections/account_move_line.py:707 | 42169 | #: code:addons/account_corrections/account_move_line.py:707 |
586 | 42170 | #: code:addons/account_corrections/account_move_line.py:855 | 42170 | #: code:addons/account_corrections/account_move_line.py:855 |
587 | 42171 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:261 | ||
588 | 42172 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:340 | ||
589 | 42173 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:542 | ||
590 | 42174 | #, python-format | 42171 | #, python-format |
591 | 42175 | msgid "No correction journal found!" | 42172 | msgid "No correction journal found!" |
592 | 42176 | msgstr "Le système n'a pas trouvé de Journal des corrections !" | 42173 | msgstr "Le système n'a pas trouvé de Journal des corrections !" |
593 | @@ -91142,7 +91139,13 @@ | |||
594 | 91142 | #: code:addons/analytic_distribution/analytic_line.py:288 | 91139 | #: code:addons/analytic_distribution/analytic_line.py:288 |
595 | 91143 | #, python-format | 91140 | #, python-format |
596 | 91144 | msgid "No analytic journal found for corrections!" | 91141 | msgid "No analytic journal found for corrections!" |
598 | 91145 | msgstr "No analytic journal found for corrections!" | 91142 | msgstr "Pas de journal analytique trouvé pour les corrections !" |
599 | 91143 | |||
600 | 91144 | #. module: account_corrections | ||
601 | 91145 | #: code:addons/account_corrections/wizard/analytic_distribution_wizard.py:198 | ||
602 | 91146 | #, python-format | ||
603 | 91147 | msgid "No journal found for corrections!" | ||
604 | 91148 | msgstr "Pas de journal trouvé pour les corrections !" | ||
605 | 91146 | 91149 | ||
606 | 91147 | #. module: stock | 91150 | #. module: stock |
607 | 91148 | #: selection:physical.inventory.select.products,second_filter:0 | 91151 | #: selection:physical.inventory.select.products,second_filter:0 |
608 | @@ -100290,13 +100293,6 @@ | |||
609 | 100290 | msgstr "Aucun journal HQ trouvé!" | 100293 | msgstr "Aucun journal HQ trouvé!" |
610 | 100291 | 100294 | ||
611 | 100292 | #. module: account_hq_entries | 100295 | #. module: account_hq_entries |
612 | 100293 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:343 | ||
613 | 100294 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:506 | ||
614 | 100295 | #, python-format | ||
615 | 100296 | msgid "No analytic correction journal found!" | ||
616 | 100297 | msgstr "Aucun Journal Analytique de correction n'a été trouvé!" | ||
617 | 100298 | |||
618 | 100299 | #. module: account_hq_entries | ||
619 | 100300 | #: code:addons/account_hq_entries/hq_entries.py:311 | 100296 | #: code:addons/account_hq_entries/hq_entries.py:311 |
620 | 100301 | #, python-format | 100297 | #, python-format |
621 | 100302 | msgid "No line found!" | 100298 | msgid "No line found!" |
622 | @@ -106586,3 +106582,98 @@ | |||
623 | 106586 | msgid "Funding Pool not found." | 106582 | msgid "Funding Pool not found." |
624 | 106587 | msgstr "Funding Pool non trouvé." | 106583 | msgstr "Funding Pool non trouvé." |
625 | 106588 | 106584 | ||
626 | 106585 | #. modules: account_override, account, register_accounting, msf_instance, finance | ||
627 | 106586 | #: selection:account.analytic.journal,type:0 | ||
628 | 106587 | #: selection:account.journal,type:0 | ||
629 | 106588 | #: selection:account.analytic.line,journal_type:0 | ||
630 | 106589 | #: selection:account.move,journal_type:0 | ||
631 | 106590 | #: selection:account.move.line,journal_type:0 | ||
632 | 106591 | #: selection:cash.request.liquidity,type:0 | ||
633 | 106592 | #: selection:cash.request.liquidity.bank,type:0 | ||
634 | 106593 | #: selection:cash.request.liquidity.cash,type:0 | ||
635 | 106594 | #: selection:cash.request.liquidity.cheque,type:0 | ||
636 | 106595 | #: selection:account.analytic.journal.fake,type:0 | ||
637 | 106596 | #: selection:account.journal.fake,type:0 | ||
638 | 106597 | #: selection:wizard.register.opening.confirmation,register_type:0 | ||
639 | 106598 | msgid "Correction Auto" | ||
640 | 106599 | msgstr "Correction Auto" | ||
641 | 106600 | |||
642 | 106601 | #. modules: account_override, account, register_accounting, msf_instance, finance | ||
643 | 106602 | #: selection:account.analytic.journal,type:0 | ||
644 | 106603 | #: selection:account.journal,type:0 | ||
645 | 106604 | #: selection:account.analytic.line,journal_type:0 | ||
646 | 106605 | #: selection:account.move,journal_type:0 | ||
647 | 106606 | #: selection:account.move.line,journal_type:0 | ||
648 | 106607 | #: selection:cash.request.liquidity,type:0 | ||
649 | 106608 | #: selection:cash.request.liquidity.bank,type:0 | ||
650 | 106609 | #: selection:cash.request.liquidity.cash,type:0 | ||
651 | 106610 | #: selection:cash.request.liquidity.cheque,type:0 | ||
652 | 106611 | #: selection:account.analytic.journal.fake,type:0 | ||
653 | 106612 | #: selection:account.journal.fake,type:0 | ||
654 | 106613 | #: selection:wizard.register.opening.confirmation,register_type:0 | ||
655 | 106614 | msgid "Correction Manual" | ||
656 | 106615 | msgstr "Correction Manuelle" | ||
657 | 106616 | |||
658 | 106617 | #. modules: account_override, account, register_accounting, msf_instance, finance | ||
659 | 106618 | #: selection:account.analytic.journal,type:0 | ||
660 | 106619 | #: selection:account.journal,type:0 | ||
661 | 106620 | #: selection:account.analytic.line,journal_type:0 | ||
662 | 106621 | #: selection:account.move,journal_type:0 | ||
663 | 106622 | #: selection:account.move.line,journal_type:0 | ||
664 | 106623 | #: selection:cash.request.liquidity,type:0 | ||
665 | 106624 | #: selection:cash.request.liquidity.bank,type:0 | ||
666 | 106625 | #: selection:cash.request.liquidity.cash,type:0 | ||
667 | 106626 | #: selection:cash.request.liquidity.cheque,type:0 | ||
668 | 106627 | #: selection:account.analytic.journal.fake,type:0 | ||
669 | 106628 | #: selection:account.journal.fake,type:0 | ||
670 | 106629 | #: selection:wizard.register.opening.confirmation,register_type:0 | ||
671 | 106630 | msgid "Correction HQ" | ||
672 | 106631 | msgstr "Correction HQ" | ||
673 | 106632 | |||
674 | 106633 | #. module: account_journal | ||
675 | 106634 | #: constraint:account.journal:0 | ||
676 | 106635 | msgid "The analytic journal selected must have the same type and prop. instance as this journal." | ||
677 | 106636 | msgstr "Le journal analytique sélectionné doit avoir le même type et la même instance prop. que ce journal." | ||
678 | 106637 | |||
679 | 106638 | #. module: account_journal | ||
680 | 106639 | #: constraint:account.journal:0 | ||
681 | 106640 | msgid "A journal with this type already exists for this instance." | ||
682 | 106641 | msgstr "Un journal de ce type existe déjà pour cette instance." | ||
683 | 106642 | |||
684 | 106643 | #. module: account | ||
685 | 106644 | #: constraint:account.analytic.journal:0 | ||
686 | 106645 | msgid "An analytic journal with this type already exists for this instance." | ||
687 | 106646 | msgstr "Un journal analytique de ce type existe déjà pour cette instance." | ||
688 | 106647 | |||
689 | 106648 | #. module: account_journal | ||
690 | 106649 | #: constraint:account.journal:0 | ||
691 | 106650 | msgid "The prop. instance of the \"Correction HQ\" journal must be a coordination." | ||
692 | 106651 | msgstr "L'instance prop. du journal de type \"Correction HQ\" doit être une coordination." | ||
693 | 106652 | |||
694 | 106653 | #. module: account | ||
695 | 106654 | #: constraint:account.analytic.journal:0 | ||
696 | 106655 | msgid "The prop. instance of the \"Correction HQ\" analytic journal must be a coordination." | ||
697 | 106656 | msgstr "L'instance prop. du journal analytique de type \"Correction HQ\" doit être une coordination." | ||
698 | 106657 | |||
699 | 106658 | #. module: account_override | ||
700 | 106659 | #: code:addons/account_override/account.py:1198 | ||
701 | 106660 | #, python-format | ||
702 | 106661 | msgid "The journal %s is forbidden in manual entries." | ||
703 | 106662 | msgstr "Le journal %s est interdit dans les écritures manuelles." | ||
704 | 106663 | |||
705 | 106664 | #. modules: account_hq_entries, account_corrections, analytic_distribution | ||
706 | 106665 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:269 | ||
707 | 106666 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:568 | ||
708 | 106667 | #: code:addons/account_corrections/account_move_line.py:731 | ||
709 | 106668 | #: code:addons/analytic_distribution/analytic_line.py:354 | ||
710 | 106669 | #, python-format | ||
711 | 106670 | msgid "No \"correction HQ\" journal found!" | ||
712 | 106671 | msgstr "Aucun journal de type \"correction HQ\" n'a été trouvé !" | ||
713 | 106672 | |||
714 | 106673 | #. modules: account_hq_entries, analytic_distribution | ||
715 | 106674 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:350 | ||
716 | 106675 | #: code:addons/account_hq_entries/wizard/hq_entries_validation.py:531 | ||
717 | 106676 | #: code:addons/analytic_distribution/analytic_line.py:359 | ||
718 | 106677 | #, python-format | ||
719 | 106678 | msgid "No \"correction HQ\" analytic journal found!" | ||
720 | 106679 | msgstr "Aucun journal analytique de type \"correction HQ\" n'a été trouvé !" | ||
721 | 106589 | 106680 | ||
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 | 52 | 'model': lambda *a: 'patch.scripts', | 52 | 'model': lambda *a: 'patch.scripts', |
727 | 53 | } | 53 | } |
728 | 54 | 54 | ||
729 | 55 | <<<<<<< TREE | ||
730 | 55 | # UF15.2 | 56 | # UF15.2 |
731 | 56 | def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b): | 57 | def rec_entries_uf14_1_uf15(self, cr, uid, *a, **b): |
732 | 57 | current_instance = self.pool.get('res.users').browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id | 58 | 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 | 130 | 131 | ||
735 | 131 | return True | 132 | return True |
736 | 132 | 133 | ||
737 | 134 | ======= | ||
738 | 135 | # UF16.0 | ||
739 | 136 | def us_6692_new_od_journals(self, cr, uid, *a, **b): | ||
740 | 137 | """ | ||
741 | 138 | 1. Change the type of the existing correction journals (except OD) to "Correction Manual" so they remain usable | ||
742 | 139 | |||
743 | 140 | 2. Create: | ||
744 | 141 | - ODM journals in all existing instances | ||
745 | 142 | - ODHQ journals in existing coordo instances | ||
746 | 143 | |||
747 | 144 | Notes: | ||
748 | 145 | - creations are done in Python as the objects created must sync normally | ||
749 | 146 | - none of these journals already exists in prod. DB. | ||
750 | 147 | """ | ||
751 | 148 | user_obj = self.pool.get('res.users') | ||
752 | 149 | analytic_journal_obj = self.pool.get('account.analytic.journal') | ||
753 | 150 | journal_obj = self.pool.get('account.journal') | ||
754 | 151 | current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id | ||
755 | 152 | if current_instance: # existing instances only | ||
756 | 153 | # existing correction journals | ||
757 | 154 | cr.execute(""" | ||
758 | 155 | UPDATE account_analytic_journal | ||
759 | 156 | SET type = 'correction_manual' | ||
760 | 157 | WHERE type = 'correction' | ||
761 | 158 | AND code != 'OD'; | ||
762 | 159 | """) | ||
763 | 160 | self._logger.warn('%s correction analytic journal(s) updated.' % (cr.rowcount,)) | ||
764 | 161 | cr.execute(""" | ||
765 | 162 | UPDATE account_journal | ||
766 | 163 | SET type = 'correction_manual' | ||
767 | 164 | WHERE type = 'correction' | ||
768 | 165 | AND code != 'OD'; | ||
769 | 166 | """) | ||
770 | 167 | self._logger.warn('%s correction journal(s) updated.' % (cr.rowcount,)) | ||
771 | 168 | # ODM analytic journal | ||
772 | 169 | odm_analytic_vals = { | ||
773 | 170 | # Prop. Instance: by default the current one is used | ||
774 | 171 | 'code': 'ODM', | ||
775 | 172 | 'name': 'Correction manual', | ||
776 | 173 | 'type': 'correction_manual', | ||
777 | 174 | } | ||
778 | 175 | odm_analytic_journal_id = analytic_journal_obj.create(cr, uid, odm_analytic_vals) | ||
779 | 176 | # ODM G/L journal | ||
780 | 177 | odm_vals = { | ||
781 | 178 | # Prop. Instance: by default the current one is used | ||
782 | 179 | 'code': 'ODM', | ||
783 | 180 | 'name': 'Correction manual', | ||
784 | 181 | 'type': 'correction_manual', | ||
785 | 182 | 'analytic_journal_id': odm_analytic_journal_id, | ||
786 | 183 | } | ||
787 | 184 | journal_obj.create(cr, uid, odm_vals) | ||
788 | 185 | if current_instance.level == 'coordo': | ||
789 | 186 | # ODHQ analytic journal | ||
790 | 187 | odhq_analytic_vals = { | ||
791 | 188 | # Prop. Instance: by default the current one is used | ||
792 | 189 | 'code': 'ODHQ', | ||
793 | 190 | 'name': 'Correction automatic HQ', | ||
794 | 191 | 'type': 'correction_hq', | ||
795 | 192 | } | ||
796 | 193 | odhq_analytic_journal_id = analytic_journal_obj.create(cr, uid, odhq_analytic_vals) | ||
797 | 194 | # ODHQ G/L journal | ||
798 | 195 | odhq_vals = { | ||
799 | 196 | # Prop. Instance: by default the current one is used | ||
800 | 197 | 'code': 'ODHQ', | ||
801 | 198 | 'name': 'Correction automatic HQ', | ||
802 | 199 | 'type': 'correction_hq', | ||
803 | 200 | 'analytic_journal_id': odhq_analytic_journal_id, | ||
804 | 201 | } | ||
805 | 202 | journal_obj.create(cr, uid, odhq_vals) | ||
806 | 203 | return True | ||
807 | 204 | |||
808 | 205 | >>>>>>> MERGE-SOURCE | ||
809 | 133 | # UF15.0 | 206 | # UF15.0 |
810 | 134 | def us_6768_trigger_FP_sync(self, cr, uid, *a, **b): | 207 | def us_6768_trigger_FP_sync(self, cr, uid, *a, **b): |
811 | 135 | """ | 208 | """ |
812 | 136 | 209 | ||
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 | 31 | 'init_xml': [], | 31 | 'init_xml': [], |
818 | 32 | 'data': [ | 32 | 'data': [ |
819 | 33 | 'data/res.partner.csv', | 33 | 'data/res.partner.csv', |
820 | 34 | 'data/account.analytic.journal.csv', | ||
821 | 35 | 'data/account.journal.csv', | ||
822 | 34 | ], | 36 | ], |
823 | 35 | 'demo_xml': [], | 37 | 'demo_xml': [], |
824 | 36 | 'test':[], | 38 | 'test':[], |
825 | 37 | 39 | ||
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 | 1 | active,code,name,type | ||
831 | 2 | TRUE,ODHQ,Correction automatic HQ,correction_hq | ||
832 | 0 | 3 | ||
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 | 1 | code,currency,default_credit_account_id,default_debit_account_id,name,type,analytic_journal_id | ||
838 | 2 | ODHQ,,,,Correction automatic HQ,correction_hq,Correction automatic HQ | ||
839 | 0 | 3 | ||
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 | 4 | TRUE,SAL,Sales,sale | 4 | TRUE,SAL,Sales,sale |
845 | 5 | TRUE,SAR,Sales Refund,sale | 5 | TRUE,SAR,Sales Refund,sale |
846 | 6 | TRUE,OD,Corrections,correction | 6 | TRUE,OD,Corrections,correction |
847 | 7 | TRUE,ODM,Correction manual,correction_manual | ||
848 | 7 | TRUE,HQ,Headquarters,hq | 8 | TRUE,HQ,Headquarters,hq |
849 | 8 | TRUE,HR,Human Resources,hr | 9 | TRUE,HR,Human Resources,hr |
850 | 9 | TRUE,ENG,Engagement,engagement | 10 | TRUE,ENG,Engagement,engagement |
851 | 10 | 11 | ||
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 | 4 | HR,,,,Human Resources,hr,Human Resources | 4 | HR,,,,Human Resources,hr,Human Resources |
857 | 5 | FXA,,67040,67040,FX adjustment,cur_adj,FX adjustment | 5 | FXA,,67040,67040,FX adjustment,cur_adj,FX adjustment |
858 | 6 | OD,,,,Corrections,correction,Corrections | 6 | OD,,,,Corrections,correction,Corrections |
859 | 7 | ODM,,,,Correction manual,correction_manual,Correction manual | ||
860 | 7 | PUR,,,,Purchase,purchase,Purchase | 8 | PUR,,,,Purchase,purchase,Purchase |
861 | 8 | PUF,,,,Purchase Refund,purchase_refund,Purchase Refund | 9 | PUF,,,,Purchase Refund,purchase_refund,Purchase Refund |
862 | 9 | SAL,,,,Sales,sale,Sales | 10 | SAL,,,,Sales,sale,Sales |
863 | 10 | 11 | ||
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 | 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. |
869 | 550 | 'rawdata': """ | 550 | 'rawdata': """ |
870 | 551 | SELECT al.id, i.code, | 551 | SELECT al.id, i.code, |
872 | 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, |
873 | 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, |
874 | 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, |
875 | 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, |
876 | 556 | 556 | ||
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 | 63 | """ | 63 | """ |
882 | 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) |
883 | 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) |
885 | 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: |
886 | 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) |
887 | 68 | - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry | 68 | - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry |
888 | 69 | Returns a list of tuples (same format as data) | 69 | Returns a list of tuples (same format as data) |
889 | @@ -80,7 +80,7 @@ | |||
890 | 80 | line_list = list(line) | 80 | line_list = list(line) |
891 | 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]) |
892 | 82 | od_hq_entry = False | 82 | od_hq_entry = False |
894 | 83 | if line_list[journal] == 'OD': | 83 | if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692 |
895 | 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']) |
896 | 85 | corrected_aml = aml.corrected_line_id | 85 | corrected_aml = aml.corrected_line_id |
897 | 86 | reversed_aml = aml.reversal_line_id | 86 | reversed_aml = aml.reversal_line_id |
898 | @@ -107,7 +107,7 @@ | |||
899 | 107 | """ | 107 | """ |
900 | 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) |
901 | 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) |
903 | 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: |
904 | 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) |
905 | 112 | - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry | 112 | - journal: the journal name corresponds to the 9-to-11 characters of the reference field of the original HQ entry |
906 | 113 | Returns a list of tuples (same format as data) | 113 | Returns a list of tuples (same format as data) |
907 | @@ -124,7 +124,7 @@ | |||
908 | 124 | line_list = list(line) | 124 | line_list = list(line) |
909 | 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]) |
910 | 126 | od_hq_entry = False | 126 | od_hq_entry = False |
912 | 127 | if line_list[journal] == 'OD': | 127 | if line_list[journal] in ('OD', 'ODHQ'): # 'OD' for entries before US-6692 |
913 | 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']) |
914 | 129 | corrected_aal = aal.last_corrected_id | 129 | corrected_aal = aal.last_corrected_id |
915 | 130 | reversed_aal = aal.reversal_origin | 130 | reversed_aal = aal.reversal_origin |
916 | @@ -151,7 +151,7 @@ | |||
917 | 151 | """ | 151 | """ |
918 | 152 | ##### WARNING ##### | 152 | ##### WARNING ##### |
919 | 153 | ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ### | 153 | ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ### |
921 | 154 | - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections | 154 | - first modify the data for all lines corresponding to entries originating from HQ entry corrections |
922 | 155 | - then call OCB method on the new data to change first column for the DB ID | 155 | - then call OCB method on the new data to change first column for the DB ID |
923 | 156 | """ | 156 | """ |
924 | 157 | new_data = self._handle_od_ji_entries(cr, uid, data) # we handle account move lines | 157 | new_data = self._handle_od_ji_entries(cr, uid, data) # we handle account move lines |
925 | @@ -162,7 +162,7 @@ | |||
926 | 162 | """ | 162 | """ |
927 | 163 | ##### WARNING ##### | 163 | ##### WARNING ##### |
928 | 164 | ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ### | 164 | ### THIS CALLS THE METHOD postprocess_add_db_id FROM OCB ### |
930 | 165 | - first modify the data for all lines corresponding to OD entries originating from HQ entry corrections | 165 | - first modify the data for all lines corresponding to entries originating from HQ entry corrections |
931 | 166 | - then call OCB method on the new data to change first column for the DB ID | 166 | - then call OCB method on the new data to change first column for the DB ID |
932 | 167 | """ | 167 | """ |
933 | 168 | new_data = self._handle_od_aji_entries(cr, uid, data) # we handle account analytic lines | 168 | new_data = self._handle_od_aji_entries(cr, uid, data) # we handle account analytic lines |
934 | @@ -341,7 +341,7 @@ | |||
935 | 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. |
936 | 342 | 'rawdata': """ | 342 | 'rawdata': """ |
937 | 343 | SELECT al.id, SUBSTR(i.code, 1, 3), | 343 | SELECT al.id, SUBSTR(i.code, 1, 3), |
939 | 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, |
940 | 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, |
941 | 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, |
942 | 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, |
943 | @@ -350,7 +350,7 @@ | |||
944 | 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, |
945 | 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, |
946 | 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, |
948 | 353 | CASE WHEN j.code = 'OD' THEN j.type ELSE aj.type END AS journal_type | 353 | CASE WHEN j.code IN ('OD', 'ODHQ') THEN j.type ELSE aj.type END AS journal_type |
949 | 354 | FROM account_analytic_line AS al, | 354 | FROM account_analytic_line AS al, |
950 | 355 | account_account AS a, | 355 | account_account AS a, |
951 | 356 | account_analytic_account AS aa, | 356 | account_analytic_account AS aa, |