[FIX] account: no journal items on consolidation accounts

As for the view accounts, the consolidation accounts should not allow to create journal items.
Fixes #1090
This commit is contained in:
Humberto Arocha 2014-07-10 15:25:01 -04:30 committed by Martin Trigaux
parent ced5852144
commit 3fe508f200
1 changed files with 2 additions and 2 deletions

View File

@ -574,7 +574,7 @@ class account_move_line(osv.osv):
def _check_no_view(self, cr, uid, ids, context=None):
lines = self.browse(cr, uid, ids, context=context)
for l in lines:
if l.account_id.type == 'view':
if l.account_id.type in ('view', 'consolidation'):
return False
return True
@ -626,7 +626,7 @@ class account_move_line(osv.osv):
return True
_constraints = [
(_check_no_view, 'You cannot create journal items on an account of type view.', ['account_id']),
(_check_no_view, 'You cannot create journal items on an account of type view or consolidation.', ['account_id']),
(_check_no_closed, 'You cannot create journal items on closed account.', ['account_id']),
(_check_company_id, 'Account and Period must belong to the same company.', ['company_id']),
(_check_date, 'The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal.', ['date']),