Skip to main content

Pylint plugin for Odoo

Project description

Build Status Coverage Status Pypi Package

Pylint Odoo plugin

Enable custom checks for Odoo modules.

Code Description Short name
C7902 Missing ./README.rst file. Template here: %s missing-readme
C8101 One of the following authors must be present in manifest: %s manifest-required-author
C8102 Missing required key “%s” in manifest file manifest-required-key
C8103 Deprecated key “%s” in manifest file manifest-deprecated-key
C8104 Use CamelCase “%s” in class name “%s”. You can use oca-autopep8 of to auto fix it. class-camelcase
C8105 License “%s” not allowed in manifest file. license-allowed
C8106 Wrong Version Format “%s” in manifest file. Regex to match: “%s” manifest-version-format
C8107 String parameter on “%s” requires translation. Use %s_(%s) translation-required
C8108 Name of compute method should start with “_compute_” method-compute
C8109 Name of search method should start with “_search_” method-search
C8110 Name of inverse method should start with “_inverse_” method-inverse
C8111 Manifest key development_status “%s” not allowed. Use one of: %s. development-status-allowed
C8201 No UTF-8 coding comment found: Use # coding: utf-8 or # -*- coding: utf-8 -*- no-utf8-coding-comment
C8202 UTF-8 coding is not necessary unnecessary-utf8-coding-comment
E7901 %s %s rst-syntax-error
E7902 %s error: %s xml-syntax-error
E7903 Test folder imported in module %s test-folder-imported
E7912 %s %s po-syntax-error
E8101 The author key in the manifest file must be a string (with comma separated values) manifest-author-string
E8102 Use of cr.commit() directly - More info invalid-commit
E8103 SQL injection risk. Use parameters if you can. - More info sql-injection
E8104 The maintainers key in the manifest file must be a list of strings manifest-maintainers-list
E8105 Use of str.format method in a translated string. Use _("%(varname)s") % {"varname": value} instead. Be careful str-format-used
E8106 Use of external request method %s without timeout. It could wait for a long time external-request-timeout
F8101 File “%s”: “%s” not found. resource-not-exist
R7980 Consider merging classes inherited to “%s” from %s. consider-merging-classes-inherited
R8101 Import Warning should be renamed as UserError from openerp.exceptions import Warning as UserError openerp-exception-warning
R8110 Method defined with old api version 7 old-api7-method-defined
W7901 %s Dangerous filter without explicit user_id in xml_id %s dangerous-filter-wo-user
W7902 %s Duplicate xml record id “%s” in %s duplicate-xml-record-id
W7903 %s javascript-lint
W7904 %s Deprecated <openerp> xml node deprecated-openerp-xml-node
W7905 %s record res.users without context=”{‘no_reset_password’: True}” create-user-wo-reset-password
W7906 %s Duplicate id “%s” duplicate-id-csv
W7907 %s Duplicate xml field “%s” in lines %s duplicate-xml-fields
W7908 %s Missing newline missing-newline-extrafiles
W7909 %s Redundant name module reference in xml_ids “%s”. redundant-modulename-xml
W7910 %s Use wrong tabs indentation instead of four spaces wrong-tabs-instead-of-spaces
W7930 %s not used from manifest file-not-used
W7935 External dependency “%s” without ImportError. More info: missing-import-error
W7936 Missing external dependency “%s” from manifest. More info: missing-manifest-dependency
W7937 %s The xml attribute is missing the translation=”off” tag %s xml-attribute-translatable
W7938 pass into block except. If you really need to use the pass consider logging that exception except-pass
W7939 %s Use <odoo> instead of <odoo><data> or use <odoo noupdate=”1”>instead of <odoo><data noupdate=”1”> deprecated-data-xml-node
W7940 %s Dangerous use of “replace” from view with priority %s < %s dangerous-view-replace-wo-priority
W7941 %s Dangerous use of “replace” from view with priority %s < %s dangerous-qweb-replace-wo-priority
W7942 %s Deprecated <tree> xml attribute “%s” xml-deprecated-tree-attribute
W7943 %s Deprecated QWeb directive “%s”. Use “t-options” instead xml-deprecated-qweb-directive
W7944 %s The resource in in src/href contains a not valid chararter character-not-valid-in-resource-link
W7947 %s Duplicate PO message definition “%s” in lines %s duplicate-po-message-definition
W7950 Same Odoo module absolute import. You should use relative import with “.” instead of “openerp.addons.%s” odoo-addons-relative-import
W7968 %s %s po-msgstr-variables
W8101 Detected and api.multi decorators together. api-one-multi-together
W8102 Missing or api.multi in copy function. copy-wo-api-one
W8103 Translation method _(“string”) in fields is not necessary. translation-field
W8104 deprecated api-one-deprecated
W8105 attribute “%s” deprecated attribute-deprecated
W8106 Missing super call in “%s” method. method-required-super
W8110 Missing return (super is used) in method %s. missing-return
W8111 Field parameter “%s” is no longer supported. Use “%s” instead. renamed-field-parameter
W8112 “eval” referenced detected. eval-referenced
W8113 The attribute string is redundant. String parameter equal to name of variable attribute-string-redundant
W8114 Website “%s” in manifest key is not a valid URI website-manifest-key-not-valid-uri
W8115 Translatable term in “%s” contains variables. Use %s instead translation-contains-variable
W8116 Print used. Use logger instead. print-used
W8120 Translation method _(%s) is using positional string printf formatting. Use named placeholder _("%%(placeholder)s") instead. translation-positional-used
W8121 Context overridden using dict. Better using kwargs with_context(**%s) or with_context(key=value) context-overridden
W8201 You have a python file with execution permissions but you don’t have an interpreter magic comment, or a magic comment but no execution permission. If you really needs a execution permission then add a magic comment ( ). If you don’t needs a execution permission then remove it with: chmod -x %s incoherent-interpreter-exec-perm
W8202 Use of vim comment use-vim-comment


