odoo-exception-warning (R8101)#

odoo.exceptions.Warning is imported.

What it does#

Reports from odoo.exceptions import Warning.

Why is this bad?#

Warning is a deprecated alias of UserError, removed in later Odoo versions, and it shadows Python’s built-in Warning.

Example#

from odoo.exceptions import Warning

Use instead:

from odoo.exceptions import UserError

Fix safety#

Unsafe: the import becomes UserError, and without an as name every Warning in the file is renamed, including any that does not refer to the import.