Merge lp:~unifield-team/unifield-wm/us-887 into lp:unifield-wm

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
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+285318@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_journal/account_journal.py'
--- account_journal/account_journal.py 2016-01-29 13:48:03 +0000
+++ account_journal/account_journal.py 2016-02-08 10:52:01 +0000
@@ -297,8 +297,11 @@
297297
298 #BKLG-53 get the next draft period from today298 #BKLG-53 get the next draft period from today
299 current_date = datetime.date.today().strftime('%Y-%m-%d')299 current_date = datetime.date.today().strftime('%Y-%m-%d')
300 periods = self.pool.get('account.period').search(cr, uid, [('date_stop','>=',current_date),('state','=','draft')],300 periods = self.pool.get('account.period').search(cr, uid, [
301 context=context, limit=1, order='date_stop')301 ('date_stop','>=',current_date),
302 ('state','=','draft'),
303 ('special', '=', False),
304 ], context=context, limit=1, order='date_stop')
302 if not periods:305 if not periods:
303 raise osv.except_osv(_('Warning'), _('Sorry, No open period for creating the register!'))306 raise osv.except_osv(_('Warning'), _('Sorry, No open period for creating the register!'))
304 self.pool.get('account.bank.statement') \307 self.pool.get('account.bank.statement') \
305308
=== modified file 'account_mcdb/account_mcdb.py'
--- account_mcdb/account_mcdb.py 2015-06-17 08:52:51 +0000
+++ account_mcdb/account_mcdb.py 2016-02-08 10:52:01 +0000
@@ -31,7 +31,7 @@
3131
32 _columns = {32 _columns = {
33 'description': fields.char("Query name", required=False, readonly=False, size=255),33 'description': fields.char("Query name", required=False, readonly=False, size=255),
34 'journal_ids': fields.many2many(obj='account.journal', rel='account_journal_mcdb', id1='mcdb_id', id2='journal_id', string="Journal Code"),34 '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
35 'instance_ids': fields.many2many('msf.instance', 'instance_mcdb', 'mcdb_id', 'instance_id', string="Proprietary instance"),35 'instance_ids': fields.many2many('msf.instance', 'instance_mcdb', 'mcdb_id', 'instance_id', string="Proprietary instance"),
36 '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"),36 '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"),
37 'abs_id': fields.many2one('account.bank.statement', string="Register name"), # Change into many2many ?37 'abs_id': fields.many2one('account.bank.statement', string="Register name"), # Change into many2many ?
@@ -45,7 +45,7 @@
45 'account_ids': fields.many2many(obj='account.account', rel='account_account_mcdb', id1='mcdb_id', id2='account_id', string="Account Code"),45 'account_ids': fields.many2many(obj='account.account', rel='account_account_mcdb', id1='mcdb_id', id2='account_id', string="Account Code"),
46 'partner_id': fields.many2one('res.partner', string="Partner"),46 'partner_id': fields.many2one('res.partner', string="Partner"),
47 'employee_id': fields.many2one('hr.employee', string="Employee"),47 'employee_id': fields.many2one('hr.employee', string="Employee"),
48 'transfer_journal_id': fields.many2one('account.journal', string="Journal"),48 'transfer_journal_id': fields.many2one('account.journal', string="Journal", domain="[('code', '!=', 'IB')]"), # exclude year closing initial balance journal
49 'reconciled': fields.selection([('reconciled', 'Reconciled'), ('unreconciled', 'NOT reconciled')], string='Reconciled?'),49 'reconciled': fields.selection([('reconciled', 'Reconciled'), ('unreconciled', 'NOT reconciled')], string='Reconciled?'),
50 'functional_currency_id': fields.many2one('res.currency', string="Functional currency", readonly=True),50 'functional_currency_id': fields.many2one('res.currency', string="Functional currency", readonly=True),
51 'amount_func_from': fields.float('Begin amount in functional currency'),51 'amount_func_from': fields.float('Begin amount in functional currency'),
5252
=== modified file 'account_mcdb/account_view.xml'
--- account_mcdb/account_view.xml 2016-01-22 13:35:15 +0000
+++ account_mcdb/account_view.xml 2016-02-08 10:52:01 +0000
@@ -160,7 +160,7 @@
160 <group>160 <group>
161 <field name="partner_id" select='1' string="3RD Party Partner"/>161 <field name="partner_id" select='1' string="3RD Party Partner"/>
162 <field name="employee_id" select='1' string="3RD Party Employee"/>162 <field name="employee_id" select='1' string="3RD Party Employee"/>
163 <field name="transfer_journal_id" select='1' string="3RD Party Journal"/>163 <field name="transfer_journal_id" select='1' string="3RD Party Journal" context="{'exclude_journals': ['IB']}"/>
164 <field name="is_reconciled" select='1'/>164 <field name="is_reconciled" select='1'/>
165 <field name="reconcile_total_partial_id" select='1'/>165 <field name="reconcile_total_partial_id" select='1'/>
166 <newline/>166 <newline/>
@@ -168,7 +168,7 @@
168 <newline/>168 <newline/>
169 <group>169 <group>
170 <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/>170 <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/>
171 <field name="journal_id_fake" context="{'journal_id':self, 'visible_id':self, 'normal_view':False}"/>171 <field name="journal_id_fake" context="{'journal_id':self, 'visible_id':self, 'normal_view':False, 'exclude_journals': ['IB']}"/>
172 <field name="journal_type"/>172 <field name="journal_type"/>
173 </group>173 </group>
174 <newline/>174 <newline/>
@@ -184,7 +184,7 @@
184 <group expand="0" string="Group By..." colspan="4" col="20">184 <group expand="0" string="Group By..." colspan="4" col="20">
185 <filter string="3rd party Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>185 <filter string="3rd party Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
186 <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/>186 <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/>
187 <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id'}"/>187 <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id', 'exclude_journals': ['IB']}"/>
188 <separator orientation="vertical"/>188 <separator orientation="vertical"/>
189 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>189 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
190 <filter string="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>190 <filter string="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
@@ -386,12 +386,12 @@
386 <group col='8' colspan='4'>386 <group col='8' colspan='4'>
387 <field name="partner_id" select="1" string="3RD Party Partner"/>387 <field name="partner_id" select="1" string="3RD Party Partner"/>
388 <field name="employee_id" select="1" string="3RD Party Employee"/>388 <field name="employee_id" select="1" string="3RD Party Employee"/>
389 <field name="transfer_journal_id" select="1" string="3RD Party Journal"/>389 <field name="transfer_journal_id" select="1" string="3RD Party Journal" context="{'exclude_journals': ['IB']}"/>
390 </group>390 </group>
391 <newline/>391 <newline/>
392 <group col='8' colspan='4'>392 <group col='8' colspan='4'>
393 <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/>393 <field name="instance_id" on_change="onchange_filter_journal(instance_id, journal_id_fake)"/>
394 <field name="journal_id_fake"/>394 <field name="journal_id_fake" context="{'exclude_journals': ['IB']}" />
395 <field name="journal_type"/>395 <field name="journal_type"/>
396 </group>396 </group>
397 <newline/>397 <newline/>
@@ -400,7 +400,7 @@
400 <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/>400 <filter string="3rd party Employee" icon="terp-personal-" domain="[]" context="{'group_by': 'employee_id'}"/>
401 <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id'}"/>401 <filter string="3rd party Journal" icon="terp-dolar" domain="[]" context="{'group_by': 'transfer_journal_id'}"/>
402 <separator orientation="vertical"/>402 <separator orientation="vertical"/>
403 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>403 <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id', 'exclude_journals': ['IB']}"/>
404 <filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>404 <filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
405 <separator orientation="vertical"/>405 <separator orientation="vertical"/>
406 <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>406 <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
407407
=== modified file 'account_override/account.py'
--- account_override/account.py 2016-01-29 11:15:41 +0000
+++ account_override/account.py 2016-02-08 10:52:01 +0000
@@ -527,7 +527,7 @@
527 'ref': fields.char('Reference', size=64, readonly=True, states={'draft':[('readonly',False)]}),527 'ref': fields.char('Reference', size=64, readonly=True, states={'draft':[('readonly',False)]}),
528 'status': fields.selection([('sys', 'system'), ('manu', 'manual')], string="Status", required=True),528 'status': fields.selection([('sys', 'system'), ('manu', 'manual')], string="Status", required=True),
529 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}, domain="[('state', '=', 'draft')]"),529 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}, domain="[('state', '=', 'draft')]"),
530 '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)]"),530 '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)]"),
531 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"),531 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"),
532 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \532 'journal_type': fields.related('journal_id', 'type', type='selection', selection=_journal_type_get, string="Journal Type", \
533 help="This indicates which Journal Type is attached to this Journal Entry"),533 help="This indicates which Journal Type is attached to this Journal Entry"),
534534
=== modified file 'account_period_closing_level/account_period.py'
--- account_period_closing_level/account_period.py 2016-01-25 14:14:07 +0000
+++ account_period_closing_level/account_period.py 2016-02-08 10:52:01 +0000
@@ -150,7 +150,8 @@
150 pp_ids = self.search(150 pp_ids = self.search(
151 cr, uid,151 cr, uid,
152 [('date_start', '<', period.date_start),152 [('date_start', '<', period.date_start),
153 ('fiscalyear_id', '=', period.fiscalyear_id.id)],153 ('fiscalyear_id', '=', period.fiscalyear_id.id),
154 ('number', '>', 0), ('number', '<', 16)],
154 context=context)155 context=context)
155 for pp in self.browse(cr, uid, pp_ids, context=context):156 for pp in self.browse(cr, uid, pp_ids, context=context):
156 if check_states.index(pp.state) <= check_states.index(period.state):157 if check_states.index(pp.state) <= check_states.index(period.state):
@@ -161,7 +162,8 @@
161 np_ids = self.search(162 np_ids = self.search(
162 cr, uid,163 cr, uid,
163 [('date_start', '>', period.date_start),164 [('date_start', '>', period.date_start),
164 ('fiscalyear_id', '=', period.fiscalyear_id.id)],165 ('fiscalyear_id', '=', period.fiscalyear_id.id),
166 ('number', '>', 0), ('number', '<', 16)],
165 context=context)167 context=context)
166 for np in self.browse(cr, uid, np_ids, context=context):168 for np in self.browse(cr, uid, np_ids, context=context):
167 if check_states.index(np.state) >= check_states.index(period.state):169 if check_states.index(np.state) >= check_states.index(period.state):
@@ -290,7 +292,7 @@
290 raise osv.except_osv(_('Error'), msg)292 raise osv.except_osv(_('Error'), msg)
291 operator = 'in' if args[0][2] else 'not in'293 operator = 'in' if args[0][2] else 'not in'
292294
293 return [('number', operator, (0, 16, ))]295 return [('number', operator, [0, 16, ])]
294296
295 _columns = {297 _columns = {
296 'name': fields.char('Period Name', size=64, required=True, translate=True),298 'name': fields.char('Period Name', size=64, required=True, translate=True),
297299
=== modified file 'account_period_closing_level/account_year_end_closing.py'
--- account_period_closing_level/account_year_end_closing.py 2016-01-30 10:30:49 +0000
+++ account_period_closing_level/account_year_end_closing.py 2016-02-08 10:52:01 +0000
@@ -33,13 +33,16 @@
33 _columns = {33 _columns = {
34 # US-822 counterpart for BS account34 # US-822 counterpart for BS account
35 'ye_pl_cp_for_bs_debit_bal_account': fields.many2one('account.account',35 'ye_pl_cp_for_bs_debit_bal_account': fields.many2one('account.account',
36 'Counterpart for B/S debit balance'),36 'Counterpart for B/S debit balance',
37 domain=['|', ('user_type.code', 'in', ('income', 'expense', 'equity')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
37 'ye_pl_cp_for_bs_credit_bal_account': fields.many2one('account.account',38 'ye_pl_cp_for_bs_credit_bal_account': fields.many2one('account.account',
38 'Counterpart for B/S credit balance'),39 'Counterpart for B/S credit balance',
40 domain=['|', ('user_type.code', 'in', ('income', 'expense')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
3941
40 # US-822 PL/BS matrix of dev2/dev3 accounts"42 # US-822 PL/BS matrix of dev2/dev3 accounts"
41 'ye_pl_pos_credit_account': fields.many2one('account.account',43 'ye_pl_pos_credit_account': fields.many2one('account.account',
42 'Credit Account for P&L>0 (Income account)'),44 'Credit Account for P&L>0 (Income account)',
45 domain=[('user_type.code', '=', 'income')]),
43 'ye_pl_pos_debit_account': fields.many2one('account.account',46 'ye_pl_pos_debit_account': fields.many2one('account.account',
44 'Debit Account for P&L>0 (B/S account)',47 'Debit Account for P&L>0 (B/S account)',
45 domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),48 domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
@@ -47,7 +50,8 @@
47 'Credit Account P&L<0 (B/S account)',50 'Credit Account P&L<0 (B/S account)',
48 domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),51 domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]),
49 'ye_pl_ne_debit_account': fields.many2one('account.account',52 'ye_pl_ne_debit_account': fields.many2one('account.account',
50 'Debit Account P&L<0 (Expense account)'),53 'Debit Account P&L<0 (Expense account)',
54 domain=[('user_type.code', '=', 'expense')]),
51 }55 }
5256
53res_company()57res_company()
@@ -325,8 +329,7 @@
325 """329 """
326 create state valid JI in its CCY/JE330 create state valid JI in its CCY/JE
327 """331 """
328 name = "EOY-%d-%s-%s-%s" % (fy_year, account_code,332 name = 'Balance move to 0'
329 instance_rec.code, ccy_code, )
330333
331 vals = {334 vals = {
332 'account_id': account_id,335 'account_id': account_id,
@@ -469,8 +472,7 @@
469 """472 """
470 create state valid JI in its CCY/JE473 create state valid JI in its CCY/JE
471 """474 """
472 name = self._book_pl_results_seqnum_pattern % (fy_year,475 name = 'P&L Result'
473 instance_rec.code, cpy_rec.currency_id.name, )
474476
475 vals = {477 vals = {
476 'account_id': account_rec.id,478 'account_id': account_rec.id,
@@ -569,7 +571,7 @@
569 """571 """
570 create draft CCY/JE to log JI into572 create draft CCY/JE to log JI into
571 """573 """
572 name = "IB-%d-%s-%s-%s" % (fy_year, account_code,574 name = "IB-%d-%s-%s-%s" % (fy_year + 1, account_code,
573 instance_rec.code, ccy_code, )575 instance_rec.code, ccy_code, )
574576
575 vals = {577 vals = {
@@ -592,9 +594,7 @@
592 """594 """
593 create state valid JI in its CCY/JE595 create state valid JI in its CCY/JE
594 """596 """
595 if not name:597 default_name = 'Balance report / Previous Fiscal Year'
596 name = "IB-%d-%s-%s-%s" % (fy_year, account_code,
597 instance_rec.code, ccy_code, )
598598
599 vals = {599 vals = {
600 'account_id': account_id,600 'account_id': account_id,
@@ -604,7 +604,7 @@
604 'document_date': posting_date,604 'document_date': posting_date,
605 'instance_id': instance_rec.id,605 'instance_id': instance_rec.id,
606 'journal_id': journal_id,606 'journal_id': journal_id,
607 'name': name,607 'name': name or default_name,
608 'period_id': period_id,608 'period_id': period_id,
609 'source_date': posting_date,609 'source_date': posting_date,
610610
@@ -710,7 +710,6 @@
710 if not cr.rowcount:710 if not cr.rowcount:
711 return711 return
712712
713 re_account_found_in_bs = False
714 je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id713 je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id
715 for account_id, account_code, ccy_id, ccy_code, \714 for account_id, account_code, ccy_id, ccy_code, \
716 balance_currency, balance in cr.fetchall():715 balance_currency, balance in cr.fetchall():
@@ -730,24 +729,20 @@
730 account_id=account_id, account_code=account_code,729 account_id=account_id, account_code=account_code,
731 balance_currency=balance_currency, balance=balance, je_id=je_id)730 balance_currency=balance_currency, balance=balance, je_id=je_id)
732731
733 if not re_account_found_in_bs:732 # Regular/Equity account result entry for P&L
734 # Regular/Equity account result entry for P&L733 # => invert balance amount to debit or credit amount after account dispatch
735734 je_id = je_by_acc_ccy.get(
736 # invert balance amount to debit or credit amount after account dispatch735 (re_account_rec.id, cpy_rec.currency_id.id, ), False)
737 pl_balance *= -1736 if not je_id:
738737 je_id = create_journal_entry(ccy_id=ccy_id,
739 je_id = je_by_acc_ccy.get(
740 (re_account_rec.id, cpy_rec.currency_id.id, ), False)
741 if not je_id:
742 je_id = create_journal_entry(ccy_id=ccy_id,
743 ccy_code=cpy_rec.currency_id.name,
744 account_id=re_account_rec.id,
745 account_code=re_account_rec.code)
746 create_journal_item(ccy_id=cpy_rec.currency_id.id,
747 ccy_code=cpy_rec.currency_id.name,738 ccy_code=cpy_rec.currency_id.name,
748 account_id=re_account_rec.id, account_code=re_account_rec.code,739 account_id=re_account_rec.id,
749 balance_currency=pl_balance, balance=pl_balance, je_id=je_id,740 account_code=re_account_rec.code)
750 name="P&L Result report / Previous Fiscal Year")741 create_journal_item(ccy_id=cpy_rec.currency_id.id,
742 ccy_code=cpy_rec.currency_id.name,
743 account_id=re_account_rec.id, account_code=re_account_rec.code,
744 balance_currency=pl_balance, balance=pl_balance, je_id=je_id,
745 name="P&L Result report / Previous Fiscal Year")
751746
752 def update_fy_state(self, cr, uid, fy_id, reopen=False, context=None):747 def update_fy_state(self, cr, uid, fy_id, reopen=False, context=None):
753 def hq_close_post_entries(period_ids):748 def hq_close_post_entries(period_ids):
754749
=== modified file 'msf_accrual/msf_accrual_line.py'
--- msf_accrual/msf_accrual_line.py 2015-12-04 09:03:53 +0000
+++ msf_accrual/msf_accrual_line.py 2016-02-08 10:52:01 +0000
@@ -72,7 +72,7 @@
72 _columns = {72 _columns = {
73 'date': fields.date("Date"),73 'date': fields.date("Date"),
74 'document_date': fields.date("Document Date", required=True),74 'document_date': fields.date("Document Date", required=True),
75 'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state', '=', 'draft')]),75 'period_id': fields.many2one('account.period', 'Period', required=True, domain=[('state', '=', 'draft'), ('is_system', '=', False)]),
76 'description': fields.char('Description', size=64, required=True),76 'description': fields.char('Description', size=64, required=True),
77 'reference': fields.char('Reference', size=64),77 'reference': fields.char('Reference', size=64),
78 'expense_account_id': fields.many2one('account.account', 'Expense Account', required=True, domain=[('type', '!=', 'view'), ('user_type_code', '=', 'expense')]),78 'expense_account_id': fields.many2one('account.account', 'Expense Account', required=True, domain=[('type', '!=', 'view'), ('user_type_code', '=', 'expense')]),
7979
=== modified file 'msf_instance/add_instance.py'
--- msf_instance/add_instance.py 2016-01-04 13:16:43 +0000
+++ msf_instance/add_instance.py 2016-02-08 10:52:01 +0000
@@ -192,10 +192,31 @@
192192
193 ret = []193 ret = []
194 for journal in self.read(cr, uid, ids, ['code', 'instance_id']):194 for journal in self.read(cr, uid, ids, ['code', 'instance_id']):
195 if context:
196 exclude_journals = context.get('exclude_journals', False)
197 if exclude_journals:
198 if isinstance(exclude_journals, str):
199 exclude_journals = [exclude_journals]
200 if journal['code'] in exclude_journals:
201 continue
195 ret.append((journal['id'], '%s / %s'%(journal['instance_id'] and journal['instance_id'][1] or '', journal['code'])))202 ret.append((journal['id'], '%s / %s'%(journal['instance_id'] and journal['instance_id'][1] or '', journal['code'])))
196
197 return ret203 return ret
198204
205 def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None,
206 count=False):
207 if args is None:
208 args = []
209 if context:
210 exclude_journals = context.get('exclude_journals', False)
211 if exclude_journals:
212 if isinstance(exclude_journals, str):
213 exclude_journals = [exclude_journals]
214 args.append(('code', 'not in', exclude_journals))
215 res = super(account_journal_fake, self).search(cr, uid, args,
216 offset=offset, limit=limit, order=order, context=context,
217 count=count)
218 return res
219
199 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):220 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
200 return self.pool.get('account.journal').fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)221 return self.pool.get('account.journal').fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
201222
202223
=== modified file 'vertical_integration/report/hq_report_ocb.py'
--- vertical_integration/report/hq_report_ocb.py 2016-01-30 10:30:49 +0000
+++ vertical_integration/report/hq_report_ocb.py 2016-02-08 10:52:01 +0000
@@ -254,9 +254,7 @@
254 period = pool.get('account.period').browse(cr, uid, period_id)254 period = pool.get('account.period').browse(cr, uid, period_id)
255 last_day_of_period = period.date_stop255 last_day_of_period = period.date_stop
256 first_day_of_period = period.date_start256 first_day_of_period = period.date_start
257 period_name = period.name
258 selection = form.get('selection', False)257 selection = form.get('selection', False)
259 to_export = ['f'] # Default export value for exported field on analytic/move lines
260 tm = strptime(first_day_of_period, '%Y-%m-%d')258 tm = strptime(first_day_of_period, '%Y-%m-%d')
261 year_num = tm.tm_year259 year_num = tm.tm_year
262 year = str(year_num)260 year = str(year_num)
@@ -264,6 +262,7 @@
264 period_yyyymm = "{0}{1}".format(year,month)262 period_yyyymm = "{0}{1}".format(year,month)
265 if not selection:263 if not selection:
266 raise osv.except_osv(_('Error'), _('No selection value for lines to select.'))264 raise osv.except_osv(_('Error'), _('No selection value for lines to select.'))
265 # Default export value for exported field on analytic/move lines
267 if selection == 'all':266 if selection == 'all':
268 to_export = ['f', 't']267 to_export = ['f', 't']
269 elif selection == 'unexported':268 elif selection == 'unexported':
@@ -274,10 +273,7 @@
274 # US-822: if December is picked should:273 # US-822: if December is picked should:
275 # - include Period 16 action 2 Year end PL RESULT entries274 # - include Period 16 action 2 Year end PL RESULT entries
276 # of target Coordo275 # of target Coordo
277 rawdata_tpl_context= {276 plresult_ji_in_ids = []
278 'plres': '',
279 'plres2': '',
280 }
281 if period.number == 12:277 if period.number == 12:
282 ayec_obj = pool.get("account.year.end.closing")278 ayec_obj = pool.get("account.year.end.closing")
283 mi_obj = pool.get('msf.instance')279 mi_obj = pool.get('msf.instance')
@@ -301,19 +297,9 @@
301 je_ids = m_obj.search(cr, uid, [ ('name', 'in', seqnums) ],297 je_ids = m_obj.search(cr, uid, [ ('name', 'in', seqnums) ],
302 context=context)298 context=context)
303 if je_ids:299 if je_ids:
304 ji_ids = ml_obj.search(cr, uid, [300 plresult_ji_in_ids = ml_obj.search(cr, uid, [
305 ('move_id', 'in', je_ids)301 ('move_id', 'in', je_ids)
306 ], context=context)302 ], context=context)
307 if ji_ids:
308 plresult_ji_in_ids = ','.join(map(str, ji_ids))
309 rawdata_tpl_context.update({
310 # pl result JIs clause (aml alias version)
311 'plres': ' or aml.id in (%s)' % (
312 plresult_ji_in_ids, ),
313 # pl result JIs clause (aml2 alias version)
314 'plres2': ' or aml2.id in (%s)' % (
315 plresult_ji_in_ids, ),
316 })
317303
318 # Prepare SQL requests and PROCESS requests for finance_archive object304 # Prepare SQL requests and PROCESS requests for finance_archive object
319305
@@ -458,7 +444,7 @@
458 account_account AS a, 444 account_account AS a,
459 account_analytic_account AS aa, 445 account_analytic_account AS aa,
460 account_analytic_account AS aa2, 446 account_analytic_account AS aa2,
461 account_analytic_account AS aa3, 447 account_analytic_account AS aa3,
462 res_currency AS c, 448 res_currency AS c,
463 res_company AS e, 449 res_company AS e,
464 res_currency AS cc, 450 res_currency AS cc,
@@ -479,11 +465,11 @@
479 from account_move_line aml2, account_move am,465 from account_move_line aml2, account_move am,
480 account_period as p2466 account_period as p2
481 where am.id = aml2.move_id and p2.id = am.period_id467 where am.id = aml2.move_id and p2.id = am.period_id
482 and ((p2.number not in (0, 16) and am.state = 'posted')$plres2)468 and p2.number not in (0, 16) and am.state = 'posted'
483 )469 )
484 AND al.instance_id = i.id470 AND al.instance_id = i.id
485 AND aml.journal_id = aj.id471 AND aml.journal_id = aj.id
486 AND (aml.period_id = %s$plres)472 AND aml.period_id = %s
487 AND j.type not in %s473 AND j.type not in %s
488 AND al.exported in %s474 AND al.exported in %s
489 AND al.instance_id in %s;475 AND al.instance_id in %s;
@@ -494,7 +480,7 @@
494 'bs_entries_consolidated': """480 'bs_entries_consolidated': """
495 SELECT aml.id481 SELECT aml.id
496 FROM account_move_line AS aml, account_account AS aa, account_journal AS j482 FROM account_move_line AS aml, account_account AS aa, account_journal AS j
497 WHERE (aml.period_id = %s$plres)483 WHERE aml.period_id = %s
498 AND aml.account_id = aa.id484 AND aml.account_id = aa.id
499 AND aml.journal_id = j.id485 AND aml.journal_id = j.id
500 AND j.type not in %s486 AND j.type not in %s
@@ -529,7 +515,7 @@
529 AND aml.journal_id = j.id515 AND aml.journal_id = j.id
530 AND e.currency_id = cc.id516 AND e.currency_id = cc.id
531 AND aml.instance_id = i.id517 AND aml.instance_id = i.id
532 AND (aml.period_id = %s$plres)518 AND aml.period_id = %s
533 AND a.shrink_entries_for_hq != 't'519 AND a.shrink_entries_for_hq != 't'
534 AND j.type not in %s520 AND j.type not in %s
535 AND aml.exported in %s521 AND aml.exported in %s
@@ -538,6 +524,30 @@
538 ORDER BY aml.id;524 ORDER BY aml.id;
539 """,525 """,
540 }526 }
527 if plresult_ji_in_ids:
528 # NOTE: for these entries: booking and fonctional ccy are same
529 ''' columns
530 'DB ID', 'Instance', 'Journal', 'Entry sequence', 'Description',
531 'Reference', 'Document date', 'Posting date', 'G/L Account',
532 'Third party', 'Destination', 'Cost centre', 'Funding pool',
533 'Booking debit', 'Booking credit', 'Booking currency',
534 'Functional debit', 'Functional credit', 'Functional CCY',
535 'Emplid', 'Partner DB ID' '''
536 sqlrequests['plresult'] = """
537 SELECT aml.id, i.code, j.code, m.name as "entry_sequence", aml.name,
538 aml.ref, aml.document_date, aml.date, a.code,
539 aml.partner_txt, '', '', '',
540 ROUND(aml.debit_currency, 2), ROUND(aml.credit_currency, 2), c.name,
541 ROUND(aml.debit, 2), ROUND(aml.credit, 2), c.name,
542 '', ''
543 FROM account_move_line aml
544 INNER JOIN msf_instance i on i.id = aml.instance_id
545 INNER JOIN account_journal j on j.id = aml.journal_id
546 INNER JOIN account_move m on m.id = aml.move_id
547 INNER JOIN account_account a on a.id = aml.account_id
548 INNER JOIN res_currency c on c.id = aml.currency_id
549 WHERE aml.id in %s AND aml.exported in %s
550 """
541551
542 # PROCESS REQUESTS LIST: list of dict containing info to process some SQL requests552 # PROCESS REQUESTS LIST: list of dict containing info to process some SQL requests
543 # Dict:553 # Dict:
@@ -612,7 +622,6 @@
612 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with622 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with
613 'fnct_params': 'account.analytic.line',623 'fnct_params': 'account.analytic.line',
614 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),624 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),
615 'query_tpl_context': rawdata_tpl_context,
616 'delete_columns': [0],625 'delete_columns': [0],
617 'id': 0,626 'id': 0,
618 'object': 'account.analytic.line',627 'object': 'account.analytic.line',
@@ -621,7 +630,6 @@
621 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',630 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',
622 'key': 'bs_entries_consolidated',631 'key': 'bs_entries_consolidated',
623 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),632 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),
624 'query_tpl_context': rawdata_tpl_context,
625 'function': 'postprocess_consolidated_entries',633 'function': 'postprocess_consolidated_entries',
626 'fnct_params': excluded_journal_types,634 'fnct_params': excluded_journal_types,
627 },635 },
@@ -631,12 +639,23 @@
631 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with639 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with
632 'fnct_params': 'account.move.line',640 'fnct_params': 'account.move.line',
633 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),641 'query_params': (period_id, tuple(excluded_journal_types), tuple(to_export), tuple(instance_ids)),
634 'query_tpl_context': rawdata_tpl_context,
635 'delete_columns': [0],642 'delete_columns': [0],
636 'id': 0,643 'id': 0,
637 'object': 'account.move.line',644 'object': 'account.move.line',
638 },645 },
639 ]646 ]
647 if plresult_ji_in_ids:
648 processrequests.append({
649 'filename': instance_name + '_' + year + month + '_Monthly Export.csv',
650 'key': 'plresult',
651 'function': 'postprocess_add_db_id', # to take move line ids and make a DB ID with
652 'fnct_params': 'account.move.line',
653 'query_params': (tuple(plresult_ji_in_ids), tuple(to_export), ),
654 'delete_columns': [0],
655 'id': 0,
656 'object': 'account.move.line',
657 })
658
640 # Launch finance archive object659 # Launch finance archive object
641 fe = finance_archive(sqlrequests, processrequests)660 fe = finance_archive(sqlrequests, processrequests)
642 # Use archive method to create the archive661 # Use archive method to create the archive

Subscribers

People subscribed via source and target branches