From 3b0fd0afe125a72c7f1d67e2b8607bbec9298990 Mon Sep 17 00:00:00 2001 From: "laurent.corron" Date: Tue, 5 Nov 2019 17:41:42 +0100 Subject: [PATCH] [REF] partner_company_type: Black python code --- partner_company_type/__manifest__.py | 30 ++++++++----------- partner_company_type/models/res_partner.py | 3 +- .../models/res_partner_company_type.py | 20 +++++-------- .../security/res_partner_company_type.xml | 2 +- .../tests/test_res_partner_company_type.py | 15 ++++------ 5 files changed, 28 insertions(+), 42 deletions(-) diff --git a/partner_company_type/__manifest__.py b/partner_company_type/__manifest__.py index 6de593d2b..26ed89d3b 100644 --- a/partner_company_type/__manifest__.py +++ b/partner_company_type/__manifest__.py @@ -2,22 +2,18 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Partner Company Type', - 'summary': 'Adds a company type to partner that are companies', - 'version': '12.0.1.0.0', - 'license': 'AGPL-3', - 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/partner-contact', - 'depends': [ - 'base', - 'contacts', - ], - 'data': [ - 'security/res_partner_company_type.xml', - 'views/res_partner_company_type.xml', - 'views/res_partner.xml', - ], - 'demo': [ - 'demo/res_partner_company_type.xml', + "name": "Partner Company Type", + "summary": "Adds a company type to partner that are companies", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/partner-contact", + "depends": ["base", "contacts"], + "data": [ + "security/res_partner_company_type.xml", + "views/res_partner_company_type.xml", + "views/res_partner.xml", ], + "demo": ["demo/res_partner_company_type.xml"], + "installable": True, } diff --git a/partner_company_type/models/res_partner.py b/partner_company_type/models/res_partner.py index 11badc923..26140f1cc 100644 --- a/partner_company_type/models/res_partner.py +++ b/partner_company_type/models/res_partner.py @@ -8,6 +8,5 @@ class ResPartner(models.Model): _inherit = "res.partner" partner_company_type_id = fields.Many2one( - comodel_name='res.partner.company.type', - string='Legal Form', + comodel_name="res.partner.company.type", string="Legal Form" ) diff --git a/partner_company_type/models/res_partner_company_type.py b/partner_company_type/models/res_partner_company_type.py index d2c231b64..cf0643e82 100644 --- a/partner_company_type/models/res_partner_company_type.py +++ b/partner_company_type/models/res_partner_company_type.py @@ -6,18 +6,12 @@ from odoo import fields, models class ResPartnerCompanyType(models.Model): - _name = 'res.partner.company.type' - _description = 'Partner Company Type' + _name = "res.partner.company.type" + _description = "Partner Company Type" - name = fields.Char( - string='Title', - required=True, - translate=True, - ) - shortcut = fields.Char( - string='Abbreviation', - translate=True, - ) + name = fields.Char(string="Title", required=True, translate=True) + shortcut = fields.Char(string="Abbreviation", translate=True) - _sql_constraints = [('name_uniq', 'unique (name)', - "Partner Company Type already exists!")] + _sql_constraints = [ + ("name_uniq", "unique (name)", "Partner Company Type already exists!") + ] diff --git a/partner_company_type/security/res_partner_company_type.xml b/partner_company_type/security/res_partner_company_type.xml index aa7cc6948..f2d70eb80 100644 --- a/partner_company_type/security/res_partner_company_type.xml +++ b/partner_company_type/security/res_partner_company_type.xml @@ -12,7 +12,7 @@ - + res.partner.company.type manager diff --git a/partner_company_type/tests/test_res_partner_company_type.py b/partner_company_type/tests/test_res_partner_company_type.py index e34fb628b..02fc959e4 100644 --- a/partner_company_type/tests/test_res_partner_company_type.py +++ b/partner_company_type/tests/test_res_partner_company_type.py @@ -1,25 +1,22 @@ # Copyright 2017-2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import tools +from psycopg2 import IntegrityError +from odoo import tools from odoo.tests import SavepointCase -from psycopg2 import IntegrityError class TestResPartnerCompanyType(SavepointCase): - @classmethod def setUpClass(cls): super(TestResPartnerCompanyType, cls).setUpClass() cls.company_type = cls.env.ref( - 'partner_company_type.res_partner_company_type_sa') + "partner_company_type.res_partner_company_type_sa" + ) def test_00_duplicate(self): # Test Duplicate Company type - with self.assertRaises(IntegrityError), tools.mute_logger( - "odoo.sql_db"): - self.company_type.create(dict( - name=self.company_type.name, - )) + with self.assertRaises(IntegrityError), tools.mute_logger("odoo.sql_db"): + self.company_type.create(dict(name=self.company_type.name))