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账号

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

    [分享]view xml中,引用对象id及其他字段的方法

    Odoo 开发与实施交流
    4
    5
    3751
    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.
    • mrshelly
      mrshelly last edited by

      今天读代码读到 addons\stock\stock_data.xml 文件时, 发现这么一段

      <br /><br />163.&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;warehouse0&quot; model=&quot;stock.warehouse&quot;&gt;<br />164.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field model=&quot;res.company&quot; name=&quot;name&quot; search=&quot;&#91;]&quot; use=&quot;name&quot;/&gt;<br />165.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lot_input_id&quot; ref=&quot;stock_location_stock&quot;/&gt;<br />166.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lot_stock_id&quot; ref=&quot;stock_location_stock&quot;/&gt;<br />167.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;lot_output_id&quot; ref=&quot;stock_location_output&quot;/&gt;<br />168.&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br /><br />
      



      在 164 行中, 创建仓库 时, 公司字段 自动从 res.company 对象中 以 domain=[] 进行 search, 得到结果后将 公司 name 返回给 sotck.warehouse 的 name 字段.
      默认情况下, 不指定 use="字段" 就会使用 查到的 res.company 的db_id 做为值. 其他情况下, 可以指定 res.company  的其他字段做为返回.


      1 Reply Last reply Reply Quote 0
      • N
        NewMoon last edited by

        果断收藏!

        1 Reply Last reply Reply Quote 0
        • C
          ccdos last edited by

          政治敏感性不足啊,

          我前几周 也读到了这一段 ......

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

            还是缺乏一个可以做代码共同review和comments的平台。。。。

            这样无domain search岂不是会返回多个company,那么取哪个的db_id或者name呢?[0] ?

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