diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c6434bfc2274c73d98dbf62b6de9baccdc353ce..4acca684ec8c5cda7b3ecd21b9e568ab03d57e8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/__manifest__.py b/__manifest__.py index 9a7e812dd8b16effc4790e0051af334c1c8b959f..cb8cfbf5eca51f841d6d26e6d12726a8d86ab581 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -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, } diff --git a/models/afac_partner_list.py b/models/afac_partner_list.py index 082ad4a57c40f4c3b8cdefca690a5438e867b80b..5c1b89374197ca136998c1efe3c032ee5583ae28 100644 --- a/models/afac_partner_list.py +++ b/models/afac_partner_list.py @@ -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" diff --git a/models/res_partner.py b/models/res_partner.py index 6001e527aeb276bc949b8c3b2466ee68e8526aa4..9bf4c5ab7b00500357c2f320a8a848f422f22ce4 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -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") diff --git a/views/afac_category.xml b/views/afac_category.xml index bee8207194a247c9de1cc2ad198d27002643e8b9..51b0d6721e9cbe9d6274f022b7bc5a6a44fd4886 100644 --- a/views/afac_category.xml +++ b/views/afac_category.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> @@ -7,7 +7,7 @@ <field name="model">res.partner.category</field> <field name="arch" type="xml"> <tree string="Liste des étiquettes"> - <field name="name"/> + <field name="name" /> </tree> </field> </record> @@ -16,7 +16,7 @@ <field name="name">Étiquette</field> <field name="res_model">res.partner.category</field> <field name="view_mode">tree,form</field> - <field name="view_id" ref="afac_partner.view_partner_category_tree"/> + <field name="view_id" ref="afac_partner.view_partner_category_tree" /> </record> <menuitem diff --git a/views/res_partner.xml b/views/res_partner.xml index c4ce1c2307f9824bf9f8d5a04f0d6bf5cd19d1a0..d6552dd73c933c67410b0f9d74b9d484a6e72486 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -466,9 +466,9 @@ <field name="college_id" /> <field name="region_id" /> <field name="website" /> - <field name="legal_status_id" invisible="1"/> - <field name="legal_status_detail_id" invisible="1"/> - <field name="short_name" invisble="1"/> + <field name="legal_status_id" invisible="1" /> + <field name="legal_status_detail_id" invisible="1" /> + <field name="short_name" invisble="1" /> </xpath> <xpath expr="//div[@t-if='record.mobile.raw_value']" position="after"> <t t-if="record.mandate_id.raw_value">