【问题标题】:My custom module does not appears on my openerp 7 installation我的自定义模块没有出现在我的 openerp 7 安装中
【发布时间】:2013-02-04 21:41:05
【问题描述】:

我最初为 openerp 6.1 制作了一个自定义模块,我想将它安装在我得到的另一台 openerp 服务器上,使用最新的 openerp 7 版本。

我已经做了“更新模块列表”并搜索了“额外”和“未安装”过滤器,但没有成功。

我在某处读到 openerp 6.1 的模块在 openerp 7 上并不完全相同

有人可以对此有所了解吗?目前关于 openerp 7 自定义模块的文档也很差。

这是我的__init__.py

import schoolsout

__openerp__.py

{
"name" : "Student Information",
"version" : "6.0.1",
"author" : "Koci",
"website" : "http://www.tuespacioweb.com.ve",
"category" : "General",
"depends" : ["base"],
"description" : "Certificados de NO Produccion Grafibond",
"init_xml" : [],
"demo xml" : [],
"update_xml" : [ "schoolsout_view.xml"],
"installable": True,
"active": False,
"certificate" : ""

}

schoolsout.py

from openerp.osv import fields, orm

class student(orm.Model):

    _name = 'student.student'

    _columns = {
            'name' : fields.char('Student Name', size=16, required = True, translate=True),
            'age' : fields.integer('Age',readonly = True),
            'percent' : fields.float('Percentage',help = 'This field will add average marks of student out of 100.'),
            'gender' : fields.selection([('male','Male'),('female','Female')],'Gender'),
            'active' : fields.boolean('Active'),
            'notes' : fields.text('Details'),
            }

    _defaults = { 'name' : 'Atul',
        'active' : True,                    
    }

student_student()

最后是schoolout_view.xml

<?xml version="1.0" encoding="utf-8"?>

<!-- Student search view -->

<record model="ir.ui.view" id="student_search">
    <field name="name">student.search</field>
    <field name="model">student.student</field>
    <field name="type">search</field>
    <field name="arch" type="xml">
    <search string="Student Information Search" version="7.0">
        <field name="name" string="Student Name" />
        <field name="gender" string="Gender" />
        <field name="age" string="Age" />
    </search>
    </field>
</record>

<!-- Student tree view -->

<record id="student_student_tree" model="ir.ui.view">
    <field name="name">student.result.tree.new</field>
    <field name="model">student.student</field>
    <field name="type">tree</field>
    <field name="arch" type="xml">
        <tree string="Student_result" version="7.0">
            <field name="name" />
            <field name="age" />
            <field name="percent" />
            <field name="gender" />
            <field name="active" />
        </tree>
    </field>
</record>

<!--Student Form View-->

<record id="student_student_form" model="ir.ui.view">
    <field name="name">student.result.form</field>
    <field name="model">student.student</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form string="Student_result" version="7.0">
            <field name="name" />
            <field name="age" />
            <field name="percent" />
            <field name="gender" />
            <field name="active" />
            <field name="notes" />
        </form>
    </field>
</record>

<!-- Student Action-->

<record id="action_student_student" model="ir.actions.act_window">
    <field name="name">Student Information</field>
    <field name="res_model">student.student</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>

<!--Student Menu-->

<menuitem id="student_parent" name="Student" icon="terp-partner"/>
<menuitem id="menu_student_parent" name="Student Management" parent="student_parent"></menuitem>
<menuitem action="action_student_student" id="menu_student_student" parent="menu_student_parent" string="Result"/>

</data>

非常感谢您的任何建议,非常感谢您

【问题讨论】:

    标签: python module ubuntu-12.04 openerp


    【解决方案1】:

    试试这个:

    from openerp.osv import osv, fields
    
    class student(osv.Model):
        _name = 'student.student'
        _columns = {
            'name' : fields.char('Student Name', size=16, required = True, translate=True),
            'age' : fields.integer('Age',readonly = True),
            'percent' : fields.float('Percentage',help = 'This field will add average marks of student out of 100.'),
            'gender' : fields.selection([('male','Male'),('female','Female')],'Gender'),
            'active' : fields.boolean('Active'),
            'notes' : fields.text('Details'),
    }
        _defaults = { 'name' : 'Atul',
        'active' : True,
    }
    
    student()
    

    我尝试了您的代码,它运行正常,没有任何错误。

    【讨论】:

      【解决方案2】:

      You 模块完美运行。 “更新模块列表”并通过“未安装”过滤器搜索不包括“额外”,您会找到您的模块。

      从 6.1 到 7 版本有很多变化。首先,当您在 7 中安装模块时,您必须对模块进行一些更改。喜欢:

      改变你的 openerp.py 文件,现在

      "update_xml" replace with "data"
      "init_xml" removed,used in directly in data just put <data noupdate="1"> in xml
      "demo xml"  replace with "demo"
      "active" removed, installable is ok
      

      然后从您的 view.xml 文件中删除 " &lt;field name="type"&gt;tree&lt;/field&gt;"

      您的代码完美运行。

      谢谢

      【讨论】:

      • 嘿,非常感谢你们的帮助!是的,在 Openerp 6.1 中完美运行,但在 OpenErp 7 上我仍然看不到它(模块):(,我在 Ubuntu 12.04 顺便说一句
      • 您好 user2089267,我尝试了您的代码而没有更改任何一行代码,并且它对我有用。您可以将模块发送给我吗,我会再次在我身边检查以供您参考,我附上了图片。
      • 啊,是的,我在哪里可以发给你?
      • 我也在使用 Ubuntu。对我来说,该模块也没有出现在列表中。问题是访问权限。默认情况下,当我们复制到插件文件夹时,权限为rwx------。我通过授予完全权限来解决此问题。一切正常。
      【解决方案3】:

      我可以看到您的模块没有问题,但它无法安装。

      我收到一个 xml 解析器错误,“...文件末尾有额外内容”。

      我正确地附上了您的记录定义如下,以解决这个问题。

      <?xml version="1.0" encoding="utf-8"?>
      
      <openerp>
       <data>
      
       <!-- Student tree view -->
      
           :
           :
           :
           :
      
       <menuitem action="action_student_student" id="menu_student_student" parent="menu_student_parent" string="Result"/>
      
       </data>
      </openerp> 
      

      然后一切顺利。

      当您第一次发布此内容时,我尝试使用您的模型,但在我的模块列表中也找不到它。当时我正在运行 OpenERP V7 build 20130213-002107

      最近,我更新到20130305-002149。这可能会让你度过难关。

      【讨论】:

      • 哇,谢谢,我认为更改 openerp 构建可能会解决这个问题,非常感谢
      【解决方案4】:

      【讨论】:

        【解决方案5】:

        我多次遇到这个问题,现在找到了找到肯定在插件文件夹中但未显示在应用程序列表中的模块的解决方案。 似乎应用程序列表仅显示在线可用的插件。所以如果你想看到你在本地开发的模块,你应该首先更新模块列表。为了能够做到这一点,您必须首先将您的用户设置为技术用户,如 here 所述。

        模块列表更新后,您可以通过删除搜索字段中的 Installed 标记,在菜单条目 Installed modules 下找到您的模块。现在您可以在列表中查找您的模块,甚至可以搜索它。但是你只会在这个视图中找到它。 希望对您有所帮助...

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-04-17
          • 1970-01-01
          • 1970-01-01
          • 2015-10-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多