Skip to content
Extraits de code Groupes Projets
Valider e01f229d rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[CLEAN] pre-commit

parent 764e8d61
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -27,6 +27,11 @@ repos:
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6
hooks:
......@@ -46,7 +51,7 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
......@@ -96,32 +101,28 @@ repos:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.5.1
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py
args:
- --settings=.
exclude: /__init__\.py$
- repo: https://gitlab.com/PyCQA/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==20.1.4"]
- repo: https://github.com/PyCQA/pylint
rev: pylint-2.5.3
- repo: https://github.com/OCA/pylint-odoo
rev: 7.0.2
hooks:
- id: pylint
- id: pylint_odoo
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
- id: pylint_odoo
args:
- --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps
......@@ -8,11 +8,7 @@
"website": "https://www.le-filament.com",
"version": "14.0.0.0.0",
"license": "AGPL-3",
"depends": [
"base",
"contacts",
"partner_firstname"
],
"depends": ["base", "contacts", "partner_firstname"],
"data": [
# security
"security/security_rules.xml",
......@@ -31,5 +27,5 @@
"qweb": [],
"installable": True,
"auto_install": False,
"sequence": 101
"sequence": 101,
}
......@@ -95,6 +95,7 @@ class AfacPartnerMandate(models.Model):
name = fields.Char(string="Mandat", required=True)
color = fields.Integer("Couleur")
class AfacPartnerWaterAgency(models.Model):
_name = "afac.partner.water.agency"
_description = "Agence Eau rattachement"
......
......@@ -58,7 +58,8 @@ class ResPartner(models.Model):
)
college_id = fields.Many2one(comodel_name="afac.partner.college", string="Collège")
water_agency_id = fields.Many2one(
comodel_name="afac.partner.water.agency", string="Agence Eau rattachement")
comodel_name="afac.partner.water.agency", string="Agence Eau rattachement"
)
skill_ids = fields.Many2many(
comodel_name="afac.partner.activity",
relation="afac_partner_activity_res_partner_rel",
......@@ -107,9 +108,12 @@ class ResPartner(models.Model):
)
contact_address_simple = fields.Char(
compute="_compute_contact_address_simple", string="Adresse simplifiée")
compute="_compute_contact_address_simple", string="Adresse simplifiée"
)
fields_to_copy_to_clipboard = fields.Char(
string="Champs à copier", compute="_compute_copy_to_clipboard", )
string="Champs à copier",
compute="_compute_copy_to_clipboard",
)
# ------------------------------------------------------
# SQL Constraints
# ------------------------------------------------------
......@@ -123,7 +127,31 @@ class ResPartner(models.Model):
# ------------------------------------------------------
def _compute_copy_to_clipboard(self):
for record in self:
res = (record.firstname or "") + " " + (record.lastname or "") + "\n" + (record.function or "") + "\n" + (record.street or "") + "\n" + (record.street2 or "") + "\n" + (record.street3 or "") + "\n" + (record.zip or "") + " " + (record.city or "") + "\n" + (record.parent_id.name or "") + "\n" + (record.phone or "") + "\n" + (record.mobile or "") + "\n" + (record.email or "")
res = (
(record.firstname or "")
+ " "
+ (record.lastname or "")
+ "\n"
+ (record.function or "")
+ "\n"
+ (record.street or "")
+ "\n"
+ (record.street2 or "")
+ "\n"
+ (record.street3 or "")
+ "\n"
+ (record.zip or "")
+ " "
+ (record.city or "")
+ "\n"
+ (record.parent_id.name or "")
+ "\n"
+ (record.phone or "")
+ "\n"
+ (record.mobile or "")
+ "\n"
+ (record.email or "")
)
while "\n\n" in res:
res = res.replace("\n\n", "\n")
record.fields_to_copy_to_clipboard = res.lstrip()
......@@ -143,10 +171,9 @@ class ResPartner(models.Model):
def _display_address_simple(self):
address_format = self._get_address_format_simple()
args = defaultdict(str, {
})
args = defaultdict(str, {})
for field in self._formatting_address_fields():
args[field] = getattr(self, field) or ''
args[field] = getattr(self, field) or ""
res = address_format % args
while "\n\n" in res:
res = res.replace("\n\n", "\n")
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter