Skip to content

[6341][FIX] web_widget_open_tab#109

Open
nobuQuartile wants to merge 2 commits into
15.0from
6341-fix-web_widget_open_tab
Open

[6341][FIX] web_widget_open_tab#109
nobuQuartile wants to merge 2 commits into
15.0from
6341-fix-web_widget_open_tab

Conversation

@nobuQuartile
Copy link
Copy Markdown
Contributor

@nobuQuartile nobuQuartile marked this pull request as draft February 18, 2026 07:15
Copy link
Copy Markdown
Contributor

@AungKoKoLin1997 AungKoKoLin1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@nobuQuartile
Copy link
Copy Markdown
Contributor Author

nobuQuartile commented Feb 19, 2026

@AungKoKoLin1997 Your code also works well.

@AungKoKoLin1997
Copy link
Copy Markdown
Contributor

@nobuQuartile Please update the PR and request reviews from the team.

@nobuQuartile nobuQuartile force-pushed the 6341-fix-web_widget_open_tab branch from 26cd552 to 81b886d Compare February 19, 2026 08:27
@nobuQuartile nobuQuartile marked this pull request as ready for review February 19, 2026 08:28
@kanda999 kanda999 changed the title [6341][FIX]web_widget_open_tab [6341][FIX] web_widget_open_tab Feb 19, 2026
Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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", {})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what situation could res["fields"] be missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants