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.

3

Show Tree view inside a Note book page

By
GuruDev
on 7/1/13, 5:15 AM 6,354 views

Dear All, Please let me know, how to display, A Tree view (which is able to add new lines) inside a notebook page. Like, in purchase requisition we add the products to be purchased, as line by line. Im using V7.

Please help.

4

Keyur

--Keyur--
1165
| 4 4 8
Ahmedabad, India
--Keyur--

Odoo Expert

Keyur
On 7/1/13, 6:08 AM

Hi Gurudev,

You can add tree view inside page like this,

<record id="form_id" model="ir.ui.view">
    <field name="name">object.object.form</field>
    <field name="model">object.object</field>
    <field name="arch" type="xml">
        <form string="Form String" version="7.0">
        <header>
        </header>
        <sheet>
            <div class="oe_title">
            </div>
            <notebook>
                <page string="Page String">
                    <field name="one2many_field">
                        <tree string="Tree String">
                            <field name="name"/>
                            <field name="date_planned"/>
                            <field name="price_subtotal"/>
                        </tree>
                    </field>
                </page>
            </notebook>
        </sheet>
        </form>
    </field>
<record/>

Dear keyur, """<field name="one2many_field"> <tree string="Tree String"> <field name="name"/> <field name="date_planned"/> <field name="price_subtotal"/> </tree> </field>"""

this "one2many_field" is from different model, right? Is it necessary that, that model should contain a view?(or a tree view?)

GuruDev
on 7/1/13, 7:08 AM

The model should contain a view. Because model's view is considered everywhere wherever you use that model as one2many or many2many if you don't specify inline view. If you don't want to make view then you have to make inline view for that model as I mentioned in above answer.

Keyur
on 7/1/13, 7:16 AM
0
GuruDev
On 7/1/13, 6:59 AM

Dear Keyur, Thank you for the reply. I need to have an extra notebook_PAGE in hr_employee. The new page is to Store some extra data, which has to be added frequently(may be twice in a month).

For that, I created a new module say, hr_extended. In that I inherited the hr_employee. And in the view file, added the my new Page, aslo. That all worked fine.

Now, what I want is. The data which I want to store should come as a table view under the new Page. So that I can see the previous datas also. To capture the new data, a new model should be created right? like sale_order_lines comes in slae_order. But, how to display this new model's data in my hr_extended module? Awaiting your reply..

You can make one2many field under your page and add in the view you want. one2many field will show you data in tabular format.

Keyur
on 7/1/13, 7:18 AM

Im new to programming, Please let me know.. how to put, many2one.

Suppose my datas to be stored are..

[model is operator.code] _columns = { 'code' : fields.char('Operator Code', size=32,required=True) 'reg_date': fields.date('Registered On') 'note': char('Notes', size=32) }

..And, I want to take them into my hr_extended module..that means, I want to connect it via a

'op_code' : fields.one2many('operator.code', '?', '?'),

How to do this?

GuruDev
on 7/1/13, 7:36 AM

I hope you get the answer of the question you posted here. For new questions I suggest you to make a new post otherwise this posted question will become messy.

Keyur
on 7/1/13, 8:04 AM

Ok.. Mean time, please let me know, how to add code in Questions and comments :)

GuruDev
on 7/1/13, 9:03 AM

Thank you Keyur, It worked.. :)

GuruDev
on 7/1/13, 12:40 PM

Great. Keep it up :)

Keyur
on 7/2/13, 2:13 AM

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

2 follower(s)

Stats

Asked: 7/1/13, 5:15 AM
Seen: 6354 times
Last updated: 10/21/15, 6:28 AM