upgrade-http-routing-helpers (U1811)#

slug, slugify, unslug or url_for is imported from http_routing, removed in Odoo 18.0.

Applies to Odoo 18.0 and later.

What it does#

Reports imports of slug, unslug, unslug_url, slugify, slugify_one, url_for, url_lang and is_multilang_url from odoo.addons.http_routing.models.ir_http.

Why is this bad?#

Odoo 18.0 turned these functions into class methods of ir.http (env["ir.http"]._slug(record), ._slugify(text), …): the import fails and the module does not load. In QWeb templates slug is still there.

Fix safety#

Safe: each use becomes self.env["ir.http"]._slug inside a method of a model, or request.env["ir.http"]._slug where request comes from odoo.http, and the import goes. There is no fix when a use is elsewhere, or when the import is not at the top of the file.