# pip install --upgrade git+


# pip install --upgrade --pre pylint-odoo


pylint --load-plugins=pylint_odoo -e odoolint path/to/test

or use configuration file (find example configuration in

pylint --rcfile=.pylintrc path/to/test

Example to test just odoo-lint case:

touch {ADDONS-PATH}/

pylint --load-plugins=pylint_odoo -d all -e odoolint {ADDONS-PATH}

If you have external files you can add them in examples folder to skip.

For rst-syntax-error skip unknown directives

Skip one check based on the Odoo version

If you need to restrict a check to specific version(s) of Odoo, use the new variable odoo_check_versions

For example, if you have one new check your-new-check and you need to run it only if the Odoo version is between 9.0 and 11.0, inside the class you should declare the following :

class FormatChecker(PylintOdooTokenChecker):
    odoo_check_versions = {
        'your-new-check': {
            'min_odoo_version': '9.0',
            'max_odoo_version': '10.0',

Skip one xml check

If you need to skip one check in one xml file you can use the follow way

<?xml version="1.0" encoding="utf-8"?>
<!-- pylint:disable=name-of-check-to-skip -->
<?xml version="1.0" encoding="utf-8"?>
<!-- pylint:disable=name-of-check-to-skip, second-name-check-to-skip -->

This skip only work with the name of the check, not work with the name of check

The position of the comment it is not relative to the line that throw the check



  • [IMP] duplicate-po-message-definition: Detecting duplicated only with msgid (#374)
  • [IMP] test-folder-imported: Consider ‘from . import test’ missing case (#373)


  • [REF] README: Auto-update Using pylint_odoo.messages2rst()
  • [ADD] external-request-timeout: It could wait for a long time (#370)
  • [FIX] .travis.yml: npm v18.0.0 is not compatible with ubuntu used from travis (#371)
  • [REF] README: Use new travis URL (#369)


  • [ADD] pre-commit-hooks: Add pylint_odoo hook to be used from pre-commit.yaml directly (#368)
  • [REF] requirements: Bump pylint package from 2.11.1 to 2.13.5 for py3.x (#367)
  • [FIX] CI: Fix pluggy error on py3.7 and running lint only in one build (#366)
  • [IMP] sql-injection: Detect possible sql injections when using f-strings (#364)
  • [FIX] Pinned lazy-object-proxy for Python 2.7 (#365)
  • [FIX] missing-return: Incorrect check for tearDownClass (#362)


  • [FIX] OdooChecker: Discard migrations folder as odoo main module (#358)


  • Revert “[REVERT] requirements: Using pylint<2.11.0 because issue 5096 (#355)”


  • [REVERT] requirements: Using pylint<2.11.0 because issue 5096 (#355)


  • [REF] requirements: Upgrade pylint version 2.11.1 (#354)


  • [REF] manifest-version-format: Add new valid odoo v15.0 (#353)
  • [REF] sql-injection: No sql-injection using constants (#351)
  • [FIX] sql-injection: AttributeError: ‘NoneType’ object has no attribute ‘parent’ (#350)


  • [REF] requirements: Upgrade pylint version (#349)


  • [REF] README: Auto-update Using pylint_odoo.messages2rst()
  • [ADD] dangerous-qweb-replace-wo-priority: Consider qweb view templates (#347)
  • [ADD] context-overridden: Better using kwargs instead of dictionary (#256)
  • [REF] invalid-name, unused-argument: Suppress check for migrations path (#348)


  • [FIX] sql-injection: Fix false positives (#344)
  • [FIX] pylint_odoo: Fix manifest_version_format option ignored (#346)


  • [FIX] translation-required: Skip tests folder (#345)
  • [FIX] xml-syntax-error: Fix crash if a xml has syntax errors (#343)
  • [REF] pylint-odoo: Add .pylintrc example (#325)
  • [FIX] attribute-deprecated: Check only “Model” class’ attributes (#342)
  • [FIX] attribute-string-redundant: “string” of related field is taken from the referenced one (#341)
  • [FIX] file-not-used: Fix false positives on Windows (#335)


  • [FIX] Add pbr to requirements (#328)
  • [REF] requirements: upgrade pylint version (#320)


  • [FIX] test-folder-imported: Support all import styles (#315)
  • [FIX] Properly support python namespace package when detecting the odoo addon directory (#317)


  • [REF] README: Auto-update Using pylint_odoo.messages2rst()
  • [ADD] translation-positional-used: New check to valid the allow change the order of string formatting (#305)
  • [ADD] str-format-used: Check if str.format was used in translated string (#304)
  • [ADD] test-folder-imported: check if tests folder is imported in init file (#310)


  • [FIX] requirements: fix dependencies break with pip 20.3 Fix #306 (#313)
  • [ADD] add compatibility to v14.0 (#312)


  • [REF] .travis.yml: Enable condition to deploy pypi
  • [REF] README: Auto-update Using pylint_odoo.messages2rst()
  • [FIX] dangerous-view-replace-wo-priority: check all child tags with replace (#309)
  • [ADD] pylint-odoo: add new check to maintainers key in manifest must be a list of str (#308)
  • [REF] development-status-allowed: Explicitly report possible values (#301)
  • [REF] odoo-addons-relative-import: does not apply in tests/ directory (#307)
  • [REF] CI: Enable py3.8 and py3.9 (#294)


  • [FIX] messages2rst: Compatible with more than 3 message items

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylint-odoo-6.2.0.tar.gz (79.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page