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:
|
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 | 297 | 297 | ||
6 | 298 | #BKLG-53 get the next draft period from today | 298 | #BKLG-53 get the next draft period from today |
7 | 299 | current_date = datetime.date.today().strftime('%Y-%m-%d') | 299 | current_date = datetime.date.today().strftime('%Y-%m-%d') |
10 | 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, [ |
11 | 301 | context=context, limit=1, order='date_stop') | 301 | ('date_stop','>=',current_date), |
12 | 302 | ('state','=','draft'), | ||
13 | 303 | ('special', '=', False), | ||
14 | 304 | ], context=context, limit=1, order='date_stop') | ||
15 | 302 | if not periods: | 305 | if not periods: |
16 | 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!')) |
17 | 304 | self.pool.get('account.bank.statement') \ | 307 | self.pool.get('account.bank.statement') \ |
18 | 305 | 308 | ||
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 | 31 | 31 | ||
24 | 32 | _columns = { | 32 | _columns = { |
25 | 33 | 'description': fields.char("Query name", required=False, readonly=False, size=255), | 33 | 'description': fields.char("Query name", required=False, readonly=False, size=255), |
27 | 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 |
28 | 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"), |
29 | 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"), |
30 | 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 ? |
31 | @@ -45,7 +45,7 @@ | |||
32 | 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"), |
33 | 46 | 'partner_id': fields.many2one('res.partner', string="Partner"), | 46 | 'partner_id': fields.many2one('res.partner', string="Partner"), |
34 | 47 | 'employee_id': fields.many2one('hr.employee', string="Employee"), | 47 | 'employee_id': fields.many2one('hr.employee', string="Employee"), |
36 | 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 |
37 | 49 | 'reconciled': fields.selection([('reconciled', 'Reconciled'), ('unreconciled', 'NOT reconciled')], string='Reconciled?'), | 49 | 'reconciled': fields.selection([('reconciled', 'Reconciled'), ('unreconciled', 'NOT reconciled')], string='Reconciled?'), |
38 | 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), |
39 | 51 | 'amount_func_from': fields.float('Begin amount in functional currency'), | 51 | 'amount_func_from': fields.float('Begin amount in functional currency'), |
40 | 52 | 52 | ||
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 | 160 | <group> | 160 | <group> |
46 | 161 | <field name="partner_id" select='1' string="3RD Party Partner"/> | 161 | <field name="partner_id" select='1' string="3RD Party Partner"/> |
47 | 162 | <field name="employee_id" select='1' string="3RD Party Employee"/> | 162 | <field name="employee_id" select='1' string="3RD Party Employee"/> |
49 | 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']}"/> |
50 | 164 | <field name="is_reconciled" select='1'/> | 164 | <field name="is_reconciled" select='1'/> |
51 | 165 | <field name="reconcile_total_partial_id" select='1'/> | 165 | <field name="reconcile_total_partial_id" select='1'/> |
52 | 166 | <newline/> | 166 | <newline/> |
53 | @@ -168,7 +168,7 @@ | |||
54 | 168 | <newline/> | 168 | <newline/> |
55 | 169 | <group> | 169 | <group> |
56 | 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)"/> |
58 | 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']}"/> |
59 | 172 | <field name="journal_type"/> | 172 | <field name="journal_type"/> |
60 | 173 | </group> | 173 | </group> |
61 | 174 | <newline/> | 174 | <newline/> |
62 | @@ -184,7 +184,7 @@ | |||
63 | 184 | <group expand="0" string="Group By..." colspan="4" col="20"> | 184 | <group expand="0" string="Group By..." colspan="4" col="20"> |
64 | 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'}"/> |
65 | 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'}"/> |
67 | 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']}"/> |
68 | 188 | <separator orientation="vertical"/> | 188 | <separator orientation="vertical"/> |
69 | 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'}"/> |
70 | 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'}"/> |
71 | @@ -386,12 +386,12 @@ | |||
72 | 386 | <group col='8' colspan='4'> | 386 | <group col='8' colspan='4'> |
73 | 387 | <field name="partner_id" select="1" string="3RD Party Partner"/> | 387 | <field name="partner_id" select="1" string="3RD Party Partner"/> |
74 | 388 | <field name="employee_id" select="1" string="3RD Party Employee"/> | 388 | <field name="employee_id" select="1" string="3RD Party Employee"/> |
76 | 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']}"/> |
77 | 390 | </group> | 390 | </group> |
78 | 391 | <newline/> | 391 | <newline/> |
79 | 392 | <group col='8' colspan='4'> | 392 | <group col='8' colspan='4'> |
80 | 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)"/> |
82 | 394 | <field name="journal_id_fake"/> | 394 | <field name="journal_id_fake" context="{'exclude_journals': ['IB']}" /> |
83 | 395 | <field name="journal_type"/> | 395 | <field name="journal_type"/> |
84 | 396 | </group> | 396 | </group> |
85 | 397 | <newline/> | 397 | <newline/> |
86 | @@ -400,7 +400,7 @@ | |||
87 | 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'}"/> |
88 | 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'}"/> |
89 | 402 | <separator orientation="vertical"/> | 402 | <separator orientation="vertical"/> |
91 | 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']}"/> |
92 | 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'}"/> |
93 | 405 | <separator orientation="vertical"/> | 405 | <separator orientation="vertical"/> |
94 | 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'}"/> |
95 | 407 | 407 | ||
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 | 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)]}), |
101 | 528 | 'status': fields.selection([('sys', 'system'), ('manu', 'manual')], string="Status", required=True), | 528 | 'status': fields.selection([('sys', 'system'), ('manu', 'manual')], string="Status", required=True), |
102 | 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')]"), |
104 | 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)]"), |
105 | 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"), |
106 | 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", \ |
107 | 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"), |
108 | 534 | 534 | ||
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 | 150 | pp_ids = self.search( | 150 | pp_ids = self.search( |
114 | 151 | cr, uid, | 151 | cr, uid, |
115 | 152 | [('date_start', '<', period.date_start), | 152 | [('date_start', '<', period.date_start), |
117 | 153 | ('fiscalyear_id', '=', period.fiscalyear_id.id)], | 153 | ('fiscalyear_id', '=', period.fiscalyear_id.id), |
118 | 154 | ('number', '>', 0), ('number', '<', 16)], | ||
119 | 154 | context=context) | 155 | context=context) |
120 | 155 | for pp in self.browse(cr, uid, pp_ids, context=context): | 156 | for pp in self.browse(cr, uid, pp_ids, context=context): |
121 | 156 | if check_states.index(pp.state) <= check_states.index(period.state): | 157 | if check_states.index(pp.state) <= check_states.index(period.state): |
122 | @@ -161,7 +162,8 @@ | |||
123 | 161 | np_ids = self.search( | 162 | np_ids = self.search( |
124 | 162 | cr, uid, | 163 | cr, uid, |
125 | 163 | [('date_start', '>', period.date_start), | 164 | [('date_start', '>', period.date_start), |
127 | 164 | ('fiscalyear_id', '=', period.fiscalyear_id.id)], | 165 | ('fiscalyear_id', '=', period.fiscalyear_id.id), |
128 | 166 | ('number', '>', 0), ('number', '<', 16)], | ||
129 | 165 | context=context) | 167 | context=context) |
130 | 166 | for np in self.browse(cr, uid, np_ids, context=context): | 168 | for np in self.browse(cr, uid, np_ids, context=context): |
131 | 167 | if check_states.index(np.state) >= check_states.index(period.state): | 169 | if check_states.index(np.state) >= check_states.index(period.state): |
132 | @@ -290,7 +292,7 @@ | |||
133 | 290 | raise osv.except_osv(_('Error'), msg) | 292 | raise osv.except_osv(_('Error'), msg) |
134 | 291 | operator = 'in' if args[0][2] else 'not in' | 293 | operator = 'in' if args[0][2] else 'not in' |
135 | 292 | 294 | ||
137 | 293 | return [('number', operator, (0, 16, ))] | 295 | return [('number', operator, [0, 16, ])] |
138 | 294 | 296 | ||
139 | 295 | _columns = { | 297 | _columns = { |
140 | 296 | 'name': fields.char('Period Name', size=64, required=True, translate=True), | 298 | 'name': fields.char('Period Name', size=64, required=True, translate=True), |
141 | 297 | 299 | ||
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 | 33 | _columns = { | 33 | _columns = { |
147 | 34 | # US-822 counterpart for BS account | 34 | # US-822 counterpart for BS account |
148 | 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', |
150 | 36 | 'Counterpart for B/S debit balance'), | 36 | 'Counterpart for B/S debit balance', |
151 | 37 | domain=['|', ('user_type.code', 'in', ('income', 'expense', 'equity')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]), | ||
152 | 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', |
154 | 38 | 'Counterpart for B/S credit balance'), | 39 | 'Counterpart for B/S credit balance', |
155 | 40 | domain=['|', ('user_type.code', 'in', ('income', 'expense')), '&', ('type', '=', 'other'), ('user_type.code', '=', 'equity')]), | ||
156 | 39 | 41 | ||
157 | 40 | # US-822 PL/BS matrix of dev2/dev3 accounts" | 42 | # US-822 PL/BS matrix of dev2/dev3 accounts" |
158 | 41 | 'ye_pl_pos_credit_account': fields.many2one('account.account', | 43 | 'ye_pl_pos_credit_account': fields.many2one('account.account', |
160 | 42 | 'Credit Account for P&L>0 (Income account)'), | 44 | 'Credit Account for P&L>0 (Income account)', |
161 | 45 | domain=[('user_type.code', '=', 'income')]), | ||
162 | 43 | 'ye_pl_pos_debit_account': fields.many2one('account.account', | 46 | 'ye_pl_pos_debit_account': fields.many2one('account.account', |
163 | 44 | 'Debit Account for P&L>0 (B/S account)', | 47 | 'Debit Account for P&L>0 (B/S account)', |
164 | 45 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), | 48 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
165 | @@ -47,7 +50,8 @@ | |||
166 | 47 | 'Credit Account P&L<0 (B/S account)', | 50 | 'Credit Account P&L<0 (B/S account)', |
167 | 48 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), | 51 | domain=[('type', '=', 'other'), ('user_type.code', '=', 'equity')]), |
168 | 49 | 'ye_pl_ne_debit_account': fields.many2one('account.account', | 52 | 'ye_pl_ne_debit_account': fields.many2one('account.account', |
170 | 50 | 'Debit Account P&L<0 (Expense account)'), | 53 | 'Debit Account P&L<0 (Expense account)', |
171 | 54 | domain=[('user_type.code', '=', 'expense')]), | ||
172 | 51 | } | 55 | } |
173 | 52 | 56 | ||
174 | 53 | res_company() | 57 | res_company() |
175 | @@ -325,8 +329,7 @@ | |||
176 | 325 | """ | 329 | """ |
177 | 326 | create state valid JI in its CCY/JE | 330 | create state valid JI in its CCY/JE |
178 | 327 | """ | 331 | """ |
181 | 328 | name = "EOY-%d-%s-%s-%s" % (fy_year, account_code, | 332 | name = 'Balance move to 0' |
180 | 329 | instance_rec.code, ccy_code, ) | ||
182 | 330 | 333 | ||
183 | 331 | vals = { | 334 | vals = { |
184 | 332 | 'account_id': account_id, | 335 | 'account_id': account_id, |
185 | @@ -469,8 +472,7 @@ | |||
186 | 469 | """ | 472 | """ |
187 | 470 | create state valid JI in its CCY/JE | 473 | create state valid JI in its CCY/JE |
188 | 471 | """ | 474 | """ |
191 | 472 | name = self._book_pl_results_seqnum_pattern % (fy_year, | 475 | name = 'P&L Result' |
190 | 473 | instance_rec.code, cpy_rec.currency_id.name, ) | ||
192 | 474 | 476 | ||
193 | 475 | vals = { | 477 | vals = { |
194 | 476 | 'account_id': account_rec.id, | 478 | 'account_id': account_rec.id, |
195 | @@ -569,7 +571,7 @@ | |||
196 | 569 | """ | 571 | """ |
197 | 570 | create draft CCY/JE to log JI into | 572 | create draft CCY/JE to log JI into |
198 | 571 | """ | 573 | """ |
200 | 572 | name = "IB-%d-%s-%s-%s" % (fy_year, account_code, | 574 | name = "IB-%d-%s-%s-%s" % (fy_year + 1, account_code, |
201 | 573 | instance_rec.code, ccy_code, ) | 575 | instance_rec.code, ccy_code, ) |
202 | 574 | 576 | ||
203 | 575 | vals = { | 577 | vals = { |
204 | @@ -592,9 +594,7 @@ | |||
205 | 592 | """ | 594 | """ |
206 | 593 | create state valid JI in its CCY/JE | 595 | create state valid JI in its CCY/JE |
207 | 594 | """ | 596 | """ |
211 | 595 | if not name: | 597 | default_name = 'Balance report / Previous Fiscal Year' |
209 | 596 | name = "IB-%d-%s-%s-%s" % (fy_year, account_code, | ||
210 | 597 | instance_rec.code, ccy_code, ) | ||
212 | 598 | 598 | ||
213 | 599 | vals = { | 599 | vals = { |
214 | 600 | 'account_id': account_id, | 600 | 'account_id': account_id, |
215 | @@ -604,7 +604,7 @@ | |||
216 | 604 | 'document_date': posting_date, | 604 | 'document_date': posting_date, |
217 | 605 | 'instance_id': instance_rec.id, | 605 | 'instance_id': instance_rec.id, |
218 | 606 | 'journal_id': journal_id, | 606 | 'journal_id': journal_id, |
220 | 607 | 'name': name, | 607 | 'name': name or default_name, |
221 | 608 | 'period_id': period_id, | 608 | 'period_id': period_id, |
222 | 609 | 'source_date': posting_date, | 609 | 'source_date': posting_date, |
223 | 610 | 610 | ||
224 | @@ -710,7 +710,6 @@ | |||
225 | 710 | if not cr.rowcount: | 710 | if not cr.rowcount: |
226 | 711 | return | 711 | return |
227 | 712 | 712 | ||
228 | 713 | re_account_found_in_bs = False | ||
229 | 714 | je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id | 713 | je_by_acc_ccy = {} # JE/ ACC/CCY, key: (acc_id, ccy_id), value: JE id |
230 | 715 | for account_id, account_code, ccy_id, ccy_code, \ | 714 | for account_id, account_code, ccy_id, ccy_code, \ |
231 | 716 | balance_currency, balance in cr.fetchall(): | 715 | balance_currency, balance in cr.fetchall(): |
232 | @@ -730,24 +729,20 @@ | |||
233 | 730 | account_id=account_id, account_code=account_code, | 729 | account_id=account_id, account_code=account_code, |
234 | 731 | balance_currency=balance_currency, balance=balance, je_id=je_id) | 730 | balance_currency=balance_currency, balance=balance, je_id=je_id) |
235 | 732 | 731 | ||
250 | 733 | if not re_account_found_in_bs: | 732 | # Regular/Equity account result entry for P&L |
251 | 734 | # Regular/Equity account result entry for P&L | 733 | # => invert balance amount to debit or credit amount after account dispatch |
252 | 735 | 734 | je_id = je_by_acc_ccy.get( | |
253 | 736 | # invert balance amount to debit or credit amount after account dispatch | 735 | (re_account_rec.id, cpy_rec.currency_id.id, ), False) |
254 | 737 | pl_balance *= -1 | 736 | if not je_id: |
255 | 738 | 737 | je_id = create_journal_entry(ccy_id=ccy_id, | |
242 | 739 | je_id = je_by_acc_ccy.get( | ||
243 | 740 | (re_account_rec.id, cpy_rec.currency_id.id, ), False) | ||
244 | 741 | if not je_id: | ||
245 | 742 | je_id = create_journal_entry(ccy_id=ccy_id, | ||
246 | 743 | ccy_code=cpy_rec.currency_id.name, | ||
247 | 744 | account_id=re_account_rec.id, | ||
248 | 745 | account_code=re_account_rec.code) | ||
249 | 746 | create_journal_item(ccy_id=cpy_rec.currency_id.id, | ||
256 | 747 | ccy_code=cpy_rec.currency_id.name, | 738 | ccy_code=cpy_rec.currency_id.name, |
260 | 748 | account_id=re_account_rec.id, account_code=re_account_rec.code, | 739 | account_id=re_account_rec.id, |
261 | 749 | balance_currency=pl_balance, balance=pl_balance, je_id=je_id, | 740 | account_code=re_account_rec.code) |
262 | 750 | name="P&L Result report / Previous Fiscal Year") | 741 | create_journal_item(ccy_id=cpy_rec.currency_id.id, |
263 | 742 | ccy_code=cpy_rec.currency_id.name, | ||
264 | 743 | account_id=re_account_rec.id, account_code=re_account_rec.code, | ||
265 | 744 | balance_currency=pl_balance, balance=pl_balance, je_id=je_id, | ||
266 | 745 | name="P&L Result report / Previous Fiscal Year") | ||
267 | 751 | 746 | ||
268 | 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): |
269 | 753 | def hq_close_post_entries(period_ids): | 748 | def hq_close_post_entries(period_ids): |
270 | 754 | 749 | ||
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 | 72 | _columns = { | 72 | _columns = { |
276 | 73 | 'date': fields.date("Date"), | 73 | 'date': fields.date("Date"), |
277 | 74 | 'document_date': fields.date("Document Date", required=True), | 74 | 'document_date': fields.date("Document Date", required=True), |
279 | 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)]), |
280 | 76 | 'description': fields.char('Description', size=64, required=True), | 76 | 'description': fields.char('Description', size=64, required=True), |
281 | 77 | 'reference': fields.char('Reference', size=64), | 77 | 'reference': fields.char('Reference', size=64), |
282 | 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')]), |
283 | 79 | 79 | ||
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 | 192 | 192 | ||
289 | 193 | ret = [] | 193 | ret = [] |
290 | 194 | for journal in self.read(cr, uid, ids, ['code', 'instance_id']): | 194 | for journal in self.read(cr, uid, ids, ['code', 'instance_id']): |
291 | 195 | if context: | ||
292 | 196 | exclude_journals = context.get('exclude_journals', False) | ||
293 | 197 | if exclude_journals: | ||
294 | 198 | if isinstance(exclude_journals, str): | ||
295 | 199 | exclude_journals = [exclude_journals] | ||
296 | 200 | if journal['code'] in exclude_journals: | ||
297 | 201 | continue | ||
298 | 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']))) |
299 | 196 | |||
300 | 197 | return ret | 203 | return ret |
301 | 198 | 204 | ||
302 | 205 | def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, | ||
303 | 206 | count=False): | ||
304 | 207 | if args is None: | ||
305 | 208 | args = [] | ||
306 | 209 | if context: | ||
307 | 210 | exclude_journals = context.get('exclude_journals', False) | ||
308 | 211 | if exclude_journals: | ||
309 | 212 | if isinstance(exclude_journals, str): | ||
310 | 213 | exclude_journals = [exclude_journals] | ||
311 | 214 | args.append(('code', 'not in', exclude_journals)) | ||
312 | 215 | res = super(account_journal_fake, self).search(cr, uid, args, | ||
313 | 216 | offset=offset, limit=limit, order=order, context=context, | ||
314 | 217 | count=count) | ||
315 | 218 | return res | ||
316 | 219 | |||
317 | 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): |
318 | 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) |
319 | 201 | 222 | ||
320 | 202 | 223 | ||
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 | 254 | period = pool.get('account.period').browse(cr, uid, period_id) | 254 | period = pool.get('account.period').browse(cr, uid, period_id) |
326 | 255 | last_day_of_period = period.date_stop | 255 | last_day_of_period = period.date_stop |
327 | 256 | first_day_of_period = period.date_start | 256 | first_day_of_period = period.date_start |
328 | 257 | period_name = period.name | ||
329 | 258 | selection = form.get('selection', False) | 257 | selection = form.get('selection', False) |
330 | 259 | to_export = ['f'] # Default export value for exported field on analytic/move lines | ||
331 | 260 | tm = strptime(first_day_of_period, '%Y-%m-%d') | 258 | tm = strptime(first_day_of_period, '%Y-%m-%d') |
332 | 261 | year_num = tm.tm_year | 259 | year_num = tm.tm_year |
333 | 262 | year = str(year_num) | 260 | year = str(year_num) |
334 | @@ -264,6 +262,7 @@ | |||
335 | 264 | period_yyyymm = "{0}{1}".format(year,month) | 262 | period_yyyymm = "{0}{1}".format(year,month) |
336 | 265 | if not selection: | 263 | if not selection: |
337 | 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.')) |
338 | 265 | # Default export value for exported field on analytic/move lines | ||
339 | 267 | if selection == 'all': | 266 | if selection == 'all': |
340 | 268 | to_export = ['f', 't'] | 267 | to_export = ['f', 't'] |
341 | 269 | elif selection == 'unexported': | 268 | elif selection == 'unexported': |
342 | @@ -274,10 +273,7 @@ | |||
343 | 274 | # US-822: if December is picked should: | 273 | # US-822: if December is picked should: |
344 | 275 | # - include Period 16 action 2 Year end PL RESULT entries | 274 | # - include Period 16 action 2 Year end PL RESULT entries |
345 | 276 | # of target Coordo | 275 | # of target Coordo |
350 | 277 | rawdata_tpl_context= { | 276 | plresult_ji_in_ids = [] |
347 | 278 | 'plres': '', | ||
348 | 279 | 'plres2': '', | ||
349 | 280 | } | ||
351 | 281 | if period.number == 12: | 277 | if period.number == 12: |
352 | 282 | ayec_obj = pool.get("account.year.end.closing") | 278 | ayec_obj = pool.get("account.year.end.closing") |
353 | 283 | mi_obj = pool.get('msf.instance') | 279 | mi_obj = pool.get('msf.instance') |
354 | @@ -301,19 +297,9 @@ | |||
355 | 301 | je_ids = m_obj.search(cr, uid, [ ('name', 'in', seqnums) ], | 297 | je_ids = m_obj.search(cr, uid, [ ('name', 'in', seqnums) ], |
356 | 302 | context=context) | 298 | context=context) |
357 | 303 | if je_ids: | 299 | if je_ids: |
359 | 304 | ji_ids = ml_obj.search(cr, uid, [ | 300 | plresult_ji_in_ids = ml_obj.search(cr, uid, [ |
360 | 305 | ('move_id', 'in', je_ids) | 301 | ('move_id', 'in', je_ids) |
361 | 306 | ], context=context) | 302 | ], context=context) |
362 | 307 | if ji_ids: | ||
363 | 308 | plresult_ji_in_ids = ','.join(map(str, ji_ids)) | ||
364 | 309 | rawdata_tpl_context.update({ | ||
365 | 310 | # pl result JIs clause (aml alias version) | ||
366 | 311 | 'plres': ' or aml.id in (%s)' % ( | ||
367 | 312 | plresult_ji_in_ids, ), | ||
368 | 313 | # pl result JIs clause (aml2 alias version) | ||
369 | 314 | 'plres2': ' or aml2.id in (%s)' % ( | ||
370 | 315 | plresult_ji_in_ids, ), | ||
371 | 316 | }) | ||
372 | 317 | 303 | ||
373 | 318 | # Prepare SQL requests and PROCESS requests for finance_archive object | 304 | # Prepare SQL requests and PROCESS requests for finance_archive object |
374 | 319 | 305 | ||
375 | @@ -458,7 +444,7 @@ | |||
376 | 458 | account_account AS a, | 444 | account_account AS a, |
377 | 459 | account_analytic_account AS aa, | 445 | account_analytic_account AS aa, |
378 | 460 | account_analytic_account AS aa2, | 446 | account_analytic_account AS aa2, |
380 | 461 | account_analytic_account AS aa3, | 447 | account_analytic_account AS aa3, |
381 | 462 | res_currency AS c, | 448 | res_currency AS c, |
382 | 463 | res_company AS e, | 449 | res_company AS e, |
383 | 464 | res_currency AS cc, | 450 | res_currency AS cc, |
384 | @@ -479,11 +465,11 @@ | |||
385 | 479 | from account_move_line aml2, account_move am, | 465 | from account_move_line aml2, account_move am, |
386 | 480 | account_period as p2 | 466 | account_period as p2 |
387 | 481 | where am.id = aml2.move_id and p2.id = am.period_id | 467 | where am.id = aml2.move_id and p2.id = am.period_id |
389 | 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' |
390 | 483 | ) | 469 | ) |
391 | 484 | AND al.instance_id = i.id | 470 | AND al.instance_id = i.id |
392 | 485 | AND aml.journal_id = aj.id | 471 | AND aml.journal_id = aj.id |
394 | 486 | AND (aml.period_id = %s$plres) | 472 | AND aml.period_id = %s |
395 | 487 | AND j.type not in %s | 473 | AND j.type not in %s |
396 | 488 | AND al.exported in %s | 474 | AND al.exported in %s |
397 | 489 | AND al.instance_id in %s; | 475 | AND al.instance_id in %s; |
398 | @@ -494,7 +480,7 @@ | |||
399 | 494 | 'bs_entries_consolidated': """ | 480 | 'bs_entries_consolidated': """ |
400 | 495 | SELECT aml.id | 481 | SELECT aml.id |
401 | 496 | FROM account_move_line AS aml, account_account AS aa, account_journal AS j | 482 | FROM account_move_line AS aml, account_account AS aa, account_journal AS j |
403 | 497 | WHERE (aml.period_id = %s$plres) | 483 | WHERE aml.period_id = %s |
404 | 498 | AND aml.account_id = aa.id | 484 | AND aml.account_id = aa.id |
405 | 499 | AND aml.journal_id = j.id | 485 | AND aml.journal_id = j.id |
406 | 500 | AND j.type not in %s | 486 | AND j.type not in %s |
407 | @@ -529,7 +515,7 @@ | |||
408 | 529 | AND aml.journal_id = j.id | 515 | AND aml.journal_id = j.id |
409 | 530 | AND e.currency_id = cc.id | 516 | AND e.currency_id = cc.id |
410 | 531 | AND aml.instance_id = i.id | 517 | AND aml.instance_id = i.id |
412 | 532 | AND (aml.period_id = %s$plres) | 518 | AND aml.period_id = %s |
413 | 533 | AND a.shrink_entries_for_hq != 't' | 519 | AND a.shrink_entries_for_hq != 't' |
414 | 534 | AND j.type not in %s | 520 | AND j.type not in %s |
415 | 535 | AND aml.exported in %s | 521 | AND aml.exported in %s |
416 | @@ -538,6 +524,30 @@ | |||
417 | 538 | ORDER BY aml.id; | 524 | ORDER BY aml.id; |
418 | 539 | """, | 525 | """, |
419 | 540 | } | 526 | } |
420 | 527 | if plresult_ji_in_ids: | ||
421 | 528 | # NOTE: for these entries: booking and fonctional ccy are same | ||
422 | 529 | ''' columns | ||
423 | 530 | 'DB ID', 'Instance', 'Journal', 'Entry sequence', 'Description', | ||
424 | 531 | 'Reference', 'Document date', 'Posting date', 'G/L Account', | ||
425 | 532 | 'Third party', 'Destination', 'Cost centre', 'Funding pool', | ||
426 | 533 | 'Booking debit', 'Booking credit', 'Booking currency', | ||
427 | 534 | 'Functional debit', 'Functional credit', 'Functional CCY', | ||
428 | 535 | 'Emplid', 'Partner DB ID' ''' | ||
429 | 536 | sqlrequests['plresult'] = """ | ||
430 | 537 | SELECT aml.id, i.code, j.code, m.name as "entry_sequence", aml.name, | ||
431 | 538 | aml.ref, aml.document_date, aml.date, a.code, | ||
432 | 539 | aml.partner_txt, '', '', '', | ||
433 | 540 | ROUND(aml.debit_currency, 2), ROUND(aml.credit_currency, 2), c.name, | ||
434 | 541 | ROUND(aml.debit, 2), ROUND(aml.credit, 2), c.name, | ||
435 | 542 | '', '' | ||
436 | 543 | FROM account_move_line aml | ||
437 | 544 | INNER JOIN msf_instance i on i.id = aml.instance_id | ||
438 | 545 | INNER JOIN account_journal j on j.id = aml.journal_id | ||
439 | 546 | INNER JOIN account_move m on m.id = aml.move_id | ||
440 | 547 | INNER JOIN account_account a on a.id = aml.account_id | ||
441 | 548 | INNER JOIN res_currency c on c.id = aml.currency_id | ||
442 | 549 | WHERE aml.id in %s AND aml.exported in %s | ||
443 | 550 | """ | ||
444 | 541 | 551 | ||
445 | 542 | # PROCESS REQUESTS LIST: list of dict containing info to process some SQL requests | 552 | # PROCESS REQUESTS LIST: list of dict containing info to process some SQL requests |
446 | 543 | # Dict: | 553 | # Dict: |
447 | @@ -612,7 +622,6 @@ | |||
448 | 612 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with | 622 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with |
449 | 613 | 'fnct_params': 'account.analytic.line', | 623 | 'fnct_params': 'account.analytic.line', |
450 | 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)), |
451 | 615 | 'query_tpl_context': rawdata_tpl_context, | ||
452 | 616 | 'delete_columns': [0], | 625 | 'delete_columns': [0], |
453 | 617 | 'id': 0, | 626 | 'id': 0, |
454 | 618 | 'object': 'account.analytic.line', | 627 | 'object': 'account.analytic.line', |
455 | @@ -621,7 +630,6 @@ | |||
456 | 621 | 'filename': instance_name + '_' + year + month + '_Monthly Export.csv', | 630 | 'filename': instance_name + '_' + year + month + '_Monthly Export.csv', |
457 | 622 | 'key': 'bs_entries_consolidated', | 631 | 'key': 'bs_entries_consolidated', |
458 | 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)), |
459 | 624 | 'query_tpl_context': rawdata_tpl_context, | ||
460 | 625 | 'function': 'postprocess_consolidated_entries', | 633 | 'function': 'postprocess_consolidated_entries', |
461 | 626 | 'fnct_params': excluded_journal_types, | 634 | 'fnct_params': excluded_journal_types, |
462 | 627 | }, | 635 | }, |
463 | @@ -631,12 +639,23 @@ | |||
464 | 631 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with | 639 | 'function': 'postprocess_add_db_id', # to take analytic line IDS and make a DB ID with |
465 | 632 | 'fnct_params': 'account.move.line', | 640 | 'fnct_params': 'account.move.line', |
466 | 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)), |
467 | 634 | 'query_tpl_context': rawdata_tpl_context, | ||
468 | 635 | 'delete_columns': [0], | 642 | 'delete_columns': [0], |
469 | 636 | 'id': 0, | 643 | 'id': 0, |
470 | 637 | 'object': 'account.move.line', | 644 | 'object': 'account.move.line', |
471 | 638 | }, | 645 | }, |
472 | 639 | ] | 646 | ] |
473 | 647 | if plresult_ji_in_ids: | ||
474 | 648 | processrequests.append({ | ||
475 | 649 | 'filename': instance_name + '_' + year + month + '_Monthly Export.csv', | ||
476 | 650 | 'key': 'plresult', | ||
477 | 651 | 'function': 'postprocess_add_db_id', # to take move line ids and make a DB ID with | ||
478 | 652 | 'fnct_params': 'account.move.line', | ||
479 | 653 | 'query_params': (tuple(plresult_ji_in_ids), tuple(to_export), ), | ||
480 | 654 | 'delete_columns': [0], | ||
481 | 655 | 'id': 0, | ||
482 | 656 | 'object': 'account.move.line', | ||
483 | 657 | }) | ||
484 | 658 | |||
485 | 640 | # Launch finance archive object | 659 | # Launch finance archive object |
486 | 641 | fe = finance_archive(sqlrequests, processrequests) | 660 | fe = finance_archive(sqlrequests, processrequests) |
487 | 642 | # Use archive method to create the archive | 661 | # Use archive method to create the archive |