added boolean field on journal and modify move object
bzr revid: mra@tinyerp.com-20080822085708-ijrakip4amwlgoy1
This commit is contained in:
parent
d7b6dab4d5
commit
a2acce64f6
|
@ -423,6 +423,7 @@ class account_journal(osv.osv):
|
|||
'user_id': fields.many2one('res.users', 'User', help="The responsible user of this journal"),
|
||||
'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'),
|
||||
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
|
||||
'entry_posted': fields.boolean('Allow Entries in Posted'),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
|
@ -715,10 +716,13 @@ class account_move(osv.osv):
|
|||
vals['name'] = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
else:
|
||||
raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
|
||||
accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'])
|
||||
if 'line_id' in vals:
|
||||
c = context.copy()
|
||||
c['novalidate'] = True
|
||||
result = super(account_move, self).create(cr, uid, vals, c)
|
||||
if accnt_journal.entry_posted:
|
||||
cr.execute('update account_move set state=%s where id in ('+','.join(map(str,[result]))+')', ('posted',))
|
||||
self.validate(cr, uid, [result], context)
|
||||
else:
|
||||
result = super(account_move, self).create(cr, uid, vals, context)
|
||||
|
|
|
@ -256,6 +256,7 @@
|
|||
<newline/>
|
||||
<field name="centralisation"/>
|
||||
<field name="update_posted"/>
|
||||
<field name="entry_posted"/>
|
||||
</page>
|
||||
<page string="Entry Controls">
|
||||
<separator colspan="4" string="Accounts Type Allowed (empty for no control)"/>
|
||||
|
|
Loading…
Reference in New Issue