Skip to content

Commit

Permalink
[IMP] partner_multi_relation: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-mchechlacz committed Nov 15, 2024
1 parent 6d180bd commit a6b2d03
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 20 deletions.
1 change: 1 addition & 0 deletions partner_multi_relation/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2013-2022 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
"""Support connections between partners."""

import numbers

from odoo import _, api, exceptions, fields, models
Expand Down
1 change: 1 addition & 0 deletions partner_multi_relation/models/res_partner_relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# pylint: disable=api-one-deprecated
"""Store relations (connections) between partners."""

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError

Expand Down
6 changes: 1 addition & 5 deletions partner_multi_relation/models/res_partner_relation_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,7 @@ def _search_any_partner_id(self, operator, value):
)
def _compute_display_name(self):
for record in self:
record.display_name = "{} {} {}".format(
record.this_partner_id.name,
record.type_selection_id.display_name,
record.other_partner_id.name,
)
record.display_name = f"{record.this_partner_id.name} {record.type_selection_id.display_name} {record.other_partner_id.name}"

@api.onchange("type_selection_id")
def onchange_type_selection_id(self):
Expand Down
1 change: 1 addition & 0 deletions partner_multi_relation/models/res_partner_relation_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2013-2022 Therp BV <https://therp.nl>.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
"""Define the type of relations that can exist between partners."""

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.osv.expression import AND, OR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
care of registering all fields in ir_model_fields. This is needed to make
the field labels translatable.
"""

from psycopg2.extensions import AsIs

from odoo import api, fields, models
Expand Down
18 changes: 3 additions & 15 deletions partner_multi_relation/tests/test_partner_relation_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ def test_display_name(self):
relation = self._create_company2person_relation()
self.assertEqual(
relation.display_name,
"{} {} {}".format(
relation.this_partner_id.name,
relation.type_selection_id.name,
relation.other_partner_id.name,
),
f"{relation.this_partner_id.name} {relation.type_selection_id.name} {relation.other_partner_id.name}",
)

def test_regular_write(self):
Expand Down Expand Up @@ -176,11 +172,7 @@ def test_inverse_creation(self):
# Check wether display name is what we should expect:
self.assertEqual(
relation.display_name,
"{} {} {}".format(
self.partner_01_person.name,
self.selection_person2company.name,
self.partner_02_company.name,
),
f"{self.partner_01_person.name} {self.selection_person2company.name} {self.partner_02_company.name}",
)

def test_inverse_creation_type_id(self):
Expand All @@ -196,11 +188,7 @@ def test_inverse_creation_type_id(self):
# Check wether display name is what we should expect:
self.assertEqual(
relation.display_name,
"{} {} {}".format(
self.partner_01_person.name,
self.selection_person2company.name,
self.partner_02_company.name,
),
f"{self.partner_01_person.name} {self.selection_person2company.name} {self.partner_02_company.name}",
)

def test_unlink(self):
Expand Down

0 comments on commit a6b2d03

Please sign in to comment.