Odoo Help

0

How to add fields inside of fields.

By
Arjun Khode
on 4/7/15, 2:35 AM 859 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"/>

2

Anil R. Kesariya

--Anil R. Kesariya--
4541
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
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" />

        </xpath>

        </field>

    </record>

......

Hope this will helps you.

Regards,

Anil.

0

Temur

--Temur--
2912
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
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

position="after"
from sequence tag?
Temur
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?

Temur
on 4/7/15, 6:11 AM
0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
4002
| 5 4 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" />
</xpath

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.

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

1 follower(s)

Stats

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