Merge lp:~unifield-team/unifield-wm/us-887 into lp:unifield-wm
- us-887
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 2758 |
Proposed branch: | lp:~unifield-team/unifield-wm/us-887 |
Merge into: | lp:unifield-wm |
Diff against target: |
487 lines (+112/-72) 9 files modified
account_journal/account_journal.py (+5/-2) account_mcdb/account_mcdb.py (+2/-2) account_mcdb/account_view.xml (+6/-6) account_override/account.py (+1/-1) account_period_closing_level/account_period.py (+5/-3) account_period_closing_level/account_year_end_closing.py (+26/-31) msf_accrual/msf_accrual_line.py (+1/-1) msf_instance/add_instance.py (+22/-1) vertical_integration/report/hq_report_ocb.py (+44/-25) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-wm/us-887 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+285318@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 'account_journal/account_journal.py' |
2 | --- account_journal/account_journal.py 2016-01-29 13:48:03 +0000 |
3 | +++ account_journal/account_journal.py 2016-02-08 10:52:01 +0000 |
4 | @@ -297,8 +297,11 @@ |
5 | |
6 | #BKLG-53 get the next draft period from today |
7 | current_date = datetime.date.today().strftime('%Y-%m-%d') |
8 | - periods = self.pool.get('account.period').search(cr, uid, [('date_stop','>=',current_date),('state','=','draft')], |
9 | - context=context, limit=1, order='date_stop') |
10 | + periods = self.pool.get('account.period').search(cr, uid, [ |
11 | + ('date_stop','>=',current_date), |
12 | + ('state','=','draft'), |
13 | + ('special', '=', False), |
14 | + ], context=context, limit=1, order='date_stop') |
15 | if not periods: |
16 | raise osv.except_osv(_('Warning'), _('Sorry, No open period for creating the register!')) |
17 | self.pool.get('account.bank.statement') \ |
18 | |
19 | === modified file 'account_mcdb/account_mcdb.py' |
20 | --- account_mcdb/account_mcdb.py 2015-06-17 08:52:51 +0000 |
21 | +++ account_mcdb/account_mcdb.py 2016-02-08 10:52:01 +0000 |
22 | @@ -31,7 +31,7 @@ |
23 | |
24 | _columns = { |
25 | 'description': fields.char("Query name", required=False, readonly=False, size=255), |
26 | - 'journal_ids': fields.many2many(obj='account.journal', rel='account_journal_mcdb', id1='mcdb_id', id2='journal_id', string="Journal Code"), |
27 | + 'journal_ids': fields.many2many(obj='account.journal', rel='account_journal_mcdb', id1='mcdb_id', id2='journal_id', string="Journal Code", domain="[('code', '!=', 'IB')]"), # exclude year closing initial balance journal |
28 | 'instance_ids': fields.many2many('msf.instance', 'instance_mcdb', 'mcdb_id', 'instance_id', string="Proprietary instance"), |
29 | 'analytic_journal_ids': fields.many2many(obj='account.analytic.journal', rel='account_analytic_journal_mcdb', id1='mcdb_id', id2='analytic_journal_id', string="Analytic journal code"), |
30 | 'abs_id': fields.many2one('account.bank.statement', string="Register name"), # Change into many2many ? |
31 | @@ -45,7 +45,7 @@ |
32 | 'account_ids': fields.many2many(obj='account.account', rel='account_account_mcdb', id1='mcdb_id', id2='account_id', string="Account Code"), |
33 | 'partner_id': fields.many2one('res.partner', string="Partner"), |
34 | 'employee_id': fields.many2one('hr.employee', string="Employee"), |
35 | - 'transfer_journal_id': fields.many2one('account.journal', string="Journal"), |
36 | + 'transfer_journal_id': fields.many2one('account.journal', string="Journal", domain="[('code', '!=', 'IB')]"), # exclude year closing initial balance journal |
37 | 'reconciled': fields.selection([('reconciled', 'Reconciled'), ('unreconciled', 'NOT reconciled')], string='Reconciled?'), |
38 | 'functional_currency_id': fields.many2one('res.currency', string="Functional currency", readonly=True), |
39 | 'amount_func_from': fields.float('Begin amount in functional currency'), |
40 | |
41 | === modified file 'account_mcdb/account_view.xml' |
42 | --- account_mcdb/account_view.xml 2016-01-22 13:35:15 +0000 |
43 | +++ account_mcdb/account_view.xml 2016-02-08 10:52:01 +0000 |
44 | @@ -160,7 +160,7 @@ |
45 | <group> |
46 | <field name="partner_id" select='1' string="3RD Party Partner"/> |
47 | <field name="employee_id" select='1' string="3RD Party Employee"/> |
48 | - <field name="transfer_journal_id" select='1' string="3RD Party Journal"/> |
49 | + <field name="transfer_journal_id" select='1' string="3RD Party Journal" context="{'exclude_journals': ['IB']}"/> |
50 | <field name="is_reconciled" select='1'/> |
51 | <field name="reconcile_total_partial_id" select='1'/> |
52 | <newline/> |
53 | @@ -168,7 +168,7 @@ |
54 | <newline/> |
55 | <group> |
56 | <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/> |
57 | - <field name="journal_id_fake" context="{'journal_id':self, 'visible_id':self, 'normal_view':False}"/> |
58 | + <field name="journal_id_fake" context="{'journal_id':self, 'visible_id':self, 'normal_view':False, 'exclude_journals': ['IB']}"/> |
59 | <field name="journal_type"/> |
60 | </group> |
61 | <newline/> |
62 | @@ -184,7 +184,7 @@ |
63 | <group expand="0" string="Group By..." colspan="4" col="20"> |
64 | <filter string="3rd party Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> |
65 | <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/> |
66 | - <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id'}"/> |
67 | + <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id', 'exclude_journals': ['IB']}"/> |
68 | <separator orientation="vertical"/> |
69 | <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/> |
70 | <filter string="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/> |
71 | @@ -386,12 +386,12 @@ |
72 | <group col='8' colspan='4'> |
73 | <field name="partner_id" select="1" string="3RD Party Partner"/> |
74 | <field name="employee_id" select="1" string="3RD Party Employee"/> |
75 | - <field name="transfer_journal_id" select="1" string="3RD Party Journal"/> |
76 | + <field name="transfer_journal_id" select="1" string="3RD Party Journal" context="{'exclude_journals': ['IB']}"/> |
77 | </group> |
78 | <newline/> |
79 | <group col='8' colspan='4'> |
80 | <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/> |
81 | - <field name="journal_id_fake"/> |
82 | + <field name="journal_id_fake" context="{'exclude_journals': ['IB']}" /> |
83 | <field name="journal_type"/> |
84 | </group> |
85 | <newline/> |
86 | @@ -400,7 +400,7 @@ |
87 | <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/> |
88 | <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id'}"/> |
89 | <separator orientation="vertical"/> |
90 | - <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/> |
91 | + <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id', 'exclude_journals': ['IB']}"/> |
92 | <filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> |
93 | <separator orientation="vertical"/> |
94 | <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/> |
95 | |
96 | === modified file 'account_override/account.py' |
97 | --- account_override/account.py 2016-01-29 11:15:41 +0000 |
98 | +++ account_override/account.py 2016-02-08 10:52:01 +0000 |
99 | @@ -527,7 +527,7 @@ |
100 | 'ref': fields.char('Reference', size=64, readonly=True, states={'draft':[('readonly',False)]}), |
101 | 'status': fields.selection([('sys', 'system'), ('manu', 'manual')], string="Status", required=True), |
102 | 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}, domain="[('state', '=', 'draft')]"), |
103 | - 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}, domain="[('type', 'not in', ['accrual', 'hq', 'inkind', 'cur_adj']), ('instance_filter', '=', True)]"), |
104 | + 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}, domain="[('type', 'not in', ['accrual', 'hq', 'inkind', 'cur_adj', 'system']), ('instance_filter', '=', True)]"), |
105 | 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"), |
106 | 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \ |
107 | help="This indicates which Journal Type is attached to this Journal Entry"), |
108 | |
109 | === modified file 'account_period_closing_level/account_period.py' |
110 | --- account_period_closing_level/account_period.py 2016-01-25 14:14:07 +0000 |
111 | +++ account_period_closing_level/account_period.py 2016-02-08 10:52:01 +0000 |
112 | @@ -150,7 +150,8 @@ |
113 | pp_ids = self.search( |
114 | cr, uid, |
115 | [('date_start', '<', period.date_start), |
116 | - ('fiscalyear_id', '=', period.fiscalyear_id.id)], |
117 | + ('fiscalyear_id', '=', period.fiscalyear_id.id), |
118 | + ('number', '>', 0), ('number', '<', 16)], |
119 | context=context) |
120 | for pp in self.browse(cr, uid, pp_ids, context=context): |
121 | if check_states.index(pp.state) <= check_states.index(period.state): |
122 | @@ -161,7 +162,8 @@ |
123 | np_ids = self.search( |
124 | cr, uid, |
125 | [('date_start', '>', period.date_start), |
126 | - ('fiscalyear_id', '=', period.fiscalyear_id.id)], |
127 | + ('fiscalyear_id', '=', period.fiscalyear_id.id), |
128 | + ('number', '>', 0), ('number', '<', 16)], |
129 | context=context) |
130 | for np in self.browse(cr, uid, np_ids, context=context): |
131 | if check_states.index(np.state) >= check_states.index(period.state): |
132 | @@ -290,7 +292,7 @@ |
133 | raise osv.except_osv(_('Error'), msg) |
134 | operator = 'in' if args[0][2] else 'not in' |
135 | |
136 | - return [('number', operator, (0, 16, ))] |
137 | + return [('number', operator, [0, 16, ])] |
138 | |
139 | _columns = { |
140 | 'name': fields.char('Period Name', size=64, required=True, translate=True), |
141 | |
142 | === modified file 'account_period_closing_level/account_year_end_closing.py' |
143 | --- account_period_closing_level/account_year_end_closing.py 2016-01-30 10:30:49 +0000 |
144 | +++ account_period_closing_level/account_year_end_closing.py 2016-02-08 10:52:01 +0000 |
145 | @@ -33,13 +33,16 @@ |
146 | _columns = { |
147 | # US-822 counterpart for BS account |
148 | 'ye_pl_cp_for_bs_debit_bal_account': fields.many2one('account.account', |
149 | - 'Counterpart for B/S debit balance'), |
150 | + 'Counterpart for B/S debit balance', |
151 | + domain=['|', ('user_type.code', 'in', ('income', 'expense', 'equity')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
152 | 'ye_pl_cp_for_bs_credit_bal_account': fields.many2one('account.account', |
153 | - 'Counterpart for B/S credit balance'), |
154 | + 'Counterpart for B/S credit balance', |
155 | + domain=['|', ('user_type.code', 'in', ('income', 'expense')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
156 | |
157 | # US-822 PL/BS matrix of dev2/dev3 accounts" |
158 | 'ye_pl_pos_credit_account': fields.many2one('account.account', |
159 | - 'Credit Account for P&L>0 (Income account)'), |
160 | + 'Credit Account for P&L>0 (Income account)', |
161 | + domain=[('user_type.code', '=', 'income')]), |
162 | 'ye_pl_pos_debit_account': fields.many2one('account.account', |
163 | 'Debit Account for P&L>0 (B/S account)', |
164 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
165 | @@ -47,7 +50,8 @@ |
166 | 'Credit Account P&L<0 (B/S account)', |
167 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
168 | 'ye_pl_ne_debit_account': fields.many2one('account.account', |
169 | - 'Debit Account P&L<0 (Expense account)'), |
170 | + 'Debit Account P&L<0 (Expense account)', |
171 | + domain=[('user_type.code', '=', 'expense')]), |
172 | } |
173 | |
174 | res_company() |
175 | @@ -325,8 +329,7 @@ |
176 | """ |
177 | create state valid JI in its CCY/JE |
178 | """ |
179 | - name = "EOY-%d-%s-%s-%s" % (fy_year, account_code, |
180 | - instance_rec.code, ccy_code, ) |
181 | + name = 'Balance move to 0' |
182 | |
183 | vals = { |
184 | 'account_id': account_id, |
185 | @@ -469,8 +472,7 @@ |
186 | """ |
187 | create state valid JI in its CCY/JE |
188 | """ |
189 | - name = self._book_pl_results_seqnum_pattern % (fy_year, |
190 | - instance_rec.code, cpy_rec.currency_id.name, ) |
191 | + name = 'P&L Result' |
192 | |
193 | vals = { |
194 | 'account_id': account_rec.id, |
195 | @@ -569,7 +571,7 @@ |
196 | """ |
197 | create draft CCY/JE to log JI into |
198 | """ |
199 | - name = "IB-%d-%s-%s-%s" % (fy_year, account_code, |
200 | + name = "IB-%d-%s-%s-%s" % (fy_year + 1, account_code, |
201 | instance_rec.code, ccy_code, ) |
202 | |
203 | vals = { |
204 | @@ -592,9 +594,7 @@ |
205 | """ |
206 | create state valid JI in its CCY/JE |
207 | """ |
208 | - if not name: |
209 | - name = "IB-%d-%s-%s-%s" % (fy_year, account_code, |
210 | - instance_rec.code, ccy_code, ) |
211 | + default_name = 'Balance report / Previous Fiscal Year' |
212 | |
213 | vals = { |
214 | 'account_id': account_id, |
215 | @@ -604,7 +604,7 @@ |
216 | 'document_date': posting_date, |
217 | 'instance_id': instance_rec.id, |
218 | 'journal_id': journal_id, |
219 | - 'name': name, |
220 | + 'name': name or default_name, |
221 | 'period_id': period_id, |
222 | 'source_date': posting_date, |
223 | |
224 | @@ -710,7 +710,6 @@ |
225 | if not cr.rowcount: |
226 | return |
227 | |
228 | - re_account_found_in_bs = False |
229 | je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id |
230 | for account_id, account_code, ccy_id, ccy_code, \ |
231 | balance_currency, balance in cr.fetchall(): |
232 | @@ -730,24 +729,20 @@ |
233 | account_id=account_id, account_code=account_code, |
234 | balance_currency=balance_currency, balance=balance, je_id=je_id) |
235 | |
236 | - if not re_account_found_in_bs: |
237 | - # Regular/Equity account result entry for P&L |
238 | - |
239 | - # invert balance amount to debit or credit amount after account dispatch |
240 | - pl_balance *= -1 |
241 | - |
242 | - je_id = je_by_acc_ccy.get( |
243 | - (re_account_rec.id, cpy_rec.currency_id.id, ), False) |
244 | - if not je_id: |
245 | - je_id = create_journal_entry(ccy_id=ccy_id, |
246 | - ccy_code=cpy_rec.currency_id.name, |
247 | - account_id=re_account_rec.id, |
248 | - account_code=re_account_rec.code) |
249 | - create_journal_item(ccy_id=cpy_rec.currency_id.id, |
250 | + # Regular/Equity account result entry for P&L |
251 | + # => invert balance amount to debit or credit amount after account dispatch |
252 | + je_id = je_by_acc_ccy.get( |
253 | + (re_account_rec.id, cpy_rec.currency_id.id, ), False) |
254 | + if not je_id: |
255 | + je_id = create_journal_entry(ccy_id=ccy_id, |
256 | ccy_code=cpy_rec.currency_id.name, |
257 | - account_id=re_account_rec.id, account_code=re_account_rec.code, |
258 | - balance_currency=pl_balance, balance=pl_balance, je_id=je_id, |
259 | - name="P&L Result report / Previous Fiscal Year") |
260 | + account_id=re_account_rec.id, |
261 | + account_code=re_account_rec.code) |
262 | + create_journal_item(ccy_id=cpy_rec.currency_id.id, |
263 | + ccy_code=cpy_rec.currency_id.name, |
264 | + account_id=re_account_rec.id, account_code=re_account_rec.code, |
265 | + balance_currency=pl_balance, balance=pl_balance, je_id=je_id, |
266 | + name="P&L Result report / Previous Fiscal Year") |
267 | |
268 | def update_fy_state(self, cr, uid, fy_id, reopen=False, context=None): |
269 | def hq_close_post_entries(period_ids): |
270 | |
271 | === modified file 'msf_accrual/msf_accrual_line.py' |
272 | --- msf_accrual/msf_accrual_line.py 2015-12-04 09:03:53 +0000 |
273 | +++ msf_accrual/msf_accrual_line.py 2016-02-08 10:52:01 +0000 |
274 | @@ -72,7 +72,7 @@ |
275 | _columns = { |
276 | 'date': fields.date("Date"), |
277 | 'document_date': fields.date("Document Date", required=True), |
278 | - 'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state', '=', 'draft')]), |
279 | + 'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state', '=', 'draft'), ('is_system', '=', False)]), |
280 | 'description': fields.char('Description', size=64, required=True), |
281 | 'reference': fields.char('Reference', size=64), |
282 | 'expense_account_id': fields.many2one('account.account', 'Expense Account', required=True, domain=[('type', '!=', 'view'), ('user_type_code', '=', 'expense')]), |
283 | |
284 | === modified file 'msf_instance/add_instance.py' |
285 | --- msf_instance/add_instance.py 2016-01-04 13:16:43 +0000 |
286 | +++ msf_instance/add_instance.py 2016-02-08 10:52:01 +0000 |
287 | @@ -192,10 +192,31 @@ |
288 | |
289 | ret = [] |
290 | for journal in self.read(cr, uid, ids, ['code', 'instance_id']): |
291 | + if context: |
292 | + exclude_journals = context.get('exclude_journals', False) |
293 | + if exclude_journals: |
294 | + if isinstance(exclude_journals, str): |
295 | + exclude_journals = [exclude_journals] |
296 | + if journal['code'] in exclude_journals: |
297 | + continue |
298 | ret.append((journal['id'], '%s / %s'%(journal['instance_id'] and journal['instance_id'][1] or '', journal['code']))) |
299 | - |
300 | return ret |
301 | |
302 | + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, |
303 | + count=False): |
304 | + if args is None: |
305 | + args = [] |
306 | + if context: |
307 | + exclude_journals = context.get('exclude_journals', False) |
308 | + if exclude_journals: |
309 | + if isinstance(exclude_journals, str): |
310 | + exclude_journals = [exclude_journals] |
311 | + args.append(('code', 'not in', exclude_journals)) |
312 | + res = super(account_journal_fake, self).search(cr, uid, args, |
313 | + offset=offset, limit=limit, order=order, context=context, |
314 | + count=count) |
315 | + return res |
316 | + |
317 | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): |
318 | return self.pool.get('account.journal').fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) |
319 | |
320 | |
321 | === modified file 'vertical_integration/report/hq_report_ocb.py' |
322 | --- vertical_integration/report/hq_report_ocb.py 2016-01-30 10:30:49 +0000 |
323 | +++ vertical_integration/report/hq_report_ocb.py 2016-02-08 10:52:01 +0000 |
324 | @@ -254,9 +254,7 @@ |
325 | period = pool.get('account.period').browse(cr, uid, period_id) |
326 | last_day_of_period = period.date_stop |
327 | first_day_of_period = period.date_start |
328 | - period_name = period.name |
329 | selection = form.get('selection', False) |
330 | - to_export = ['f'] # Default export value for exported field on analytic/move lines |
331 | tm = strptime(first_day_of_period, '%Y-%m-%d') |
332 | year_num = tm.tm_year |
333 | year = str(year_num) |
334 | @@ -264,6 +262,7 @@ |
335 | period_yyyymm = "{0}{1}".format(year,month) |
336 | if not selection: |
337 | raise osv.except_osv(_('Error'), _('No selection value for lines to select.')) |
338 | + # Default export value for exported field on analytic/move lines |
339 | if selection == 'all': |
340 | to_export = ['f', 't'] |
341 | elif selection == 'unexported': |
342 | @@ -274,10 +273,7 @@ |
343 | # US-822: if December is picked should: |
344 | # - include Period 16 action 2 Year end PL RESULT entries |
345 | # of target Coordo |
346 | - rawdata_tpl_context= { |
347 | - 'plres': '', |
348 | - 'plres2': '', |
349 | - } |
350 | + plresult_ji_in_ids = [] |
351 | if period.number == 12: |
352 | ayec_obj = pool.get("account.year.end.closing") |
353 | mi_obj = pool.get('msf.instance') |
354 | @@ -301,19 +297,9 @@ |
355 | je_ids = m_obj.search(cr, uid, [ ('name', 'in', seqnums) ], |
356 | context=context) |
357 | if je_ids: |
358 | - ji_ids = ml_obj.search(cr, uid, [ |
359 | + plresult_ji_in_ids = ml_obj.search(cr, uid, [ |
360 | ('move_id', 'in', je_ids) |
361 | ], context=context) |
362 | - if ji_ids: |
363 | - plresult_ji_in_ids = ','.join(map(str, ji_ids)) |
364 | - rawdata_tpl_context.update({ |
365 | - # pl result JIs clause (aml alias version) |
366 | - 'plres': ' or aml.id in (%s)' % ( |
367 | - plresult_ji_in_ids, ), |
368 | - # pl result JIs clause (aml2 alias version) |
369 | - 'plres2': ' or aml2.id in (%s)' % ( |
370 | - plresult_ji_in_ids, ), |
371 | - }) |
372 | |
373 | # Prepare SQL requests and PROCESS requests for finance_archive object |
374 | |
375 | @@ -458,7 +444,7 @@ |
376 | account_account AS a, |
377 | account_analytic_account AS aa, |
378 | account_analytic_account AS aa2, |
379 | - account_analytic_account AS aa3, |
380 | + account_analytic_account AS aa3, |
381 | res_currency AS c, |
382 | res_company AS e, |
383 | res_currency AS cc, |
384 | @@ -479,11 +465,11 @@ |
385 | from account_move_line aml2, account_move am, |
386 | account_period as p2 |
387 | where am.id = aml2.move_id and p2.id = am.period_id |
388 | - and ((p2.number not in (0, 16) and am.state = 'posted')$plres2) |
389 | + and p2.number not in (0, 16) and am.state = 'posted' |
390 | ) |
391 | AND al.instance_id = i.id |
392 | AND aml.journal_id = aj.id |
393 | - AND (aml.period_id = %s$plres) |
394 | + AND aml.period_id = %s |
395 | AND j.type not in %s |
396 | AND al.exported in %s |
397 | AND al.instance_id in %s; |
398 | @@ -494,7 +480,7 @@ |
399 | 'bs_entries_consolidated': """ |
400 | SELECT aml.id |
401 | FROM account_move_line AS aml, account_account AS aa, account_journal AS j |
402 | - WHERE (aml.period_id = %s$plres) |
403 | + WHERE aml.period_id = %s |
404 | AND aml.account_id = aa.id |
405 | AND aml.journal_id = j.id |
406 | AND j.type not in %s |
407 | @@ -529,7 +515,7 @@ |
408 | AND aml.journal_id = j.id |
409 | AND e.currency_id = cc.id |
410 | AND aml.instance_id = i.id |
411 | - AND (aml.period_id = %s$plres) |
412 | + AND aml.period_id = %s |
413 | AND a.shrink_entries_for_hq != 't' |
414 | AND j.type not in %s |
415 | AND aml.exported in %s |
416 | @@ -538,6 +524,30 @@ |
417 | ORDER BY aml.id; |
418 | """, |
419 | } |
420 | + if plresult_ji_in_ids: |
421 | + # NOTE: for these entries: booking and fonctional ccy are same |
422 | + ''' columns |
423 | + 'DB ID', 'Instance', 'Journal', 'Entry sequence', 'Description', |
424 | + 'Reference', 'Document date', 'Posting date', 'G/L Account', |
425 | + 'Third party', 'Destination', 'Cost centre', 'Funding pool', |
426 | + 'Booking debit', 'Booking credit', 'Booking currency', |
427 | + 'Functional debit', 'Functional credit', 'Functional CCY', |
428 | + 'Emplid', 'Partner DB ID' ''' |
429 | + sqlrequests['plresult'] = """ |
430 | + SELECT aml.id, i.code, j.code, m.name as "entry_sequence", aml.name, |
431 | + aml.ref, aml.document_date, aml.date, a.code, |
432 | + aml.partner_txt, '', '', '', |
433 | + ROUND(aml.debit_currency, 2), ROUND(aml.credit_currency, 2), c.name, |
434 | + ROUND(aml.debit, 2), ROUND(aml.credit, 2), c.name, |
435 | + '', '' |
436 | + FROM account_move_line aml |
437 | + INNER JOIN msf_instance i on i.id = aml.instance_id |
438 | + INNER JOIN account_journal j on j.id = aml.journal_id |
439 | + INNER JOIN account_move m on m.id = aml.move_id |
440 | + INNER JOIN account_account a on a.id = aml.account_id |
441 | + INNER JOIN res_currency c on c.id = aml.currency_id |
442 | + WHERE aml.id in %s AND aml.exported in %s |
443 | + """ |
444 | |
445 | # PROCESS REQUESTS LIST: list of dict containing info to process some SQL requests |
446 | # Dict: |
447 | @@ -612,7 +622,6 @@ |
448 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with |
449 | 'fnct_params': 'account.analytic.line', |
450 | 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)), |
451 | - 'query_tpl_context': rawdata_tpl_context, |
452 | 'delete_columns': [0], |
453 | 'id': 0, |
454 | 'object': 'account.analytic.line', |
455 | @@ -621,7 +630,6 @@ |
456 | 'filename': instance_name + '_' + year + month + '_Monthly Export.csv', |
457 | 'key': 'bs_entries_consolidated', |
458 | 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)), |
459 | - 'query_tpl_context': rawdata_tpl_context, |
460 | 'function': 'postprocess_consolidated_entries', |
461 | 'fnct_params': excluded_journal_types, |
462 | }, |
463 | @@ -631,12 +639,23 @@ |
464 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with |
465 | 'fnct_params': 'account.move.line', |
466 | 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)), |
467 | - 'query_tpl_context': rawdata_tpl_context, |
468 | 'delete_columns': [0], |
469 | 'id': 0, |
470 | 'object': 'account.move.line', |
471 | }, |
472 | ] |
473 | + if plresult_ji_in_ids: |
474 | + processrequests.append({ |
475 | + 'filename': instance_name + '_' + year + month + '_Monthly Export.csv', |
476 | + 'key': 'plresult', |
477 | + 'function': 'postprocess_add_db_id', # to take move line ids and make a DB ID with |
478 | + 'fnct_params': 'account.move.line', |
479 | + 'query_params': (tuple(plresult_ji_in_ids), tuple(to_export), ), |
480 | + 'delete_columns': [0], |
481 | + 'id': 0, |
482 | + 'object': 'account.move.line', |
483 | + }) |
484 | + |
485 | # Launch finance archive object |
486 | fe = finance_archive(sqlrequests, processrequests) |
487 | # Use archive method to create the archive |