Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Action window is blank in OpenERP 7

By
Saghir A. Khatri
on 7/18/13, 6:12 AM 3,502 views

i am trying to load action window using python class to Open ERP. i have created and installed module on OpenERP. in that module,a user clicks on button to fill some form fields. i am using action window to display fields. but when action window opens, no field is displayed.

here is my __init__.py

import mywin

here is my __openerp__.py

{
    'name':'form module',
    'version':'1.0',
    'description':"""
        New Form Module
        """,
    'author':'arsalan',
    'depends':['base'],
    'data':['mywin_view.xml'],
    'installable':True,
    'auto_install':False
}

here is my mywin.py

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
}

here is my mywin_view.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>

please let me know, what is wrong with my code. and why Action Window is all blank. Thanks in Advance

3

Remya

--Remya--
5813
| 7 8 8
Thiruvananthapuram, India
--Remya--

Working as an Senior ODOO developer. http://in.linkedin.com/pub/remya-r/69/a23/298

Remya
On 7/19/13, 6:07 AM

menuitem name="newforms3" parent="newforms2_ID" id="newforms3_ID" action="form_view_action"

please change single quotes into double.

0
Balvant
On 3/11/15, 2:35 AM

i want to create new window with one textarea and button. without create model and form how to possible it ?

0
Saghir A. Khatri
On 7/22/13, 4:33 AM

i forgot to create view window in xml. my bad, Thanks for all the suggestions

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 7/18/13, 6:12 AM
Seen: 3502 times
Last updated: 3/16/15, 8:10 AM