small changes in partner Balance wizard...

bzr revid: patelamit2003@gmail.com-20081017062919-azy0tzz98ic6made
This commit is contained in:
apa-tiny
2008-10-17 11:59:19 +05:30
parent fe7b7268f0
commit fa7bf25683
@@ -29,30 +29,6 @@ import time
import wizard
import pooler
#report_type = '''<?xml version="1.0"?>
#<form string="Select Report Type">
#</form>'''
#
#
#dates_form = '''<?xml version="1.0"?>
#<form string="Select period">
# <field name="company_id" colspan="4"/>
# <newline/>
# <field name="date1"/>
# <field name="date2"/>
# <newline/>
# <field name="result_selection"/>
# <field name="soldeinit"/>
#</form>'''
#
#dates_fields = {
# 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
# 'result_selection':{'string':"Display partner ",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
# 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
# 'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
# 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
#}
period_form = '''<?xml version="1.0"?>
<form string="Select period" colspan = "4">
<group colspan = "4" >
@@ -85,10 +61,9 @@ period_fields = {
'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
}
class wizard_report(wizard.interface):
def _get_load(self,cr,uid,data,context):
def _get_defaults(self,cr,uid,data,context):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
company_id = user.company_id.id
@@ -104,7 +79,7 @@ class wizard_report(wizard.interface):
data['form']['result_selection'] = 'all'
return data['form']
def _get_defaults(self, cr, uid, data, context):
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'byperiod':
data['form']['fiscalyear'] = True
@@ -113,18 +88,7 @@ class wizard_report(wizard.interface):
data['form']['fiscalyear'] = False
return data['form']
# def _get_defaults_fordate(self, cr, uid, data, context):
# user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
# if user.company_id:
# company_id = user.company_id.id
# else:
# company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
# data['form']['company_id'] = company_id
# data['form']['soldeinit'] = True
# data['form']['result_selection'] = 'all'
# return data['form']
def _check_date(self, cr, uid, data, context):
sql = """
@@ -143,24 +107,12 @@ class wizard_report(wizard.interface):
states = {
'init': {
'actions': [_get_load],
'actions': [_get_defaults],
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
},
# 'with_period': {
# 'actions': [_get_defaults],
# 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
# },
# 'with_date': {
# 'actions': [_get_defaults_fordate],
# 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
# },
## 'checkdate': {
## 'actions': [],
## 'result': {'type':'choice','next_state':_check_date}
## },
'report': {
'actions': [_get_defaults],
'actions': [_check_state],
'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'}
}
}