*pushed mra's work:

*added a boolean field on account_journal that allow the user to skip the draft state of the account_move created (going directly to posted)

bzr revid: qdp@tinyerp.com-20080825123634-1laxkpvmpu0lakl0
This commit is contained in:
qdp 2008-08-25 14:36:34 +02:00
commit a809f44054
4 changed files with 23 additions and 16 deletions

View File

@ -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('Skip \'Draft\' State of Created Entries', help='Check this box if you don\'t want that new account moves pass through the draft state'),
}
_defaults = {
'active': lambda *a: 1,
@ -715,6 +716,7 @@ 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

View File

@ -289,6 +289,8 @@ class account_bank_statement(osv.osv):
except:
raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount))
if st.journal_id.entry_posted:
account_move_obj.write(cr, uid, [move_id], {'state':'posted'})
done.append(st.id)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
return True

View File

@ -732,7 +732,9 @@ class account_move_line(osv.osv):
print data
self.create(cr, uid, data, context)
if check:
self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
if journal.entry_posted and tmp:
self.pool.get('account.move').write(cr,uid, [vals['move_id']],{'state':'posted'})
return result
account_move_line()

View File

@ -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)"/>