Merge PR #224 into 13.0

Signed-off-by LoisRForgeFlow
This commit is contained in:
OCA-git-bot
2023-07-06 15:11:22 +00:00
18 changed files with 99 additions and 82 deletions

View File

@@ -15,7 +15,7 @@ default_language_version:
node: "14.13.0"
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 22.8.0
hooks:
- id: black
- repo: https://github.com/prettier/pre-commit
@@ -63,8 +63,8 @@ repos:
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
name: flake8 except __init__.py

View File

@@ -13,7 +13,8 @@ class ExternalSystem(models.Model):
_description = "External System"
name = fields.Char(
required=True, help="This is the canonical (humanized) name for the system.",
required=True,
help="This is the canonical (humanized) name for the system.",
)
host = fields.Char(
help="This is the domain or IP address that the system can be reached " "at.",
@@ -56,7 +57,10 @@ class ExternalSystem(models.Model):
default=lambda s: [(6, 0, s.env.user.company_id.ids)],
help="Access to this system is restricted to these companies.",
)
system_type = fields.Selection(selection="_get_system_types", required=True,)
system_type = fields.Selection(
selection="_get_system_types",
required=True,
)
interface = fields.Reference(
selection="_get_system_types",
readonly=True,

View File

@@ -43,12 +43,15 @@ class TestExternalSystem(Common):
{"name": "Test", "system_type": "external.system.os"}
)
self.assertEqual(
record.interface._name, "external.system.os",
record.interface._name,
"external.system.os",
)
def test_create_context_override(self):
"""It should allow for interface create override with context."""
model = self.env["external.system"].with_context(no_create_interface=True,)
model = self.env["external.system"].with_context(
no_create_interface=True,
)
record = model.create({"name": "Test", "system_type": "external.system.os"})
self.assertFalse(record.interface)

View File

@@ -50,7 +50,7 @@ class Base(models.AbstractModel):
# To generate externals IDS.
match.export_data(fields)
ext_id = match.get_external_id()
row["id"] = ext_id[match.id] if match else row.get("id", u"")
row["id"] = ext_id[match.id] if match else row.get("id", "")
# Store the modified row, in the same order as fields
newdata.append(tuple(row[f] for f in fields))
# We will import the patched data to get updates on matches

View File

@@ -42,7 +42,7 @@ class BaseImportMatch(models.Model):
def _compute_name(self):
"""Automatic self-descriptive name for the setting records."""
for one in self:
one.name = u"{}: {}".format(
one.name = "{}: {}".format(
one.model_id.display_name,
" + ".join(one.field_ids.mapped("display_name")),
)
@@ -163,9 +163,10 @@ class BaseImportMatchField(models.Model):
@api.depends("conditional", "field_id", "imported_value")
def _compute_display_name(self):
for one in self:
pattern = u"{name} ({cond})" if one.conditional else u"{name}"
pattern = "{name} ({cond})" if one.conditional else "{name}"
one.display_name = pattern.format(
name=one.field_id.name, cond=one.imported_value,
name=one.field_id.name,
cond=one.imported_value,
)
@api.onchange("field_id", "match_id", "conditional", "imported_value")

View File

@@ -86,9 +86,12 @@ class ImportCase(TransactionCase):
self.assertEqual(
self.env.ref("base.res_partner_address_4").function, "Bug Fixer"
)
self.assertTrue(self.env.ref("base.res_partner_address_4").child_ids,)
self.assertTrue(
self.env.ref("base.res_partner_address_4").child_ids,
)
self.assertEqual(
len(self.env.ref("base.res_partner_address_4").child_ids), 3,
len(self.env.ref("base.res_partner_address_4").child_ids),
3,
)
self.assertEqual(
set(self.env.ref("base.res_partner_address_4").mapped("child_ids.name")),

View File

@@ -34,7 +34,9 @@ class ResUsersRole(models.Model):
help="Associated group's category",
readonly=False,
)
comment = fields.Html(string="Internal Notes",)
comment = fields.Html(
string="Internal Notes",
)
@api.depends("line_ids.user_id")
def _compute_user_ids(self):

View File

@@ -32,7 +32,10 @@
<field name="inherit_id" ref="base.view_users_search" />
<field name="arch" type="xml">
<field name="company_ids" position="after">
<field name="role_ids" />
<field
name="role_ids"
filter_domain="[('role_line_ids.role_id.name','ilike',self)]"
/>
</field>
</field>
</record>

View File

@@ -31,7 +31,8 @@ class IrActionsServerNavigateLine(models.Model):
def _onchange_field_id(self):
# check out the docstring of this in odoo/models.py
lines = self.action_id.resolve_2many_commands(
"navigate_line_ids", self.env.context.get("navigate_line_ids", []),
"navigate_line_ids",
self.env.context.get("navigate_line_ids", []),
)
lines = sum(map(self.new, lines), self.browse([]))
model = lines[-1:].field_id.relation or self.action_id.model_id.model