[MIG] base_dynamic_list from v14 to v16
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com)
|
# Copyright 2020-2023 Akretion France (http://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Base Dynamic List',
|
'name': 'Base Dynamic List',
|
||||||
'version': '14.0.1.0.0',
|
'version': '16.0.1.0.0',
|
||||||
'category': 'Tools',
|
'category': 'Tools',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Dynamic lists',
|
'summary': 'Dynamic lists',
|
||||||
@@ -58,5 +58,5 @@ Limitation: when you want to have different access rights on these lists dependi
|
|||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/dynamic_list.xml',
|
'views/dynamic_list.xml',
|
||||||
],
|
],
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com)
|
# Copyright 2020-2023 Akretion France (http://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
@@ -63,18 +63,15 @@ class DynamicListCode(models.Model):
|
|||||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@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=80):
|
|
||||||
if args is None:
|
if args is None:
|
||||||
args = []
|
args = []
|
||||||
|
ids = []
|
||||||
if name and operator == 'ilike':
|
if name and operator == 'ilike':
|
||||||
recs = self.search(
|
ids = list(self._search([('code', '=', name)] + args, limit=limit))
|
||||||
[('code', '=', name)] + args, limit=limit)
|
if ids:
|
||||||
if recs:
|
return ids
|
||||||
return recs.name_get()
|
return super()._name_search(name=name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid)
|
||||||
return super().name_search(
|
|
||||||
name=name, args=args, operator=operator, limit=limit)
|
|
||||||
|
|
||||||
|
|
||||||
class DynamicListCodeTranslate(models.Model):
|
class DynamicListCodeTranslate(models.Model):
|
||||||
@@ -101,15 +98,12 @@ class DynamicListCodeTranslate(models.Model):
|
|||||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@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=80):
|
|
||||||
if args is None:
|
if args is None:
|
||||||
args = []
|
args = []
|
||||||
|
ids = []
|
||||||
if name and operator == 'ilike':
|
if name and operator == 'ilike':
|
||||||
recs = self.search(
|
ids = list(self._search([('code', '=', name)] + args, limit=limit))
|
||||||
[('code', '=', name)] + args, limit=limit)
|
if ids:
|
||||||
if recs:
|
return ids
|
||||||
return recs.name_get()
|
return super()._name_search(name=name, args=args, operator=operator, limit=limit, name_get_uid=name_get_uid)
|
||||||
return super().name_search(
|
|
||||||
name=name, args=args, operator=operator, limit=limit)
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2020-2021 Akretion France (http://www.akretion.com/)
|
Copyright 2020-2023 Akretion France (http://www.akretion.com/)
|
||||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|||||||
Reference in New Issue
Block a user