跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 新手求助
  4. 一个many2many的问题

一个many2many的问题

已定时 已固定 已锁定 已移动 Odoo 新手求助
6 帖子 3 发布者 4.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • B 离线
    B 离线
    baolang00
    写于 最后由 编辑
    #1

    many2many字段在画面上是不显示的吗?比如下面的代码,students是many2many类型的,view中也有<field name="students"/>的描述,但是显示出来的画面上却没有学生的相关信息。

    lesson.py

    <br />class oecn_training_lesson(osv.osv):<br />&nbsp; &nbsp; _name = &quot;oecn.training.lesson&quot;<br />&nbsp; &nbsp; _discription = &quot;OECN 培训课程&quot;<br />&nbsp; &nbsp; _columns = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;name&quot;: fields.char(u&quot;课程名&quot;, size=64, select=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;date_start&quot;: fields.date(u&quot;开始日期&quot;, select=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;total_day&quot;: fields.float(u&quot;总天数&quot;, digits=(16, 1)),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;teacher&quot;: fields.many2one(&quot;res.users&quot;, u&quot;授课老师&quot;),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;students&quot;: fields.many2many(&quot;res.partner&quot;, &quot;lesson_student_rel&quot;, &quot;lesson_id&quot;, &quot;student_id&quot;, u&quot;学生&quot;),<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;price&quot;: fields.float(u&quot;价格&quot;, digits=(16, 2)),<br />&nbsp; &nbsp; }<br />oecn_training_lesson()<br />
    


    lesson_view.xml

    <br />		&lt;!--定义表单视图 --&gt;<br />		&lt;record model=&quot;ir.ui.view&quot; id=&quot;oecn_training_lesson_from_view&quot;&gt;<br />			&lt;field name=&quot;name&quot;&gt;课程表单&lt;/field&gt;<br />			&lt;field name=&quot;type&quot;&gt;form&lt;/field&gt;<br />			&lt;field name=&quot;model&quot;&gt;oecn.training.lesson&lt;/field&gt;<br />			&lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />				&lt;field name=&quot;name&quot; /&gt;<br />				&lt;field name=&quot;date_start&quot; /&gt;<br />				&lt;field name=&quot;total_day&quot; /&gt;<br />				&lt;field name=&quot;price&quot; /&gt;<br />				&lt;field name=&quot;teacher&quot; /&gt;<br />				&lt;field name=&quot;students&quot;/&gt;<br />			&lt;/field&gt;<br />		&lt;/record&gt;<br />
    


    显示的画面上并没有student(学生)的信息,这是为什么呢?
    [img [检测到链接无效,已移除] /img]

    1 条回复 最后回复
    0
    • B 离线
      B 离线
      baolang00
      写于 最后由 编辑
      #2

      解决了,需要加个Form 😮

      1 条回复 最后回复
      0
      • K 离线
        K 离线
        K_Go
        写于 最后由 编辑
        #3

        [quote author=baolang00 link=topic=5844.msg14584#msg14584 date=1363912244]
        解决了,需要加个Form 😮
        [/quote]

        在哪儿加啊。。。不是已经有了吗。。我还以为是6和7的区别呢。。。。

        1 条回复 最后回复
        0
        • mrshellyM 离线
          mrshellyM 离线
          mrshelly
          写于 最后由 编辑
          #4
          <br /><br />&lt;!--定义表单视图 --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record model=&quot;ir.ui.view&quot; id=&quot;oecn_training_lesson_from_view&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;课程表单&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;form&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;oecn.training.lesson&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;form string=&quot;Lesson&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;date_start&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;total_day&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;price&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;teacher&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;students&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;/form&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br /><br />
          
          1 条回复 最后回复
          0
          • K 离线
            K 离线
            K_Go
            写于 最后由 编辑
            #5

            [quote author=mrshelly link=topic=5844.msg14660#msg14660 date=1364476200]

            <br /><br />&lt;!--定义表单视图 --&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record model=&quot;ir.ui.view&quot; id=&quot;oecn_training_lesson_from_view&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;课程表单&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;form&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;oecn.training.lesson&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;form string=&quot;Lesson&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;date_start&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;total_day&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;price&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;teacher&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;students&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;/form&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br /><br />Thanks.......<br /><br />
            


            [/quote]

            1 条回复 最后回复
            0

            • 登录

            • 没有帐号? 注册

            • 登录或注册以进行搜索。
            • 第一个帖子
              最后一个帖子
            0
            • 版块
            • 标签
            • 热门
            • 用户
            • 群组