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

Inherit a predefined view.

By
Hussain Nagri
on 12/15/13, 5:06 AM 2,661 views

I am new to OpenERP and trying to understand it, What I am trying to do is that I create a new Module and then on that module I call a view of sale_order, but I want to customize the view the way I want. Lets say the default view shows five coloumns and I want only two out of those five coloumns to be displayed. I tried some coding but it shows the default view. Here is my code.

sale_order_duplicate_view.xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>

        <menuitem name="Genrate Dictonary" id="menu_sale_order_duplicate1" />



        <record id="sale_order_duplicate_tree1" model="ir.ui.view">
        <field name="naame">sale.order.tree.inherit</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_quotation_tree" />
        <field name="arch" type="xml">

                    <field name="date_order"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
        </field>
     </record>

        <record model="ir.actions.act_window" id="action_sale_order_duplicate1">
            <field name="name">Sale Order Duplicate</field>
            <field name="res_model">sale.order</field>
            <field name="view_id" ref="sale_order_duplicate_tree1"/>
        </record>

        <menuitem name="Duplicate" id="menu_sale_order_duplicate_submenu1" parent="menu_sale_order_duplicate1"/>
        <menuitem name="Sale Order Duplicate" id="menu_sale_order_sub_sub_menu1"
            parent="menu_sale_order_duplicate_submenu1" action="action_sale_order_duplicate1" />
    </data>
</openerp>

sale_order_duplicate.py

from openerp.osv import fields,osv
from openerp.addons.fleet.fleet import fleet_vehicle
from openerp.osv.fields import _column



class sale_order_duplicate(osv.osv):
    _inherit = 'sale.order'
    _description = "Sales Order"
    _columns = {

                }

sale_order_duplicate()

Can someone please tell me what else should I do and how this thing actually works. Thank you.

0
a.schenkels
On 12/15/13, 5:24 PM

You can take a look at the technical information provided by OpenERP itself. www.openerp.com/files/memento/OpenERP_Technical_Memento_latest.pdf

When you do an inherit of the view you should do a field replace/after/before or use xpath.

André Schenkels www.schenkels.nl

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

1 follower(s)

Stats

Asked: 12/15/13, 5:06 AM
Seen: 2661 times
Last updated: 3/16/15, 8:10 AM