mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
- Fix postprocess inherit (removed from v15), and use _postprocess_tag_field for create/edit options: In v14 it worked with inheriting the "postprocess" method because in each recursive call it passed a section of the view, in the way that it went through all the child nodes of the root node, and passed through the fields, and now in v15 the method "_postprocess_view "it just does the while, and we never go through the nodes. - Fix pylint errors: xml-deprecated-tree-attributte, attribute-string-redundant, translation-positional-used
21 lines
732 B
Python
21 lines
732 B
Python
# Copyright 2021 Camptocamp SA
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import models
|
|
|
|
|
|
class IrUiView(models.Model):
|
|
_inherit = "ir.ui.view"
|
|
|
|
def _postprocess_tag_field(self, node, name_manager, node_info):
|
|
res = super()._postprocess_tag_field(node, name_manager, node_info)
|
|
if node.tag == "field":
|
|
mname = name_manager.model._name
|
|
fname = node.attrib["name"]
|
|
field = self.env[mname]._fields.get(fname)
|
|
if field and field.type in ("many2many", "many2one"):
|
|
rec = self.env["m2x.create.edit.option"].get(mname, field.name)
|
|
if rec:
|
|
rec._apply_options(node)
|
|
return res
|