[REF]account:improve variable name
bzr revid: ara@tinyerp.com-20110111060318-ctjohf91qc6xotfe
This commit is contained in:
parent
a142d7ace0
commit
f338b963b8
|
@ -420,15 +420,17 @@ class account_account(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_type(self, cr, uid, ids, context=None):
|
def _check_type(self, cr, uid, ids, context=None):
|
||||||
type = self.browse(cr, uid, ids, context=context)
|
if context is None:
|
||||||
for t in type:
|
context = {}
|
||||||
if t.parent_id.type != 'view' and t.parent_id:
|
accounts = self.browse(cr, uid, ids, context=context)
|
||||||
|
for account in accounts:
|
||||||
|
if account.parent_id.type != 'view' and account.parent_id:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']),
|
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']),
|
||||||
(_check_type, 'You cannot create a account! \nMake sure if the account has children it should be type "View"! ', ['parent_id']),
|
(_check_type, 'You cannot create a account! \nMake sure if the account has parent it should be type "View"! ', ['parent_id']),
|
||||||
]
|
]
|
||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
|
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
|
||||||
|
@ -2304,16 +2306,18 @@ class account_account_template(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_type(self, cr, uid, ids, context=None):
|
def _check_type(self, cr, uid, ids, context=None):
|
||||||
type = self.browse(cr, uid, ids, context=context)
|
if context is None:
|
||||||
for t in type:
|
context = {}
|
||||||
if t.parent_id.type != 'view' and t.parent_id:
|
accounts = self.browse(cr, uid, ids, context=context)
|
||||||
|
for account in accounts:
|
||||||
|
if account.parent_id.type != 'view' and account.parent_id:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
_check_recursion = check_cycle
|
_check_recursion = check_cycle
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_recursion, 'Error ! You can not create recursive account templates.', ['parent_id']),
|
(_check_recursion, 'Error ! You can not create recursive account templates.', ['parent_id']),
|
||||||
(_check_type, 'You cannot create a account template! \nMake sure if the account template has children it should be type "View"! ', ['parent_id']),
|
(_check_type, 'You cannot create a account template! \nMake sure if the account template has parent it should be type "View"! ', ['parent_id']),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue