Enforce same type for children account as their parent
issue11143 review384081002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Enforce same type for children account as their parent
|
||||
* Show debit / credit columns in ledgers when they contain lines
|
||||
* Count number of lines in Account and General Ledger
|
||||
* Handle errors in move template expression
|
||||
|
||||
+23
@@ -544,6 +544,29 @@ def AccountMixin(template=False):
|
||||
depends=['type']),
|
||||
'on_change_with_deferral', searcher='search_deferral')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
|
||||
if not cls.childs.domain:
|
||||
cls.childs.domain = []
|
||||
for type_ in ['type', 'debit_type']:
|
||||
field = getattr(cls, type_)
|
||||
field.domain = [
|
||||
If(Eval('parent')
|
||||
& Eval('_parent_parent.%s' % type_)
|
||||
& Eval('_parent_parent.parent'),
|
||||
('id', '=', Eval('_parent_parent.%s' % type_)),
|
||||
()),
|
||||
]
|
||||
field.depends.append('parent')
|
||||
|
||||
cls.childs.domain.append(
|
||||
If(Eval(type_),
|
||||
(type_, '=', Eval(type_)),
|
||||
()))
|
||||
cls.childs.depends.append(type_)
|
||||
|
||||
@classmethod
|
||||
def default_closed(cls):
|
||||
return False
|
||||
|
||||
@@ -1539,6 +1539,7 @@ class AccountTestCase(
|
||||
updated_account.code = 'REV'
|
||||
updated_account.name = 'Updated Account'
|
||||
updated_account.parent = new_account
|
||||
updated_account.type = new_account.type
|
||||
updated_account.reconcile = True
|
||||
updated_account.end_date = datetime.date.today()
|
||||
updated_account.taxes = [updated_tax]
|
||||
|
||||
Reference in New Issue
Block a user