[FIX] account_asset_management: Fix error according to _name_search in group when try to set groups in profile
This commit is contained in:
parent
79cc93f3dd
commit
db1e569dab
@ -1,5 +1,6 @@
|
|||||||
# Copyright 2009-2020 Noviat
|
# Copyright 2009-2020 Noviat
|
||||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||||
|
# Copyright 2021 Tecnativa - Víctor Martínez
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
@ -72,7 +73,6 @@ class AccountAssetGroup(models.Model):
|
|||||||
]
|
]
|
||||||
if operator in expression.NEGATIVE_TERM_OPERATORS:
|
if operator in expression.NEGATIVE_TERM_OPERATORS:
|
||||||
domain = ["&", "!"] + domain[1:]
|
domain = ["&", "!"] + domain[1:]
|
||||||
rec_ids = self._search(
|
return self._search(
|
||||||
expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid
|
expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid
|
||||||
)
|
)
|
||||||
return self.browse(rec_ids).name_get()
|
|
||||||
|
@ -640,18 +640,18 @@ class TestAssetManagement(AccountTestInvoicingCommon):
|
|||||||
)
|
)
|
||||||
# Groups are displayed by code (if any) plus name
|
# Groups are displayed by code (if any) plus name
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.env["account.asset.group"]._name_search("FA"),
|
self.env["account.asset.group"].name_search("FA"),
|
||||||
[(group_fa.id, "FA Fixed Assets")],
|
[(group_fa.id, "FA Fixed Assets")],
|
||||||
)
|
)
|
||||||
# Groups with code are shown by code in list views
|
# Groups with code are shown by code in list views
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.env["account.asset.group"]
|
self.env["account.asset.group"]
|
||||||
.with_context(params={"view_type": "list"})
|
.with_context(params={"view_type": "list"})
|
||||||
._name_search("FA"),
|
.name_search("FA"),
|
||||||
[(group_fa.id, "FA")],
|
[(group_fa.id, "FA")],
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.env["account.asset.group"]._name_search("TFA"),
|
self.env["account.asset.group"].name_search("TFA"),
|
||||||
[(group_tfa.id, "TFA Tangible Fixed Assets")],
|
[(group_tfa.id, "TFA Tangible Fixed Assets")],
|
||||||
)
|
)
|
||||||
group_tfa.code = False
|
group_tfa.code = False
|
||||||
@ -665,4 +665,4 @@ class TestAssetManagement(AccountTestInvoicingCommon):
|
|||||||
group_tfa.with_context(params={"view_type": "list"}).name_get(),
|
group_tfa.with_context(params={"view_type": "list"}).name_get(),
|
||||||
[(group_tfa.id, "Tangible Fixed A...")],
|
[(group_tfa.id, "Tangible Fixed A...")],
|
||||||
)
|
)
|
||||||
self.assertFalse(self.env["account.asset.group"]._name_search("stessA dexiF"))
|
self.assertFalse(self.env["account.asset.group"].name_search("stessA dexiF"))
|
||||||
|
Loading…
Reference in New Issue
Block a user