Merge lp:~unifield-team/unifield-server/us-1197 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 3710
Proposed branch: lp:~unifield-team/unifield-server/us-1197
Merge into: lp:unifield-server
Diff against target: 380 lines (+124/-72)
5 files modified
bin/addons/account/report/account_general_ledger.py (+34/-6)
bin/addons/account/report/account_general_ledger_landscape.rml (+11/-5)
bin/addons/account/report/account_general_ledger_xls.mako (+27/-21)
bin/addons/account/wizard/account_report_general_ledger.py (+1/-3)
bin/addons/finance/account_drill.py (+51/-37)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1197
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+291888@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/account/report/account_general_ledger.py'
--- bin/addons/account/report/account_general_ledger.py 2016-04-06 14:00:48 +0000
+++ bin/addons/account/report/account_general_ledger.py 2016-04-14 13:25:24 +0000
@@ -66,6 +66,18 @@
66 'show_period_0': 1,66 'show_period_0': 1,
67 'state_agnostic': 1,67 'state_agnostic': 1,
68 })68 })
69 # US-1197/4: IB entries for yearly closing always in 1th Jan
70 # => get rid of regular period/dates filters for _query_get
71 # => if self.init_balance is True, note that filtering is OK
72 # validated at wizard report level
73 ib_local_context.update({
74 'date_from': False,
75 'date_to': False,
76 'date_fromto_docdate': False,
77 'period_from': False,
78 'period_to': False,
79 'periods': False,
80 })
69 self.init_query = obj_move._query_get(self.cr, self.uid, obj='l',81 self.init_query = obj_move._query_get(self.cr, self.uid, obj='l',
70 context=ib_local_context)82 context=ib_local_context)
71 else:83 else:
@@ -226,12 +238,18 @@
226238
227 def _show_node_in_report(self, node):239 def _show_node_in_report(self, node):
228 res = True240 res = True
229 if self.account_ids or self.unreconciled_filter:241 if node.parent is None:
230 # hide if zero bal and any by account or unreconciled filter on242 return res # always show root account MSF
231 bal = node.data.get('*', {}).get('debit', 0.) \243 if self.account_ids or self.account_report_types \
232 - node.data.get('*', {}).get('credit', 0.)244 or self.unreconciled_filter:
233 if bal == 0.:245 res = not node.skip
234 res = False246 if res:
247 # hide if zero bal and any by account or unreconciled filter on
248 bal = node.data.get('*', {}).get('debit', 0.) \
249 - node.data.get('*', {}).get('credit', 0.)
250 if bal == 0.:
251 res = False
252
235 return res253 return res
236254
237 def _get_journals_str(self, data):255 def _get_journals_str(self, data):
@@ -393,6 +411,7 @@
393 line = self.get_start_period(data) + ' - ' + self.get_end_period(data)411 line = self.get_start_period(data) + ' - ' + self.get_end_period(data)
394 if line:412 if line:
395 infos.append(line)413 infos.append(line)
414
396 return infos and ", \n".join(infos) or _('No Filter')415 return infos and ", \n".join(infos) or _('No Filter')
397 416
398 def _get_line_debit(self, line, booking=False):417 def _get_line_debit(self, line, booking=False):
@@ -479,6 +498,15 @@
479 display_account = _('With balance is not equal to 0')498 display_account = _('With balance is not equal to 0')
480 info_data.append((_('Accounts'), display_account, ))499 info_data.append((_('Accounts'), display_account, ))
481500
501 account_ids = list(set(self._get_data_form(data, 'account_ids')))
502 if account_ids:
503 # US-1197/2: display filtered accounts
504 account_obj = self.pool.get('account.account')
505 info_data.append((_('Selected Accounts'), ', '.join(
506 [ a.code for a in account_obj.browse(
507 self.cr, self.uid, account_ids) \
508 if a.type != 'view' ], )))
509
482 res = [ "%s: %s" % (label, val, ) for label, val in info_data ]510 res = [ "%s: %s" % (label, val, ) for label, val in info_data ]
483 return ', \n'.join(res)511 return ', \n'.join(res)
484512
485513
=== modified file 'bin/addons/account/report/account_general_ledger_landscape.rml'
--- bin/addons/account/report/account_general_ledger_landscape.rml 2016-03-31 09:45:40 +0000
+++ bin/addons/account/report/account_general_ledger_landscape.rml 2016-04-14 13:25:24 +0000
@@ -248,7 +248,7 @@
248 [[ get_show_move_lines() or removeParentNode('blockTable') ]]248 [[ get_show_move_lines() or removeParentNode('blockTable') ]]
249 <tr>249 <tr>
250 <td>250 <td>
251 <para style="terp_tblheader_Details">Entry Seq</para>251 <para style="terp_tblheader_Details">Account/Entry Seq</para>
252 </td>252 </td>
253 <td>253 <td>
254 <para style="terp_tblheader_Details">Posting Date</para>254 <para style="terp_tblheader_Details">Posting Date</para>
@@ -330,14 +330,17 @@
330330
331 <section>331 <section>
332 <para style="terp_default_8">[[ repeatIn(lines(o, initial_balance_mode=True), 'line') ]]</para>332 <para style="terp_default_8">[[ repeatIn(lines(o, initial_balance_mode=True), 'line') ]]</para>
333 <blockTable colWidths="286.0,60.0,110.0,110.0,110.0,110.0" style="Table9">333 <blockTable colWidths="40.0,246.0,60.0,110.0,110.0,110.0,110.0" style="Table9">
334 [[ show_node_in_report(o) or removeParentNode('blockTable') ]]334 [[ show_node_in_report(o) or removeParentNode('blockTable') ]]
335 <tr>335 <tr>
336 <td>336 <td>
337 <para style="terp_default_9_Right">[[ o.code or '' ]]</para>
338 </td>
339 <td>
337 <para style="terp_default_9_Right">[[ line['move'] or '' ]]</para>340 <para style="terp_default_9_Right">[[ line['move'] or '' ]]</para>
338 </td>341 </td>
339 <td>342 <td>
340 <para style="terp_def114.0,80.0,92.0,60.0,110.0,110.0,110.0,110.0ault_9_Right">[[ line['currency_name'] or '' ]]</para>343 <para style="terp_default_9_Right">[[ line['currency_name'] or '' ]]</para>
341 </td>344 </td>
342 <td>345 <td>
343 <para style="terp_default_9_Right">[[ formatLang(get_line_debit(line, booking=True), digits=get_digits(dp='Account')) ]]</para>346 <para style="terp_default_9_Right">[[ formatLang(get_line_debit(line, booking=True), digits=get_digits(dp='Account')) ]]</para>
@@ -390,11 +393,14 @@
390393
391 <section>394 <section>
392 <para style="terp_default_8">[[ repeatIn(o.get_currencies(), 'ccy') ]]</para>395 <para style="terp_default_8">[[ repeatIn(o.get_currencies(), 'ccy') ]]</para>
393 <blockTable colWidths="286.0,60.0,110.0,110.0,110.0,110.0" style="Table8_subtotal_ccy">396 <blockTable colWidths="40.0,246.0,60.0,110.0,110.0,110.0,110.0" style="Table8_subtotal_ccy">
394 [[ show_node_in_report(o) or removeParentNode('blockTable') ]]397 [[ show_node_in_report(o) or removeParentNode('blockTable') ]]
395 <tr>398 <tr>
396 <td>399 <td>
397 <para style="terp_default_9_Right">[[ o.code ]]</para>400 <para style="terp_default_9_Right">[[ o.code or '' ]]</para>
401 </td>
402 <td>
403 <para style="terp_default_9_Right">Sub Total</para>
398 </td>404 </td>
399 <td>405 <td>
400 <para style="terp_default_9_Right">[[ ccy ]]</para>406 <para style="terp_default_9_Right">[[ ccy ]]</para>
401407
=== modified file 'bin/addons/account/report/account_general_ledger_xls.mako'
--- bin/addons/account/report/account_general_ledger_xls.mako 2016-03-23 14:52:23 +0000
+++ bin/addons/account/report/account_general_ledger_xls.mako 2016-04-14 13:25:24 +0000
@@ -187,21 +187,15 @@
187 display_account = (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0'187 display_account = (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0'
188%>188%>
189<Table x:FullColumns="1" x:FullRows="1">189<Table x:FullColumns="1" x:FullRows="1">
190<Column ss:AutoFitWidth="1" ss:Width="64" />190<Column ss:AutoFitWidth="1" ss:Width="50" />
191<Column ss:AutoFitWidth="1" ss:Width="120" />191<Column ss:AutoFitWidth="1" ss:Width="80" />
192<Column ss:AutoFitWidth="1" ss:Width="64" />192<Column ss:AutoFitWidth="1" ss:Width="55" />
193% if get_show_move_lines():193<Column ss:AutoFitWidth="1" ss:Width="80" />
194<Column ss:AutoFitWidth="1" ss:Width="300" />194<Column ss:AutoFitWidth="1" ss:Width="50" />
195% endif195<Column ss:Width="90" />
196% if not get_show_move_lines():196<Column ss:Width="90" />
197<Column ss:AutoFitWidth="1" ss:Width="150" />197<Column ss:Width="90" />
198% endif198<Column ss:Width="90" />
199<Column ss:AutoFitWidth="1" ss:Width="50" />
200<Column ss:AutoFitWidth="1" ss:Width="64" />
201<Column ss:AutoFitWidth="1" ss:Width="64" />
202<Column ss:AutoFitWidth="1" ss:Width="64" />
203<Column ss:AutoFitWidth="1" ss:Width="64" />
204<Column ss:AutoFitWidth="1" ss:Width="64" />
205<Row>199<Row>
206<Cell ss:StyleID="ssH"><Data ss:Type="String">${header_company_or_chart_of_account}</Data></Cell>200<Cell ss:StyleID="ssH"><Data ss:Type="String">${header_company_or_chart_of_account}</Data></Cell>
207<Cell ss:StyleID="ssH"><Data ss:Type="String">Fiscal Year</Data></Cell>201<Cell ss:StyleID="ssH"><Data ss:Type="String">Fiscal Year</Data></Cell>
@@ -246,13 +240,14 @@
246</Row>240</Row>
247<Row>241<Row>
248% if get_show_move_lines():242% if get_show_move_lines():
249<Cell ss:StyleID="ssH" ss:MergeAcross="1"><Data ss:Type="String">Entry Seq</Data></Cell>243<Cell ss:StyleID="ssH"><Data ss:Type="String">Account</Data></Cell>
244<Cell ss:StyleID="ssH"><Data ss:Type="String">Entry Seq</Data></Cell>
250<Cell ss:StyleID="ssH"><Data ss:Type="String">Posting Date</Data></Cell>245<Cell ss:StyleID="ssH"><Data ss:Type="String">Posting Date</Data></Cell>
251<Cell ss:StyleID="ssH"><Data ss:Type="String">Description</Data></Cell>246<Cell ss:StyleID="ssH"><Data ss:Type="String">Description</Data></Cell>
252<Cell ss:StyleID="ssH"><Data ss:Type="String">Currency</Data></Cell>247<Cell ss:StyleID="ssH"><Data ss:Type="String">Currency</Data></Cell>
253% endif248% endif
254% if not get_show_move_lines():249% if not get_show_move_lines():
255<Cell ss:StyleID="ssH"><Data ss:Type="String">Account / CCY</Data></Cell>250<Cell ss:StyleID="ssH"><Data ss:Type="String">Account</Data></Cell>
256<Cell ss:StyleID="ssH" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell>251<Cell ss:StyleID="ssH" ss:MergeAcross="2"><Data ss:Type="String"></Data></Cell>
257<Cell ss:StyleID="ssH"><Data ss:Type="String">Currency</Data></Cell>252<Cell ss:StyleID="ssH"><Data ss:Type="String">Currency</Data></Cell>
258% endif253% endif
@@ -301,7 +296,10 @@
301296
302% for line in lines(o, initial_balance_mode=True):297% for line in lines(o, initial_balance_mode=True):
303<Row>298<Row>
304<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}" ss:MergeAcross="3">299<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}">
300 <Data ss:Type="String">${(o.code or '')|x}</Data>
301</Cell>
302<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}" ss:MergeAcross="2">
305 <Data ss:Type="String">${(line['move'] or '' or '')|x}</Data>303 <Data ss:Type="String">${(line['move'] or '' or '')|x}</Data>
306</Cell>304</Cell>
307<Cell ss:StyleID="ssAccountLine${ccy_sub_total_style_suffix}">305<Cell ss:StyleID="ssAccountLine${ccy_sub_total_style_suffix}">
@@ -333,7 +331,7 @@
333<Cell ss:StyleID="ssAccountLine">331<Cell ss:StyleID="ssAccountLine">
334 <Data ss:Type="String">${(formatLang(line['ldate'],date=True)) or ''}</Data>332 <Data ss:Type="String">${(formatLang(line['ldate'],date=True)) or ''}</Data>
335</Cell>333</Cell>
336<Cell ss:StyleID="ssAccountLineNoWrap">334<Cell ss:StyleID="ssAccountLine">
337 <Data ss:Type="String">${(line['lname'] or '')|x}</Data>335 <Data ss:Type="String">${(line['lname'] or '')|x}</Data>
338</Cell>336</Cell>
339<Cell ss:StyleID="ssAccountLine">337<Cell ss:StyleID="ssAccountLine">
@@ -356,9 +354,12 @@
356354
357% for ccy in o.get_currencies():355% for ccy in o.get_currencies():
358<Row>356<Row>
359<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}" ss:MergeAcross="3">357<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}">
360 <Data ss:Type="String">${(o.code or '')|x}</Data>358 <Data ss:Type="String">${(o.code or '')|x}</Data>
361</Cell>359</Cell>
360<Cell ss:StyleID="ssBorder${ccy_sub_total_style_suffix}${ccy_sub_total_style_right_suffix}" ss:MergeAcross="2">
361 <Data ss:Type="String">Sub Total</Data>
362</Cell>
362<Cell ss:StyleID="ssAccountLine${ccy_sub_total_style_suffix}">363<Cell ss:StyleID="ssAccountLine${ccy_sub_total_style_suffix}">
363 <Data ss:Type="String">${(ccy or '')|x}</Data>364 <Data ss:Type="String">${(ccy or '')|x}</Data>
364</Cell>365</Cell>
@@ -383,7 +384,12 @@
383<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">384<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
384 <PageSetup>385 <PageSetup>
385 <Layout x:Orientation="Landscape"/>386 <Layout x:Orientation="Landscape"/>
386 <Header x:Data="&amp;C&amp;&quot;Arial,Bold&quot;&amp;14General Ledger"/>387% if get_show_move_lines():
388 <Header x:Data="&amp;C&amp;&quot;Arial,Bold&quot;&amp;14General Ledger"/>0
389% endif
390% if not get_show_move_lines():
391 <Header x:Data="&amp;C&amp;&quot;Arial,Bold&quot;&amp;14Trial Balance"/>0
392% endif
387 <Footer x:Data="Page &amp;P of &amp;N"/>393 <Footer x:Data="Page &amp;P of &amp;N"/>
388 </PageSetup>394 </PageSetup>
389 <Print>395 <Print>
390396
=== modified file 'bin/addons/account/wizard/account_report_general_ledger.py'
--- bin/addons/account/wizard/account_report_general_ledger.py 2016-03-23 14:52:23 +0000
+++ bin/addons/account/wizard/account_report_general_ledger.py 2016-04-14 13:25:24 +0000
@@ -128,9 +128,7 @@
128 fy_rec = self.pool.get('account.fiscalyear').browse(cr, uid,128 fy_rec = self.pool.get('account.fiscalyear').browse(cr, uid,
129 fiscalyear_id, context=context)129 fiscalyear_id, context=context)
130 if filter in ('filter_date_doc', 'filter_date', ):130 if filter in ('filter_date_doc', 'filter_date', ):
131 ib_available = date_from and date_to \131 ib_available = date_from and date_from == fy_rec.date_start
132 and date_from == fy_rec.date_start \
133 and date_to <= fy_rec.date_stop
134 elif filter in 'filter_period':132 elif filter in 'filter_period':
135 if not period_from or not period_to:133 if not period_from or not period_to:
136 ib_available = False134 ib_available = False
137135
=== modified file 'bin/addons/finance/account_drill.py'
--- bin/addons/finance/account_drill.py 2016-03-17 08:07:51 +0000
+++ bin/addons/finance/account_drill.py 2016-04-14 13:25:24 +0000
@@ -41,6 +41,7 @@
41 # set during map/reduce41 # set during map/reduce
42 self.data = {}42 self.data = {}
43 self.zero_bal = False43 self.zero_bal = False
44 self.skip = False
4445
45 # set during next_node() calls46 # set during next_node() calls
46 self.code = ''47 self.code = ''
@@ -80,12 +81,11 @@
80 JOIN res_currency c ON (c.id = l.currency_id)81 JOIN res_currency c ON (c.id = l.currency_id)
81 JOIN account_journal j on (l.journal_id=j.id)82 JOIN account_journal j on (l.journal_id=j.id)
82 JOIN account_account a on (a.id=l.account_id)83 JOIN account_account a on (a.id=l.account_id)
83 JOIN account_account_type at on (at.id=a.user_type)84 WHERE l.account_id = %s{reconcile}{query}
84 WHERE l.account_id = %s{reconcile}{options}{query}
85 GROUP BY l.currency_id'''85 GROUP BY l.currency_id'''
8686
87 # initial balance move lines base query (from IB journal period 0)87 # initial balance move lines base query (from IB journal period 0)
88 _sql_ib = '''SELECT sum(debit), sum(credit),88 _sql_ib = '''SELECT sum(debit), sum(credit),
89 sum(debit_currency), sum(credit_currency),89 sum(debit_currency), sum(credit_currency),
90 max(c.name)90 max(c.name)
91 FROM account_move_line l91 FROM account_move_line l
@@ -112,8 +112,28 @@
112 self.query_ib = query_ib or ''112 self.query_ib = query_ib or ''
113 self.move_states = move_states or [ 'draft', 'posted', ]113 self.move_states = move_states or [ 'draft', 'posted', ]
114 self.include_accounts = include_accounts114 self.include_accounts = include_accounts
115 self.account_report_types = account_report_types
115 self.with_balance_only = with_balance_only116 self.with_balance_only = with_balance_only
116 self.reconcile_filter = reconcile_filter117 self.reconcile_filter = reconcile_filter
118 if self.account_report_types and not self.include_accounts:
119 # deduce included accounts from report type filter
120 domain = [
121 ('report_type', 'in' , self.account_report_types),
122 ]
123 if 'asset' in self.account_report_types \
124 or 'liability' in self.account_report_types:
125 # US-227 include tax account for BS accounts selection
126 domain = [ '|', ('code', '=', 'tax') ] + domain
127 account_types_ids = self.pool.get('account.account.type').search(
128 self.cr, self.uid, domain, context=self.context)
129
130 if account_types_ids:
131 domain = [
132 ('type', '!=', 'view'),
133 ('user_type', 'in' , account_types_ids),
134 ]
135 self.include_accounts = self.pool.get('account.account').search(
136 self.cr, self.uid, domain, context=self.context) or []
117137
118 # nodes138 # nodes
119 self.root = None139 self.root = None
@@ -125,18 +145,6 @@
125 # JI base query: constructed via _sql145 # JI base query: constructed via _sql
126 self.sql = self._sql146 self.sql = self._sql
127 self.sql = self.sql.replace('{reconcile}', self.reconcile_filter)147 self.sql = self.sql.replace('{reconcile}', self.reconcile_filter)
128 if account_report_types:
129 report_types = [ "'%s'" % (rt, ) for rt in account_report_types ]
130 options = " AND (at.report_type in (%s)" % (
131 ','.join(report_types), )
132 if 'asset' in account_report_types \
133 or 'liability' in account_report_types:
134 # US-227 include tax account for BS accounts selection
135 options += " OR at.code = 'tax'"
136 options += ')'
137 else:
138 options = ''
139 self.sql = self.sql.replace('{options}', options)
140148
141 def output(self):149 def output(self):
142 """150 """
@@ -169,28 +177,31 @@
169177
170 level = self._move_level178 level = self._move_level
171 while level > 0:179 while level > 0:
172 nodes = self.nodes_by_level[level]180 nodes = self.nodes_by_level.get(level)
173 for n in nodes:181 if nodes:
174 if level == self._move_level:182 for n in nodes:
175 if self.with_balance_only:183 if level == self._move_level:
176 bal = n.data.get('*', {}).get('debit', 0.) \184 if self.with_balance_only:
177 - n.data.get('*', {}).get('credit', 0.)185 bal = n.data.get('*', {}).get('debit', 0.) \
178 if bal == 0.:186 - n.data.get('*', {}).get('credit', 0.)
179 # JI level:187 if bal == 0.:
180 # with only balance filter: do not agregate account188 # JI level:
181 # debit/credit with a zero balance189 # with only balance filter: do not agregate account
182 n.zero_bal = True190 # debit/credit with a zero balance
183 continue191 n.zero_bal = True
192 continue
193 elif level == self._move_level - 1:
194 n.skip = not n.childs # no entries due to filtering
184195
185 parent = n.parent196 parent = n.parent
186 if parent:197 if parent:
187 for ccy in n.data:198 for ccy in n.data:
188 if not ccy in parent.data:199 if not ccy in parent.data:
189 parent.data[ccy] = {}200 parent.data[ccy] = {}
201 for f in fields:
202 parent.data[ccy][f] = 0.
190 for f in fields:203 for f in fields:
191 parent.data[ccy][f] = 0.204 parent.data[ccy][f] += n.data[ccy].get(f, 0.)
192 for f in fields:
193 parent.data[ccy][f] += n.data[ccy].get(f, 0.)
194 level -= 1 # upper level (upper level by uper level)205 level -= 1 # upper level (upper level by uper level)
195206
196 # uncomment to explore reduced nodes207 # uncomment to explore reduced nodes
@@ -211,10 +222,13 @@
211 child_ids = self._search(domain)222 child_ids = self._search(domain)
212 if child_ids:223 if child_ids:
213 for id in child_ids:224 for id in child_ids:
214 if not self.include_accounts or id in self.include_accounts:225 create = level < self._move_level \
226 or not self.include_accounts or id in self.include_accounts
227 if create:
215 node = self._create_node(parent=parent, level=level,228 node = self._create_node(parent=parent, level=level,
216 account_id=id)229 account_id=id)
217 self._map_dive(node, level + 1)230 if node:
231 self._map_dive(node, level + 1)
218232
219 def _create_node(self, parent=None, level=0, account_id=False):233 def _create_node(self, parent=None, level=0, account_id=False):
220 """234 """

Subscribers

People subscribed via source and target branches

to all changes: