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.

1

getting list of customer from res.partner on tree view

By
H+
on 6/6/13, 4:08 AM 2,133 views

I am a new to python and openerp. the following code loads into openerp with no errors; however, I am not seeing any data from res.partner as I am expecting to.

Can anyone see what the problem is in my code?

 class delivery_forcast(osv.osv):

    _name = "delivery.forcast"
    _inherit = "res.partner"
    _columns={
        'delivery_state': fields.selection([
            ('scheduled','Scheduled'),
            ('delivered','Delivered')],
                'Delivery Status', readonly=True, track_visibility='onchange'),
        'est_delivery_date': fields.date('Estimated Delivery Date', readonly=False),
        'container_size': fields.integer('Container Size', help='Container size to be filled in gallons',readonly=False),
    }

delivery_forcast()

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_delivery_forcast_tree" model="ir.ui.view">
            <field name="name">delivery.forcast.tree</field>
            <field name="model">delivery.forcast</field>
            <field name="arch" type="xml">
                <tree string="Partner List">
                    <field name="name"/>
                    <field name="est_delivery_date"/>  
                    <field name="container_size"/>   
                    <field name="delivery_state"/> 
                </tree>
            </field>
        </record>


        <record id="show_delivery_forcast_tree" model="ir.actions.act_window">
            <field name="name">Delivery Forcasts</field>
            <field name="res_model">delivery.forcast</field>
            <field name="view_type">tree</field>
            <field name="view_mode">tree</field>
            <field name ="domain">[('customer','=',1)]</field>  
        </record>


        <menuitem name="Delivery Forcasts" id="menu_delivery_forcasts" action="show_delivery_forcast_tree"/>

    </data>

</openerp>
1

When you are inheriting a model and creating another model, the new model will not have the data from inherited model.

Here you have inherited res.partner and created new model delivery.forcast. So data will be stored in new table delivery_forecast.

You have to specify the table name of the inherited model in order to show all the data in _table.

It should be like this:

_name = 'delivery.forcast'
_inherit = 'res.partner'
_table = 'res_partner'

It will show all the data in res_partner.

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: 6/6/13, 4:08 AM
Seen: 2133 times
Last updated: 3/16/15, 8:10 AM