Odoo 中文社区

    • 注册
    • 登录
    • 搜索
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

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

    Odoo 开发与实施交流
    1
    2
    2562
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • Y
      youring 最后由 编辑

      [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
      • First post
        Last post