[IMP] core: only check for the unaccent function to enable the feature
Before this the `--unaccent` flag does double duty to specify whether to create new databases with the extension *and* to try to use the corresponding function. The latter is further gated on the function existing at all in the database. Given postgresql does not have unaccent installed by default it seems only the latter is really useful and we can ignore the flag to decide whether to enable unaccent features, if the extension is installed consider that it should be enabled and move on. Merge this in master rather than previous versions as it can change things like index access / use. closes odoo/odoo#47377 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -142,10 +142,7 @@ class Registry(Mapping):
|
||||
self.cache_invalidated = False
|
||||
|
||||
with closing(self.cursor()) as cr:
|
||||
has_unaccent = odoo.modules.db.has_unaccent(cr)
|
||||
if odoo.tools.config['unaccent'] and not has_unaccent:
|
||||
_logger.warning("The option --unaccent was given but no unaccent() function was found in database.")
|
||||
self.has_unaccent = odoo.tools.config['unaccent'] and has_unaccent
|
||||
self.has_unaccent = odoo.modules.db.has_unaccent(cr)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, db_name):
|
||||
|
||||
@@ -293,7 +293,7 @@ class configmanager(object):
|
||||
help="Maximum number of threads processing concurrently cron jobs (default 2).",
|
||||
type="int")
|
||||
group.add_option("--unaccent", dest="unaccent", my_default=False, action="store_true",
|
||||
help="Use the unaccent function provided by the database when available.")
|
||||
help="Try to enable the unaccent extension when creating new databases.")
|
||||
group.add_option("--geoip-db", dest="geoip_database", my_default='/usr/share/GeoIP/GeoLite2-City.mmdb',
|
||||
help="Absolute path to the GeoIP database file.")
|
||||
parser.add_option_group(group)
|
||||
|
||||
Reference in New Issue
Block a user