Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

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

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

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

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

    学习OE 如何定义视图的类型

    Odoo 开发与实施交流
    3
    4
    2208
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      ccdos last edited by

      在 阅读 OE 的文档中,
      关于 视图的类型 是由 type 字段 决定的;

      如: <field name="type">form</field>

      <br />&lt;record model=&quot;ir.ui.view&quot; id=&quot;client_form_view_2&quot;&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;client.form.view2&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;client&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;priority&quot; eval=&quot;15&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;form&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lastname&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;firstname&quot;/&gt;<br />&nbsp; &nbsp; &lt;/field&gt;<br />&lt;/record&gt;<br />
      




      今天 发现已经成为 一个坑,
      在学习 给 action 强行指定一个 视图的时候,发现怎么也不成功,无法替换系统原来的 视图。
      后来 不断查错过程中,发现 自己新定义的视图在系统中没有类型。

      经阅读源码发现,type 字段是 个 function 字段,type 是从  视图定义里面的 tag 解析出来的 。

      <br />	 &lt;tree string=&quot;bom2&quot;&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/tree&gt; <br /><br /><br />	 &lt;form string=&quot;bom2&quot; version=&quot;7.0&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;  &lt;/form&gt;<br /><br />
      



      这里 的 tree  和 form 两个 tag 才是决定了 该视图的type,
      而  <field name="type">form</fiel>
      纯属摆设。

      1 Reply Last reply Reply Quote 0
      • wjfonhand
        wjfonhand last edited by

        太牛了,思考和解决问题的过程值得推荐,喜欢这样的分享!

        1 Reply Last reply Reply Quote 0
        • 1
          18684036 last edited by

          除开这个方法,我还是依然认为 def view_header_get() 这个函数可以 根据用户的uid 来指向 某个view_id
          虽然我还没做得出来,但我相信这个方法肯定行

          1 Reply Last reply Reply Quote 0
          • First post
            Last post