[6341][FIX] web_widget_open_tab#109
Open
nobuQuartile wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
@nobuQuartile Can you check with my suggestion code?
@api.model
def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
res = super(Base, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
arch = etree.fromstring(res["arch"])
model = self.env["ir.model"]._get(self._name)
if view_type == "tree" and model.add_open_tab_field:
res.setdefault("fields", {})
if "id" not in res["fields"]:
res["fields"].update(self.fields_get(["id"]))
id_elem = """<field name="id" widget="open_tab" nolabel="1"/>"""
id_elem = etree.fromstring(id_elem)
tree = arch.xpath("//tree")[0]
name_field = self._get_name_field(tree)
if name_field:
tree.insert(name_field[0].getparent().index(name_field[0]) + 1, id_elem)
else:
tree.insert(0, id_elem)
res["arch"] = etree.tostring(arch, encoding="utf-8")
return res
Contributor
Author
|
@AungKoKoLin1997 Your code also works well. |
Contributor
|
@nobuQuartile Please update the PR and request reviews from the team. |
26cd552 to
81b886d
Compare
yostashiro
reviewed
Feb 19, 2026
Member
yostashiro
left a comment
There was a problem hiding this comment.
@nobuQuartile Please describe the cause of the issue, or it's hard to understand the validity of the solution.
| arch = etree.fromstring(res["arch"]) | ||
| model = self.env["ir.model"]._get(self._name) | ||
| if view_type == "tree" and model.add_open_tab_field: | ||
| res.setdefault("fields", {}) |
Member
There was a problem hiding this comment.
In what situation could res["fields"] be missing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
6341