0
votes

Hi I have created a custom module in openerp 7. I am using eclipse in order to run the code. I have put a button on my module which will open a new form on clicking. The button is loading the form but there are no fields present on the form. I do not know where I am wrong. Plz guide me .

Hopes for suggestion

Here is my xml

 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
    <data>
       <record model="ir.ui.view" id="from_view_form">
            <field name="name">from.view.form</field>
            <field name="model">my.window</field>
            <field name="arch" type="xml">
                <form string="Form" version="7.0">
                    <group>
                        <field name="name" />
                        <field name="bdate" />
                        <button name="display" string="Add Field" type="object"  class="oe_highlight" />
                    </group>
                </form>
            </field>
        </record>
        <record model='ir.ui.view' id='2'>
            <field name="name">Form</field>
            <field name="model">my.window</field>
            <field name="arch" type="xml">
                <form string="Form" version="7.0">
                    <group>
                        <field name="name" />
                        <field name="bdate" />
                    </group>
                </form>
            </field>
        </record>
        <record model='ir.actions.act_window' id='form_view_action'>
            <field name="name">Form</field>
            <field name="res_model">my.window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="context">{}</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Click to create a new record.
                </p>
                <p>This is a test class developed to learn Openerp.</p>
            </field>
        </record>
        <menuitem name="newforms" id="newforms_ID" sequence="110" />
        <menuitem name="newforms2" parent="newforms_ID" id="newforms2_ID" sequence="0" />
        <menuitem name="newforms3" parent="newforms2_ID" id="newforms3_ID" action='form_view_action' />
    </data>
</openerp>

Here is my python code

from osv import fields, osv
import time

class my_window(osv.osv):
    _name="my.window"
    _columns={
         'name':fields.char('Name',size=64),
         'bdate':fields.date('BirthDate')     
            }

    def display(self,cr,uid,ids,context=None):
           return {
        'name':'formview', 
        'view_mode': 'form',
        'view_type': 'form',
        'res_id' : '2', # id of the object to which to redirected
        'res_model': 'ir.actions.act_window', # object name
        'type': 'ir.actions.act_window',
        'target': 'new' # if you want to open the form in new tab
}
1

1 Answers

0
votes

your res_model given is wrong. please give it as 'from.view.form' please check the following link Method return value to call another form in OpenERP