-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] remove pre-commit exception and fix various style in odoo_patch…
… folder
- Loading branch information
1 parent
188ed85
commit 92c7bca
Showing
9 changed files
with
40 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ repos: | |
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
exclude: ^upgrade_analysis/odoo_patch/ | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.1.2 | ||
hooks: | ||
|
@@ -54,7 +53,6 @@ repos: | |
- "@prettier/[email protected]" | ||
args: | ||
- --plugin=@prettier/plugin-xml | ||
exclude: ^upgrade_analysis/odoo_patch/ | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: v7.8.1 | ||
hooks: | ||
|
@@ -89,15 +87,14 @@ repos: | |
rev: v2.7.2 | ||
hooks: | ||
- id: pyupgrade | ||
exclude: ^upgrade_analysis/odoo_patch/ | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.5.1 | ||
hooks: | ||
- id: isort | ||
name: isort except __init__.py | ||
args: | ||
- --settings=. | ||
exclude: /__init__\.py$|^upgrade_analysis/odoo_patch/ | ||
exclude: /__init__\.py$ | ||
- repo: https://github.com/acsone/setuptools-odoo | ||
rev: 2.6.0 | ||
hooks: | ||
|
@@ -113,14 +110,13 @@ repos: | |
hooks: | ||
- id: flake8 | ||
name: flake8 except __init__.py | ||
exclude: /__init__\.py$|^upgrade_analysis/odoo_patch/ | ||
exclude: /__init__\.py$ | ||
additional_dependencies: ["flake8-bugbear==20.1.4"] | ||
- id: flake8 | ||
name: flake8 only __init__.py | ||
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py | ||
files: /__init__\.py$ | ||
additional_dependencies: ["flake8-bugbear==20.1.4"] | ||
exclude: ^upgrade_analysis/odoo_patch/ | ||
- repo: https://github.com/PyCQA/pylint | ||
rev: pylint-2.5.3 | ||
hooks: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# generated from manifests external_dependencies | ||
raven | ||
dataclasses | ||
odoorpc | ||
openupgradelib | ||
raven |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# flake8: noqa: B902 | ||
from odoo.addons import mrp | ||
from ...odoo_patch import OdooPatch | ||
|
||
|
||
class PreInitHookPatch(OdooPatch): | ||
target = mrp | ||
method_names = ['_pre_init_mrp'] | ||
method_names = ["_pre_init_mrp"] | ||
|
||
def _pre_init_mrp(cr): | ||
""" Don't try to create an existing column on reinstall """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# flake8: noqa: B902 | ||
from odoo.addons import stock | ||
from ...odoo_patch import OdooPatch | ||
|
||
|
||
class PreInitHookPatch(OdooPatch): | ||
target = stock | ||
method_names = ['pre_init_hook'] | ||
method_names = ["pre_init_hook"] | ||
|
||
def pre_init_hook(cr): | ||
""" Don't unlink stock data on reinstall """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
from odoo import api, models | ||
from ..odoo_patch import OdooPatch | ||
|
||
from ... import upgrade_log | ||
from ..odoo_patch import OdooPatch | ||
|
||
|
||
class BaseModelPatch(OdooPatch): | ||
target = models.BaseModel | ||
method_names = ['_convert_records'] | ||
method_names = ["_convert_records"] | ||
|
||
@api.model | ||
def _convert_records(self, records, log=lambda a: None): | ||
""" Log data ids that are imported with `load` """ | ||
current_module = self.env.context['module'] | ||
current_module = self.env.context["module"] | ||
for res in BaseModelPatch._convert_records._original_method( | ||
self, records, log=log): | ||
self, records, log=log | ||
): | ||
_id, xid, _record, _info = res | ||
if xid: | ||
xid = xid if '.' in xid else "%s.%s" % (current_module, xid) | ||
xid = xid if "." in xid else "{}.{}".format(current_module, xid) | ||
upgrade_log.log_xml_id(self.env.cr, current_module, xid) | ||
|
||
yield res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters