[REM] Account: removed current date from account_model, code cleaning

bzr revid: pap@tinyerp.co.in-20100908104318-hcdzvgrvmspxpwkb
This commit is contained in:
pap (openerp) 2010-09-08 16:13:18 +05:30
parent 3efbdcbd09
commit eaa8f0be8c
3 changed files with 5 additions and 8 deletions

View File

@ -2006,13 +2006,11 @@ class account_model(osv.osv):
'company_id': fields.many2one('res.company', 'Company', required=True),
'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'),
'legend' :fields.text('Legend', readonly=True, size=100),
'date': fields.selection([('today','Date of the day'), ('partner','Partner Payment Term')], 'Current Date', required=True, help="The date of the generated entries"),
}
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
'date': 'today'
}
def generate(self, cr, uid, ids, datas={}, context={}):
move_ids = []

View File

@ -1577,9 +1577,9 @@
<field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="analytic_account_id"/>
<field name="partner_id"/>
<field name="quantity"/>
<field name="debit" select="1"/>
<field name="credit" select="1"/>
<field name="quantity"/>
<field name="date_maturity"/>
</form>
</field>
@ -1594,7 +1594,6 @@
<field name="name" select="1"/>
<field name="journal_id" select="1"/>
<field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
<field name="date" context="{'date': date}"/>
<field colspan="4" nolabel="1" name="lines_id" height="250" widget="one2many_list"/>
<separator string="Legend" colspan="4"/>
<field name="legend" colspan="4" nolabel="1"/>

View File

@ -556,7 +556,7 @@ class account_installer(osv.osv_memory):
ir_values.set(cr, uid, key='default', key2=False, name=name, models =[('product.product',False)], value=[value])
if 'date_start' in res and 'date_stop' in res:
f_ids = res_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id','=',res['company_id'])])
f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id','=',res['company_id'])])
if not f_ids:
name = code = res['date_start'][:4]
if int(name) != int(res['date_stop'][:4]):
@ -568,11 +568,11 @@ class account_installer(osv.osv_memory):
'date_stop': res['date_stop'],
'company_id': res['company_id']
}
period_id = res_obj.create(cr, uid, vals, context=context)
fiscal_id = fy_obj.create(cr, uid, vals, context=context)
if res['period'] == 'month':
res_obj.create_period(cr, uid, [period_id])
fy_obj.create_period(cr, uid, [fiscal_id])
elif res['period'] == '3months':
res_obj.create_period3(cr, uid, [period_id])
fy_obj.create_period3(cr, uid, [fiscal_id])
# #fially inactive the demo chart of accounts
# data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')])