Odoo Help


How to display a one2many field as a one2many_list properly ?

on 12/19/13, 12:00 PM 1,721 views

Hi !

I've an object called shipping_rule, with the following definition :

class shipping_rule(osv.osv):
    _name = 'shipping_rule'

    _columns = {
        'name': fields.char('Rule name', size=128, required=True),
        'rule_priority': fields.integer('Priority', required=True),
        'partner_id': fields.many2one('res.partner', 'Company', required=True),
        'cost': fields.float('Shipping cost', required=True)

Now, I've inherited res.partner like this :

class res_partner(osv.osv):
    _inherit = 'res.partner'

    _columns = {
        'shipping_rules_list': fields.one2many('shipping_rule', 'partner_id', 'Shipping rules')

Finally, I've tried to display a list of shipping rules related to the partner:

<?xml version="1.0" encoding="utf-8"?>
        <record model="ir.ui.view" id="shipping_partner">
            <field name="name">res.partner.form.shipping</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form" />
            <field name="arch" type="xml">
                <notebook position="inside">
                    <page string="Shipping rules">
                        <field name="shipping_rules_list" colspan="4" nolabel="1" widget="one2many_list" mode="tree" >
                                <field name="name" />
                                <field name="cost" />
                                <field name="rule_priority" />

But, I always get an XML invalid architecture :/

I don't want the list to be editable for now, just display the tree.

Thanks for your help !

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.


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)


Asked: 12/19/13, 12:00 PM
Seen: 1721 times
Last updated: 3/16/15, 8:10 AM