[IMP] account_chart_of_accounts: allow view accounts to appear in _name_search while import

This commit is contained in:
Abdurrahman Saber 2025-09-10 14:39:43 +03:00
parent 538fe2aa45
commit f19dc1a3fe
1 changed files with 3 additions and 2 deletions

View File

@ -83,11 +83,11 @@ class AccountAccount(models.Model):
return new_domain
@api.model
def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
if args is None: args = []
domain = args
domain = self.replace_type_with_internal_type(domain)
if not self.env.context.get('show_view'):
if not self.env.context.get('show_view') and not self.env.context.get('import_file'):
domain += [('internal_type', '!=', 'view')]
return super(AccountAccount, self)._name_search(name, domain, operator ,limit ,name_get_uid)
def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
@ -96,6 +96,7 @@ class AccountAccount(models.Model):
# if not self.env.context.get('show_view'):
# args += [('internal_type', '!=', 'view')]
return super(AccountAccount, self)._search(domain, offset, limit, order, count, access_rights_uid)
@api.depends('parent_id')
def _get_level(self):
"""