tax report prob solved.(Amit Patel)
[odoo/odoo.git] / addons / account / wizard / wizard_vat.py
old mode 100644 (file)
new mode 100755 (executable)
index 2d72b0e..62a22e0
@@ -1,9 +1,6 @@
-# -*- encoding: utf-8 -*-
 ##############################################################################
 #
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -34,68 +31,65 @@ import pooler
 
 dates_form = '''<?xml version="1.0"?>
 <form string="Select period">
-    <field name="company_id"/>
-    <newline/>
-    <field name="period_id"/>
-    <newline/>
-    <field name="based_on"/>
+       <field name="company_id"/>
+       <newline/>
+       <field name="based_on"/>
+       <field name="periods" colspan="4"/>
+
+       
 </form>'''
 
 dates_fields = {
-    'company_id': {'string': 'Company', 'type': 'many2one',
-        'relation': 'res.company', 'required': True},
-    'period_id': {'string':'Period', 'type':'many2one',
-        'relation': 'account.period', 'required':True},
-    'based_on':{'string':'Base on', 'type':'selection', 'selection':[
-            ('invoices','Invoices'),
-            ('payments','Payments'),
-            ], 'required':True, 'default': lambda *a: 'invoices'},
+       'company_id': {'string': 'Company', 'type': 'many2one',
+               'relation': 'res.company', 'required': True},
+       'based_on':{'string':'Base on', 'type':'selection', 'selection':[
+                       ('invoices','Invoices'),
+                       ('payments','Payments'),
+                       ], 'required':True, 'default': lambda *a: 'invoices'},
+       'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
+
 }
 
 
 class wizard_report(wizard.interface):
 
-    def _get_defaults(self, cr, uid, data, context):
-        pool = pooler.get_pool(cr.dbname)
-        period_obj = pool.get('account.period')
-        data['form']['period_id'] = period_obj.find(cr, uid)[0]
+       def _get_defaults(self, cr, uid, data, context):
+               pool = pooler.get_pool(cr.dbname)
+               period_obj = pool.get('account.period')
 
-        user = pool.get('res.users').browse(cr, uid, uid, context=context)
-        if user.company_id:
-            company_id = user.company_id.id
-        else:
-            company_id = pool.get('res.company').search(cr, uid,
-                    [('parent_id', '=', False)])[0]
-        data['form']['company_id'] = company_id
+               user = pool.get('res.users').browse(cr, uid, uid, context=context)
+               if user.company_id:
+                       company_id = user.company_id.id
+               else:
+                       company_id = pool.get('res.company').search(cr, uid,
+                                       [('parent_id', '=', False)])[0]
+               data['form']['company_id'] = company_id
 
-        return data['form']
+               return data['form']
 
-    states = {
-        'init': {
-            'actions': [_get_defaults],
-            'result': {
-                'type': 'form',
-                'arch': dates_form,
-                'fields': dates_fields,
-                'state': [
-                    ('end', 'Cancel'),
-                    ('report', 'Print VAT Decl.')
-                ]
-            }
-        },
-        'report': {
-            'actions': [],
-            'result': {
-                'type': 'print',
-                'report': 'account.vat.declaration',
-                'state':'end'
-            }
-        }
-    }
+       states = {
+               'init': {
+                       'actions': [_get_defaults],
+                       'result': {
+                               'type': 'form',
+                               'arch': dates_form,
+                               'fields': dates_fields,
+                               'state': [
+                                       ('end', 'Cancel'),
+                                       ('report', 'Print VAT Decl.')
+                               ]
+                       }
+               },
+               'report': {
+                       'actions': [],
+                       'result': {
+                               'type': 'print',
+                               'report': 'account.vat.declaration',
+                               'state':'end'
+                       }
+               }
+       }
 
 wizard_report('account.vat.declaration')
 
 
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-