[IMP] Speedup test account_assert_test.xml in account
This commit is contained in:
parent
69d60465ee
commit
1a826e07fe
|
@ -1157,6 +1157,19 @@ class account_move(osv.osv):
|
|||
_description = "Account Entry"
|
||||
_order = 'id desc'
|
||||
|
||||
def account_assert_balanced(self, cr, uid, context=None):
|
||||
cr.execute("""\
|
||||
SELECT move_id
|
||||
FROM account_move_line
|
||||
WHERE state = 'valid'
|
||||
GROUP BY move_id
|
||||
HAVING abs(sum(debit) - sum(credit)) > 0.00001
|
||||
""")
|
||||
assert len(cr.fetchall()) == 0, \
|
||||
"For all Journal Items, the state is valid implies that the sum " \
|
||||
"of credits equals the sum of debits"
|
||||
return True
|
||||
|
||||
def account_move_prepare(self, cr, uid, journal_id, date=False, ref='', company_id=False, context=None):
|
||||
'''
|
||||
Prepares and returns a dictionary of values, ready to be passed to create() based on the parameters received.
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<assert model="account.move" search="[]" string="For all Journal Items, the state is valid implies that the sum of credits equals the sum of debits">
|
||||
<test expr="not len(line_id) or line_id[0].state != 'valid' or (sum([l.debit - l.credit for l in line_id]) <= 0.00001)"/>
|
||||
</assert>
|
||||
<function name="account_assert_balanced" model="account.move"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue