跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. 关于继承视图中<data>的使用

关于继承视图中<data>的使用

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
2 帖子 1 发布者 2.9k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • Y 离线
    Y 离线
    youring
    写于 最后由 编辑
    #1

    [size=18pt]结论: 7.0/8.0版本在继承视图中没必要加入<data>标签来嵌套多处字段修改了[/size]

    源引:<br / [检测到链接无效,已移除] br />
    Multiple Changes
    To make changes in more than one location, wrap the fields in a data element.
    一个视图下涉及多处继承修改,要将被修改的字段嵌套在<data>标签里

    &lt;record model=&quot;ir.ui.view&quot; id=&quot;view_partner_form5&quot;&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;res.partner.form.inherit5&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;res.partner&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;inherit_id&quot; ref=&quot;base.view_partner_form&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;data&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lang&quot; position=&quot;replace&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;website&quot; position=&quot;after&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lang&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/data&gt;<br />&nbsp; &nbsp; &lt;/field&gt;<br />&lt;/record&gt;
    


    但我在7.0/8.0中视图中发现不用data也可以,遂产生疑问

    经上海-开阖Jeff指点:
    这是6.1之前版本存在的问题:一次继承只能写一个 <field position> 标签,后面的全忽略。
    7.0和8.0都没这个问题了。
    之前的版本如果用xpath也不存在此问题。

    注:<br / https://www.odoo.com/documentation/8.0/reference/views.html#inheritance br />新的8.0文档中已经没有以上表述。
    7.0的文档是之前版本复制过来的,部分只适用于老版本,故令人费解。

    1 条回复 最后回复
    0

    • 登录

    • 没有帐号? 注册

    • 登录或注册以进行搜索。
    • 第一个帖子
      最后一个帖子
    0
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组