Merge lp:~openerp-dev/openobject-addons/7.0-opw-597492-pna into lp:openobject-addons/7.0

Proposed by Pinakin Nayi (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-597492-pna
Merge into: lp:openobject-addons/7.0
Diff against target: 100 lines (+21/-8)
3 files modified
account/report/account_tax_report.py (+15/-6)
account/report/account_tax_report.rml (+5/-2)
account/wizard/account_vat_view.xml (+1/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-597492-pna
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp (community) Needs Fixing
Naresh(OpenERP) Pending
Review via email: mp+187151@code.launchpad.net

Description of the change

Hello Sir,

Improved account tax report.

The 'target move' field selection on the account vat declaration wizard is missing.
By default, OpenERP select posted entries only.

However, since it is not mandatory to post accounting entries before using this wizard, vat report generated can be wrong.

So add the 'target move' field selection so the user can decide to includes or not the draft entries.

Thanks,
pna

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Hello just a remark about credits.

As this branche was made (2013-09-24) after mine was proposed (2013-09-04) and I can see my own changes a little line about authoring would be much appreciated.

https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-1220732

I agree there was few improvement that I will synchronize on ocb-addons MP but part of this change was done by me. At least the 'Courtesy of' in commit message would be appreciated ... And much better would be a commit with my actual patch with correct --author parameters and a second with the changes made by you.

review: Needs Fixing

Unmerged revisions

9474. By Pinakin Nayi (OpenERP)

[IMP]account : add target moves in tax report

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/report/account_tax_report.py'
2--- account/report/account_tax_report.py 2012-12-06 14:56:32 +0000
3+++ account/report/account_tax_report.py 2013-09-24 05:52:14 +0000
4@@ -59,16 +59,17 @@
5 'get_start_period': self.get_start_period,
6 'get_end_period': self.get_end_period,
7 'get_basedon': self._get_basedon,
8+ 'get_target_move': self._get_target_move,
9 })
10
11 def _get_basedon(self, form):
12 return form['form']['based_on']
13
14- def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
15+ def _get_lines(self, based_on, target_move, company_id=False, parent=False, level=0, context=None):
16 period_list = self.period_ids
17 res = self._get_codes(based_on, company_id, parent, level, period_list, context=context)
18 if period_list:
19- res = self._add_codes(based_on, res, period_list, context=context)
20+ res = self._add_codes(based_on, target_move, res, period_list, context=context)
21 else:
22 self.cr.execute ("select id from account_fiscalyear")
23 fy = self.cr.fetchall()
24@@ -76,7 +77,7 @@
25 periods = self.cr.fetchall()
26 for p in periods:
27 period_list.append(p[0])
28- res = self._add_codes(based_on, res, period_list, context=context)
29+ res = self._add_codes(based_on, target_move, res, period_list, context=context)
30
31 i = 0
32 top_result = []
33@@ -171,18 +172,26 @@
34 res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
35 return res
36
37- def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
38+ def _add_codes(self, based_on, target_move, account_list=None, period_list=None, context=None):
39 if account_list is None:
40 account_list = []
41 if period_list is None:
42 period_list = []
43+ if context is None:
44+ context = {}
45 res = []
46 obj_tc = self.pool.get('account.tax.code')
47 for account in account_list:
48 ids = obj_tc.search(self.cr, self.uid, [('id','=', account[1].id)], context=context)
49 sum_tax_add = 0
50- for period_ind in period_list:
51- for code in obj_tc.browse(self.cr, self.uid, ids, {'period_id':period_ind,'based_on': based_on}):
52+ for period_id in period_list:
53+ ctx = context.copy()
54+ ctx.update(
55+ period_id=period_id,
56+ based_on=based_on,
57+ state=target_move,
58+ )
59+ for code in obj_tc.browse(self.cr, self.uid, ids, context=ctx):
60 sum_tax_add = sum_tax_add + code.sum_period
61
62 code.sum_period = sum_tax_add
63
64=== modified file 'account/report/account_tax_report.rml'
65--- account/report/account_tax_report.rml 2011-12-21 09:08:11 +0000
66+++ account/report/account_tax_report.rml 2013-09-24 05:52:14 +0000
67@@ -138,7 +138,10 @@
68 </tr>
69 </blockTable>
70 </td>
71- <td><para style="terp_default_Centre_8">[[ get_basedon(data) or '' ]]</para></td>
72+ <td>
73+ <para style="terp_default_Centre_8">[[ get_basedon(data) or '' ]]</para>
74+ <para style="terp_default_Centre_8">[[ get_target_move(data) or '' ]]</para>
75+ </td>
76 </tr>
77 </blockTable>
78 <para style="P2"><font color="white"> </font></para>
79@@ -150,7 +153,7 @@
80 <td><para style="P12a">Tax Amount</para></td>
81 </tr>
82 <tr>
83- <td><para style="P5"><font>[[ repeatIn(get_lines(data['form']['based_on'], data['form']['company_id']), 'o') ]]</font><font color="white">[[ (o['level']) ]]</font> <font>[[ (len(o['level'])&lt;5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]]</font><font>[[ o['code'] ]] [[ o['name'] ]] </font></para></td>
84+ <td><para style="P5"><font>[[ repeatIn(get_lines(data['form']['based_on'], data['form']['target_move'],data['form']['company_id']), 'o') ]]</font><font color="white">[[ (o['level']) ]]</font> <font>[[ (len(o['level'])&lt;5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]]</font><font>[[ o['code'] ]] [[ o['name'] ]] </font></para></td>
85 <td><para style="P6"><font>[[ len(o['level'])&lt;5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]</font><font>[[ o['type']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]</font></para></td>
86 <td><para style="P6"><font>[[ len(o['level'])&lt;5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['credit']) ]]</font><font>[[ o['type']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]]</font></para></td>
87 <td><para style="P6"><font>[[ len(o['level'])&lt;5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]]</font><font>[[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]</font><font>[[ o['type']&lt;&gt;'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]</font> </para></td>
88
89=== modified file 'account/report/account_tax_report.sxw'
90Binary files account/report/account_tax_report.sxw 2011-01-14 00:11:01 +0000 and account/report/account_tax_report.sxw 2013-09-24 05:52:14 +0000 differ
91=== modified file 'account/wizard/account_vat_view.xml'
92--- account/wizard/account_vat_view.xml 2012-11-29 22:26:45 +0000
93+++ account/wizard/account_vat_view.xml 2013-09-24 05:52:14 +0000
94@@ -12,6 +12,7 @@
95 <field name="chart_tax_id" widget='selection'/>
96 <field name="fiscalyear_id"/>
97 <field name="display_detail"/>
98+ <field name="target_move"/>
99 <!--- <field name="based_on"/>--> <!-- the option based_on 'payment' is probably not fully compliant with what the users understand with that term. So, currently, it's seems better to remove it from the view to avoid further problems -->
100 </group>
101