Odoo Help

2

inherited form does not display correctly?

By
Abdullah Sofan
on 9/27/13, 6:42 PM 1,690 views

I'm very new to Openerp so please bare with me if my mistake is too obvious :-)

I'm trying to create a new model called clients.client inheriting from res.partner

The code partially works, but the problem now is that the form displays differently than expected. The form view shows all the views of the parent view as well as the new field, but the order and look is not as expected. Can someone help?

the clients.py code is the same as above (no change):

from openerp.osv import osv, fields

class clients_client(osv.osv):
    _inherit = 'res.partner'
    _name = 'clients.client'
    _columns = {
        'id_type': fields.char('ID Type', size=30),
    }
clients_client()

the clients_view.xml looks like this after modification:

<?xml version="1.0"?>
<openerp>
<data>

    <record model="ir.ui.view" id="view_clients_client_form">
        <field name="name">clients.client.form</field>
        <field name="model">clients.client</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
        <xpath expr="//field[@name='active']" position="after">
                    <field name="id_type"/>
                </xpath>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_clients_client">
        <field name="name">Clients</field>
        <field name="res_model">clients.client</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem name="Clients/Clients/Clients" id="menu_clients_client" action="action_clients_client"/>


</data>
</openerp>

As I said before, the form looks different form the way it looks in other modules. Please see the picture:

sama4g.com/res.partner.view.jpg

Can someone help me get the form to look the same way?

1
Janarthanan
On 5/26/16, 1:44 AM

 <field name="view_id" ref="view_clients_client_form"/>

insert this in your windows action after view mode 

0
laribi
On 9/29/13, 7:54 AM

Hello , You must delete all the fields that you don't want to show with <xpath expr="//field[@name='active']" position="replace"/>.

I want to show them all, but the form does not show as expected. please see the image link i provided above to know what I mean.

Abdullah Sofan
on 10/1/13, 6:30 PM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 9/27/13, 6:42 PM
Seen: 1690 times
Last updated: 5/26/16, 1:44 AM