[IMP] account: performance improvement on the creation of new account.move (opw #597719)
bzr revid: mat@openerp.com-20130918143146-bnmoje96alatdyc1
This commit is contained in:
parent
d30f5e8be6
commit
f37b2a0db4
|
@ -1425,14 +1425,17 @@ class account_move(osv.osv):
|
|||
l[2]['period_id'] = default_period
|
||||
context['period_id'] = default_period
|
||||
|
||||
if 'line_id' in vals:
|
||||
if vals.get('line_id', False):
|
||||
c = context.copy()
|
||||
c['novalidate'] = True
|
||||
c['period_id'] = vals['period_id'] if 'period_id' in vals else self._get_period(cr, uid, context)
|
||||
c['journal_id'] = vals['journal_id']
|
||||
if 'date' in vals: c['date'] = vals['date']
|
||||
result = super(account_move, self).create(cr, uid, vals, c)
|
||||
self.validate(cr, uid, [result], context)
|
||||
tmp = self.validate(cr, uid, [result], context)
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context)
|
||||
if journal.entry_posted and tmp:
|
||||
self.button_validate(cr,uid, [result], context)
|
||||
else:
|
||||
result = super(account_move, self).create(cr, uid, vals, context)
|
||||
return result
|
||||
|
|
|
@ -1284,7 +1284,7 @@ class account_move_line(osv.osv):
|
|||
self.create(cr, uid, data, context)
|
||||
del vals['account_tax_id']
|
||||
|
||||
if check and ((not context.get('no_store_function')) or journal.entry_posted):
|
||||
if check and not context.get('novalidate') and ((not context.get('no_store_function')) or journal.entry_posted):
|
||||
tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
|
||||
if journal.entry_posted and tmp:
|
||||
move_obj.button_validate(cr,uid, [vals['move_id']], context)
|
||||
|
|
Loading…
Reference in New Issue