繁体   English   中英

集成OpenChatter和OpenERP自定义模块错误

[英]integration of OpenChatter and OpenERP custome module erro

我创建了一个带有表单和几个字段的模块。 我想添加一个注释,例如系统(OpenERP中的Chatter),如何轻松地将聊天添加到我的模块中。

给我代码片段,让我知道我的表格放在哪里

我的XML文件是

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- action windows -->
    <record model="ir.actions.act_window" id="course_list_action">
        <field name="name">Questions form</field>
        <!--<field name="date_of_q_created">Date of Q xml</field>-->
        <field name="res_model">openacademy.course</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
        <p class="oe_view_nocontent_create">Create the first Question</p>
        </field>
    </record>

    <record model="ir.ui.view" id="course_form_view">
      <field name="name">course.form</field>
      <field name="model">openacademy.course</field>
      <field name="arch" type="xml">

      <form string="Questions Form">

      <field name="name" colspan="4" />
      <field name="description" colspan="4" />
      <field name="date_of_q_created" colspan="4" />
      <field name="category_question" colspan="4" />
      <field name="create_uid" colspan="4" />

      <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
      </form>
      </field>


     </record>

<!-- menuitems -->
    <menuitem id="main_openacademy_menu" name="Manage forum" />
        <menuitem id="openacademy_menu" name="Discussion Forum" parent="main_openacademy_menu" />
        <menuitem id="courses_menu" name="Questions sidemenu" parent="openacademy_menu" action="course_list_action" />


</data>
</openerp>

我的.py文件是

import datetime
import time
import openerp
from openerp.osv import osv, fields


class Course(osv.Model):
    _name = "openacademy.course"


    _columns = {
              'name' : fields.char(string="Question Title", size=256, required=True),
              'description' : fields.text(string="Question Description", required=True),
              'date_of_q_created': fields.datetime('Date of Created'),
              'category_question': fields.many2one('openacademy.categ', 'Question Category'),
              'create_uid': fields.many2one('res.users', 'Question Created By', readonly=True),
                 }

class Course(osv.Model):
    _name = "openacademy.course"
    _inherit = ['mail.thread', 'ir.needaction_mixin']


class question_categ(osv.osv):
    _name='openacademy.categ'
    _description='category of Question'
    _columns={
       'name':fields.char('Create a Category type',size=100)
    }
question_categ()

但我收到以下错误。

'You may need to add a dependency on the parent class\' module.' % (name, parent_name))
TypeError: The model "openacademy.course" specifies an unexisting parent class "mail.thread" You may need to add a dependency on the parent class' module.

帮助我摆脱这个.. :-(

只需将该标签添加到表单视图的所有字段之后, <div class=”oe_chatter”> ... content of the bottom part ... </div> ,希望对您有所帮助。 有关更多详细信息, 参见https://doc.openerp.com/trunk/server/form-view-guidelines/

在您的xml中尝试一下,

   <div class="oe_chatter">
       <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
       <field name="message_ids" widget="mail_thread"/>
   </div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM