[IMP]:account installer

bzr revid: nch@tinyerp.com-20100503102801-p7fxk407o5s1ymyj
This commit is contained in:
nch@tinyerp.com 2010-05-03 15:58:01 +05:30
parent a42aaf14cb
commit 56936a1b0a
2 changed files with 16 additions and 18 deletions

View File

@ -29,10 +29,13 @@
</xpath>
<group colspan="8">
<field name="charts" colspan="8"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<field name="account_followup"/>
<field name="account_asset"/>
<group colspan="4" groups="base.group_extended">
<separator col="4" colspan="4" string="Install Extra Account Module"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<field name="account_followup"/>
<field name="account_asset"/>
</group>
<group colspan="4" attrs="{'invisible':[('charts','=',False)]}">
<separator col="4" colspan="4" string="Bank and Cost Account"/>
<field name="account_name" colspan="2"/>
@ -40,9 +43,7 @@
<field name="account_currency" colspan="2" widget="selection"/>
</group>
<group colspan="4">
<separator col="4" colspan="4" string="Fiscal Year"/>
<field name="name"/>
<field name="code"/>
<separator col="4" colspan="4" string="Configure Fiscal Year"/>
<field name="date_start" on_change="on_change_start_date(date_start)"/>
<field name="date_stop"/>
<field name="period" colspan="4"/>

View File

@ -60,21 +60,15 @@ class account_installer(osv.osv_memory):
'account_asset':fields.boolean('Assets Management',
help="Enables asset management in the accounting application, "
"including asset categories and usage periods."),
'name':fields.char('Name', required=True, size=64,
help="Name of the fiscal year as displayed on screens."),
'code':fields.char('Code', required=True, size=64,
help="Name of the fiscal year as displayed in reports."),
'date_start': fields.date('Start Date', required=True),
'date_stop': fields.date('End Date', required=True),
'period':fields.selection([('month','Month'), ('3months','3 Months')],
'period':fields.selection([('month','Monthly'), ('3months','3 Monthly')],
'Periods', required=True),
'account_name':fields.char('Name', size=128),
'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
'account_currency':fields.many2one('res.currency', 'Currency')
}
_defaults = {
'code': lambda *a: time.strftime('%Y'),
'name': lambda *a: time.strftime('%Y'),
'date_start': lambda *a: time.strftime('%Y-01-01'),
'date_stop': lambda *a: time.strftime('%Y-12-31'),
'period':lambda *a:'month',
@ -91,11 +85,14 @@ class account_installer(osv.osv_memory):
def execute(self, cr, uid, ids, context=None):
super(account_installer, self).execute(cr, uid, ids, context=context)
for res in self.read(cr,uid,ids):
if 'date1' in res and 'date2' in res:
if 'date_start' in res and 'date_stop' in res:
name = res['date_start'][:4]
if int(name) != int(res['date_stop'][:4]):
name = res['date_start'][:4] +'-'+ res['date_stop'][:4]
code = res['date_start'][2:4] +'-'+ res['date_stop'][2:4]
res_obj = self.pool.get('account.fiscalyear')
name = res['name']
vals = {'name':res['name'],
'code':res['code'],
vals = {'name':name,
'code':code,
'date_start':res['date_start'],
'date_stop':res['date_stop'],
}