Skip to content

Commit

Permalink
Merge PR OCA#2728 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by ilyasProgrammer
  • Loading branch information
OCA-git-bot committed Jan 23, 2024
2 parents f10d729 + 1fba800 commit edfb614
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web_field_required_invisible_manager/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def fields_view_get(
return arch

def process_child_fields(self, arch, view_type):
"""Collect all relational fields and update its views"""
"""Collect all relational fields and update their views"""
related_fields = [
(k, v.comodel_name) for k, v in self._fields.items() if v.comodel_name
]
Expand Down Expand Up @@ -80,7 +80,8 @@ def process_child_fields(self, arch, view_type):
z_arch = self.create_restrictions_fields(
restr, view_type, z_arch
)
z_arch["arch"] = z_arch["arch"].decode("utf-8")
if type(z_arch["arch"]) is bytes:
z_arch["arch"] = z_arch["arch"].decode("utf-8")
name_manager = NameManager(False, self.env[restr.model_name])
if restr.readonly_field_id and restr.readonly_model_id:
model_field_infos = name_manager.fields_get.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def setUpClass(cls):
"<field name='name'/></tree>",
}
)
cls.view_users_form_arch_orig = cls.view_users_form.arch
cls.view_users_form.arch = cls.view_users_form.arch.replace(
"</notebook>",
"</notebook><field name='company_ids'><tree><field name='city'/>"
Expand Down Expand Up @@ -220,3 +221,11 @@ def test_all_web_field_required_invisible_manager(self):
self.assertTrue(self.invisible_title_rec_id.required)
# unlink
self.invisible_rec_id.unlink()
# case when child view has no fields
self.view_users_form.arch = self.view_users_form_arch_orig
self.view_users_form.arch = self.view_users_form.arch.replace(
"</notebook>",
"</notebook><field name='company_ids'><form><br/></form></field>",
)
self.env.user.fields_view_get(view_id=self.view_users_form.id, view_type="form")
self.env.user.fields_view_get(view_id=self.view_users_tree.id, view_type="tree")

0 comments on commit edfb614

Please sign in to comment.