Default value for the period within the journal

bzr revid: fp@tinyerp.com-5b8439a0b6e41d2faa77bc1ebb7459f24c6fc46e
This commit is contained in:
Fabien Pinckaers
2007-06-18 04:10:14 +00:00
parent e4fa54491e
commit 5b16ae402a
+15 -2
View File
@@ -37,9 +37,22 @@ _journal_form = '''<?xml version="1.0"?>
<field name="period_id"/>
</form>'''
def _period_get(self, cr, uid, datas, ctx={}):
try:
pool = pooler.get_pool(cr.dbname)
ids = pool.get('account.period').find(cr, uid, context=ctx)
return {'period_id': ids[0]}
except:
return {}
_journal_fields = {
'journal_id': {'string':'Journal', 'type':'many2one', 'relation':'account.journal', 'required':True},
'period_id': {'string':'Period', 'type':'many2one', 'relation':'account.period', 'required':True}
'period_id': {
'string':'Period',
'type':'many2one',
'relation':'account.period',
'required':True,
}
}
def _action_open_window(self, cr, uid, data, context):
@@ -68,7 +81,7 @@ def _action_open_window(self, cr, uid, data, context):
class wiz_journal(wizard.interface):
states = {
'init': {
'actions': [],
'actions': [_period_get],
'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open Journal')]}
},
'open': {