4
votes

I have a custom module i made for openerp 6.1 originally, i wanted to install it on another openerp server i got, using the latest openerp 7 version.

I already did "Update modules list" and searched through "Extra" and "Not installed" filters, but no success.

I've read somewhere that openerp 6.1 modules aren't exactly the same on openerp 7

Could omebody show some light on this? Also the documentation about custom modules on openerp 7 is really poor at the moment.

Here's my __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()

and finally the schoolsout_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>

Any advice would be very appreciated, thank you very much

5

5 Answers

5
votes

enter image description hereYou module work perfectly. "Update modules list" and searched through "Not installed" filters not include "Extra", you will find your module.

There are many changes from 6.1 to 7 version. First when you intall your module in 7, then you have to do some changes in your module. Like:

Change in you openerp.py file, Now

"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

And from your view.xml file remove " <field name="type">tree</field>"

Your code work perfectly.

Thanks

3
votes

I ran into this problem several times and now found the solution for finding modules that definitely are in the addons folder, but are not shown in the application list. It appears to be that the list of applications only shows the addons that are available ONLINE. So if you want to see the module you developed locally you should first update the module list. To be able to do this you have to first set your user as a technical user as described here.

After the module list has been update you can find your module under the menu entry Installed modules by removing the Installed tag in the search field. Now you can look for your module in the list or even search for it. But you will only find it in this view. Hope that helps...

1
votes

Try this:

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()

I tried your code and it's working without any error.

1
votes

I was able to see your module w/o problem, but it would not install.

I got an xml parser error,". . . extra content at end of file".

I enclosed your record definitions correctly as follows to get rid of that problem.

<?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> 

Then all went well.

I tried to use your model when you first posted this and also could not find it in my modules list. At that time I was running OpenERP V7 build 20130213-002107

Recently, I updated to 20130305-002149. That might get you past this.