acsone / click-odoo

Run python scripts in a Odoo environment
GNU Lesser General Public License v3.0
115 stars 44 forks source link

[Question] how to make linting tools ignore the warning that `env` is not defined #42

Closed obayit closed 3 years ago

obayit commented 3 years ago

In the example in the README file you have this:

#!/usr/bin/env python
from __future__ import print_function

for u in env['res.users'].search([]):
    print(u.login, u.name)

In my vs code it shows warning that env is not defined, is there a way to make that warning disappear? The closes thing I could find was the key word global but I don't thing it is usable here.

My question: how to make this warning disappear?

sbidoul commented 3 years ago

You could add env = env # noqa at the beginning of the file. Or use the more elaborate method, using @click_odoo.env_options().