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

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

    Many2one 动态 domain

    Odoo 新手求助
    2
    4
    3437
    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.
    • L
      l315276651 last edited by

      最近在一个功能 类似于 select 的级联操作, A change 动态加载 B中的值
      在OE中 就是 many2one 字段  在on_change 里 ,设置 字段B的 domain
      请问各位大神 这个功能在OE里面 怎么实现?

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

        在on_change 里 ,设置 字段B的 domain

        就这么实现啊,代码里搜onchange,必有一款适合您

        GoodERP -- Odoo China fork

        1 Reply Last reply Reply Quote 0
        • L
          l315276651 last edited by

          [quote author=Jeff link=topic=16515.msg28547#msg28547 date=1406109802]
          在on_change 里 ,设置 字段B的 domain

          就这么实现啊,代码里搜onchange,必有一款适合您
          [/quote]

          谢谢Jeff的回复 在 res_partner.py 中找到了相关用法

          <br />&nbsp; &nbsp; def onchange_type(self, cr, uid, ids, is_company, context=None):<br />&nbsp; &nbsp; &nbsp; &nbsp; value = {}<br />&nbsp; &nbsp; &nbsp; &nbsp; value&#91;&#039;title&#039;] = False<br />&nbsp; &nbsp; &nbsp; &nbsp; if is_company:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; domain = {&#039;title&#039;: [(&#039;domain&#039;, &#039;=&#039;, &#039;partner&#039;)]}<br />&nbsp; &nbsp; &nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; domain = {&#039;title&#039;: [(&#039;domain&#039;, &#039;=&#039;, &#039;contact&#039;)]}<br />&nbsp; &nbsp; &nbsp; &nbsp; return {&#039;value&#039;: value, &#039;domain&#039;: domain}<br />
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post