Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
from . import ir_model
from . import ir_ui_view

View File

@@ -0,0 +1,10 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class IrModel(models.Model):
_inherit = "ir.model"
add_open_tab_field = fields.Boolean(help="Adds open-tab field in list views.")

View File

@@ -0,0 +1,25 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from lxml import etree
from odoo import api, models
class Base(models.AbstractModel):
_inherit = "base"
@api.model
def _get_view(self, view_id=None, view_type="form", **options):
arch, view = super()._get_view(view_id, view_type, **options)
model = self.env["ir.model"]._get(self._name)
if view_type == "list" and model.add_open_tab_field:
id_elem = """<field name="id" widget="open_tab" nolabel="1"/>"""
id_elem = etree.fromstring(id_elem)
tree = arch.xpath("//list")[0]
name_field = tree.xpath('./field[@name="name"]')
if name_field:
tree.insert(name_field[0].getparent().index(name_field[0]) + 1, id_elem)
else:
tree.insert(0, id_elem)
return arch, view