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

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

    odoo ids

    Odoo 新手求助
    3
    13
    3791
    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.
    • H
      hui last edited by

      代码中出现的self.family_base_id.value_drive_ids.ids,是不是odoo中的用法就是如果想获取符合条件的所有对象的id,就默认可以使用ids,其他对象也是一样的.odoo文档中有提到的吗?

      @api.onchange('family_base_id')
          def _onchange_family_base_id(self):
              self.value_drive = False
              if self.family_base_id:
                  lines = [{'product_id': self.id, 'value_drive_id': x} for x in  self.family_base_id.value_drive_ids.ids]
                  self.update({'value_drive': lines})
      
      1 Reply Last reply Reply Quote 0
      • Joshua
        Joshua 管理员 last edited by Joshua

        ids是recordset的id的列表。
        文档: https://www.odoo.com/documentation/10.0/reference/orm.htm

        ids
        List of actual record ids in this recordset (ignores placeholder ids for records to create)

        H 1 Reply Last reply Reply Quote 0
        • H
          hui @Joshua last edited by

          @joshua
          那我可以理解成:如果我想search获取其他操作满足条件的recordset的列表时,我就可以使用对象.ids获取,是这个意思吧

          1 Reply Last reply Reply Quote 0
          • 袭
            袭流苏2amor last edited by

            前提是你这个ids要跟你想要获取的列表中的某个id对应才可以

            H 1 Reply Last reply Reply Quote 0
            • H
              hui @袭流苏2amor last edited by

              @袭流苏2amor
              只要我返回的ids跟我的键的id是一个对象就行,是这个意思吧

              袭 1 Reply Last reply Reply Quote 0
              • 袭
                袭流苏2amor @hui last edited by

                @1234567 嗯

                H 1 Reply Last reply Reply Quote 0
                • H
                  hui @袭流苏2amor last edited by

                  @袭流苏2amor
                  ok,谢谢,非常感谢.

                  1 Reply Last reply Reply Quote 0
                  • 袭
                    袭流苏2amor last edited by

                    看到你一个关于Unkown的帖子,这种一般都是没有定义name造成的。你尝试一下

                    H 1 Reply Last reply Reply Quote 0
                    • H
                      hui @袭流苏2amor last edited by

                      @袭流苏2amor
                      你好,我定义了name属性的,这样的 name = fields.Char('Reference', copy=False, required=True, help="ECO Number", default="New")

                      1 Reply Last reply Reply Quote 0
                      • 袭
                        袭流苏2amor last edited by

                        嗯,你试一下看看好没好,正常应该是可以的

                        H 1 Reply Last reply Reply Quote 0
                        • H
                          hui @袭流苏2amor last edited by

                          @袭流苏2amor
                          我的意思是,我原来就有定义的name的属性的,但是还是有的用户组会报这种错误的

                          1 Reply Last reply Reply Quote 0
                          • 袭
                            袭流苏2amor last edited by

                            用户组报错什么概念?

                            H 1 Reply Last reply Reply Quote 0
                            • H
                              hui @袭流苏2amor last edited by

                              @袭流苏2amor
                              不是用户组报错,是有的用户登录没问题,有的用户登录form视图显示Unknown,但是tree视图显示正确的

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