Odoo Help


How to add fields inside of fields.

Arjun Khode
on 4/7/15, 2:35 AM 1,242 views

I want to add a field 'cost' inside the one2many firld bom_line_ids

When I try to access the fields inside, I get an error 'too many fields to unpack'

How to do this? This is my code:

<field name="inherit_id" ref="mrp.bom.form"/>

<field name="arch" type="xml">

<page string="Components">

<field name="bom_line_ids" widget="one2many_list">

<tree string="Components" editable="bottom">

<field name="sequence" position="after">

<field name="cost"/>


Anil R. Kesariya

--Anil R. Kesariya--
| 7 6 8
Rajkot, India
--Anil R. Kesariya--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.

Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66

Anil R. Kesariya
On 4/7/15, 5:51 AM

Arjun Khode,

1) Make sure you have added that field from python for the one2many model.

2) Make sure model name is mrp.bom

3) Provide fully qualified path to get exact position.

Here you go!

     <record id="inherit_mrp_bom_form_view" model="ir.ui.view">

     <field name="name">inherit.mrp.bom.form</field>

     <field name="model">mrp.bom</field>

     <field name="inherit_id" ref="mrp.bom.form"/>

     <field name="arch" type="xml">

         <xpath expr="//notebook/page[@string='Components']/field[@name='bom_line_ids']/tree[@string='Components']/field[@name='sequence']" position="after">

             <field name="cost" />





Hope this will helps you.






| 6 5 7
Tbilisi, Georgia
On 4/7/15, 3:19 AM

why you've set attribute position="after" with the field "sequence" ? you don't have to set it.

You removed

from sequence tag?
on 4/7/15, 6:01 AM

yes, I tried removing it Temur. It didn't work

Arjun Khode
on 4/7/15, 6:05 AM

ok. keep it removed, you're using tree inside of one2many tag.. in this case you have to add all fields you like to be displayed to this tree, but you don't need to use "position" atribute, just write fields in order that you like. can you post bit more lines of xml record?

on 4/7/15, 6:11 AM

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
| 5 5 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 4/7/15, 4:31 AM

try using xpath to inherit existing view

<xpath expr="//page[@string='Components']/field[@name='bom_line_ids']/tree[@string='Components']/field[@name='sequence']" position="after">
    <field name="cost" />

It's still giving me "too many fields to unpack error"

Arjun Khode
on 4/7/15, 4:48 AM

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

1 follower(s)


Asked: 4/7/15, 2:35 AM
Seen: 1242 times
Last updated: 4/7/15, 5:51 AM