[IMP] account, taxes report: added an option to print the detail (accounts) or not
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 3 Feb 2012 16:26:19 +0000 (17:26 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 3 Feb 2012 16:26:19 +0000 (17:26 +0100)
bzr revid: qdp-launchpad@openerp.com-20120203162619-obs2ygr45jtpl3g0

addons/account/account.py
addons/account/report/account_tax_report.py
addons/account/wizard/account_vat.py
addons/account/wizard/account_vat_view.xml

index 02c8f82..92e6984 100644 (file)
@@ -1773,6 +1773,7 @@ class account_tax_code(osv.osv):
         'company_id': fields.many2one('res.company', 'Company', required=True),
         'sign': fields.float('Coefficent for parent', required=True, help='You can specify here the coefficient that will be used when consolidating the amount of this case into its parent. For example, set 1/-1 if you want to add/substract it.'),
         'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any VAT related to this Tax Code to appear on invoices"),
+        'sequence': fields.integer('Sequence', help="Determine the display order in the report 'Accounting \ Reporting \ Generic Reporting \ Taxes \ Taxes Report'"),
     }
 
     def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
index a3bdc1a..2a0c598 100644 (file)
@@ -32,6 +32,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
         res = {}
         self.period_ids = []
         period_obj = self.pool.get('account.period')
+        self.display_detail = data['form']['display_detail']
         res['periods'] = ''
         res['fiscalyear'] = data['form'].get('fiscalyear_id', False)
 
@@ -104,6 +105,8 @@ class tax_report(report_sxw.rml_parse, common_report_header):
         return top_result
 
     def _get_general(self, tax_code_id, period_list, company_id, based_on, context=None):
+        if not self.display_detail:
+            return []
         res = []
         obj_account = self.pool.get('account.account')
         periods_ids = tuple(period_list)
@@ -159,7 +162,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
 
     def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=[], context=None):
         obj_tc = self.pool.get('account.tax.code')
-        ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], context=context)
+        ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
 
         res = []
         for code in obj_tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
@@ -229,4 +232,4 @@ class tax_report(report_sxw.rml_parse, common_report_header):
 report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
     'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal")
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index cbdf18d..0770cbe 100644 (file)
@@ -30,6 +30,7 @@ class account_vat_declaration(osv.osv_memory):
                                       ('payments', 'Payments'),],
                                       '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'),
     }
 
     def _get_tax(self, cr, uid, context=None):
index f0e5dcb..d8e7560 100644 (file)
@@ -13,6 +13,7 @@
                 <newline/>
                 <field name="chart_tax_id" widget='selection'/>
                 <field name="fiscalyear_id"/>
+                <field name="display_detail"/>
                 <!--- <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 -->
                 <separator string="Periods"  colspan="4"/>
                 <field name="period_from"  domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>