← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/ocb-addons/7.0-fix-1220732 into lp:ocb-addons

 

Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/ocb-addons/7.0-fix-1220732 into lp:ocb-addons.

Requested reviews:
  Stefan Rijnhart (Therp) (stefan-therp)
  Holger Brunn (Therp) (hbrunn): code review
  Nicolas Bessi - Camptocamp (nbessi-c2c): code review, no test
Related bugs:
  Bug #1220732 in OpenERP Community Backports (Addons): "[7.0/Trunk] Missing 'target move' field selection on account vat declaration wizard "
  https://bugs.launchpad.net/ocb-addons/+bug/1220732

For more details, see:
https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-1220732/+merge/183911
-- 
https://code.launchpad.net/~camptocamp/ocb-addons/7.0-fix-1220732/+merge/183911
Your team OpenERP Community Backports Team is subscribed to branch lp:ocb-addons.
=== modified file 'account/report/account_tax_report.py'
--- account/report/account_tax_report.py	2012-10-23 16:05:04 +0000
+++ account/report/account_tax_report.py	2013-10-16 16:55:46 +0000
@@ -59,16 +59,17 @@
             'get_start_period': self.get_start_period,
             'get_end_period': self.get_end_period,
             'get_basedon': self._get_basedon,
+            'get_target_move': self._get_target_move,
         })
 
     def _get_basedon(self, form):
         return form['form']['based_on']
 
-    def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
+    def _get_lines(self, based_on, target_move, company_id=False, parent=False, level=0, context=None):
         period_list = self.period_ids
         res = self._get_codes(based_on, company_id, parent, level, period_list, context=context)
         if period_list:
-            res = self._add_codes(based_on, res, period_list, context=context)
+            res = self._add_codes(based_on, target_move, res, period_list, context=context)
         else:
             self.cr.execute ("select id from account_fiscalyear")
             fy = self.cr.fetchall()
@@ -76,7 +77,7 @@
             periods = self.cr.fetchall()
             for p in periods:
                 period_list.append(p[0])
-            res = self._add_codes(based_on, res, period_list, context=context)
+            res = self._add_codes(based_on, target_move, res, period_list, context=context)
 
         i = 0
         top_result = []
@@ -171,18 +172,26 @@
             res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
         return res
 
-    def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
+    def _add_codes(self, based_on, target_move, account_list=None, period_list=None, context=None):
         if account_list is None:
             account_list = []
         if period_list is None:
             period_list = []
+        if context is None:
+            context = {}
         res = []
         obj_tc = self.pool.get('account.tax.code')
         for account in account_list:
             ids = obj_tc.search(self.cr, self.uid, [('id','=', account[1].id)], context=context)
             sum_tax_add = 0
-            for period_ind in period_list:
-                for code in obj_tc.browse(self.cr, self.uid, ids, {'period_id':period_ind,'based_on': based_on}):
+            for period_id in period_list:
+                ctx = context.copy()
+                ctx.update(
+                        period_id=period_id,
+                        based_on=based_on,
+                        state=target_move,
+                        )
+                for code in obj_tc.browse(self.cr, self.uid, ids, context=ctx):
                     sum_tax_add = sum_tax_add + code.sum_period
 
             code.sum_period = sum_tax_add

=== modified file 'account/report/account_tax_report.rml'
--- account/report/account_tax_report.rml	2011-12-21 09:08:11 +0000
+++ account/report/account_tax_report.rml	2013-10-16 16:55:46 +0000
@@ -138,7 +138,10 @@
 				</tr>
 			</blockTable>
 		</td>
-		<td><para style="terp_default_Centre_8">[[ get_basedon(data)  or '' ]]</para></td>
+                <td>
+                    <para style="terp_default_Centre_8">[[ get_basedon(data)  or '' ]]</para>
+                    <para style="terp_default_Centre_8">[[ get_target_move(data) or '' ]]</para>
+                </td>
    </tr>
   </blockTable>
   <para style="P2"><font color="white"> </font></para>
@@ -150,7 +153,7 @@
 	    <td><para style="P12a">Tax Amount</para></td>
 	  </tr>
 	  <tr>
-	       <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>
+	       <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>
            <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>
            <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>
            <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>

=== modified file 'account/report/account_tax_report.sxw'
Binary files account/report/account_tax_report.sxw	2011-01-14 00:11:01 +0000 and account/report/account_tax_report.sxw	2013-10-16 16:55:46 +0000 differ
=== modified file 'account/wizard/account_vat.py'
--- account/wizard/account_vat.py	2012-10-23 16:05:04 +0000
+++ account/wizard/account_vat.py	2013-10-16 16:55:46 +0000
@@ -31,6 +31,9 @@
                                       'Based on', required=True),
         'chart_tax_id': fields.many2one('account.tax.code', 'Chart of Tax', help='Select Charts of Taxes', required=True, domain = [('parent_id','=', False)]),
         'display_detail': fields.boolean('Display Detail'),
+        'target_move': fields.selection([('posted', 'All Posted Entries'),
+                                         ('all', 'All Entries'),
+                                         ], 'Target Moves', required=True),
     }
 
     def _get_tax(self, cr, uid, context=None):

=== modified file 'account/wizard/account_vat_view.xml'
--- account/wizard/account_vat_view.xml	2012-10-23 16:05:04 +0000
+++ account/wizard/account_vat_view.xml	2013-10-16 16:55:46 +0000
@@ -12,6 +12,7 @@
                     <field name="chart_tax_id" widget='selection'/>
                     <field name="fiscalyear_id"/>
                     <field name="display_detail"/>
+                    <field name="target_move"/>
                     <!--- <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 -->
                 </group>
 


Follow ups