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.

0

New project notebook page?

By
Dale E. Moore
on 11/22/13, 4:40 PM 1,546 views

I've been wanting a new project notebook page and am very pleased with myself that the following code does NOT encounter the "Invalid XML for View Architecture" error. But, it doesn't appear either.

    <record id="view_project_project_tree" model="ir.ui.view">
        <field name="name">project.project.my.tree</field>
        <field name="model">project.project</field>
        <field name="inherit_id" ref="project.edit_project"/>
        <field name="arch" type="xml">
            <page string="Team" position="after"/>
            <page string="My Dates" groups="base.group_extended">
                <field colspan="6" name="my_ids" nolabel="1">
                    <tree string="My Dates Go Here">
                        <field name="effective" string="Effective"/>
                        <field name="note" string="Note" select="1"/>
                        <field string="OT End" name="ot_cp_end" select="1"/>
                        <field string="PT End" name="pt_cp_end" select="1"/>
                        <field string="ST End" name="st_cp_end" select="1"/>
                    </tree>
                </field>
            </page>
        </field>
    </record>

How would you add a new notebook page for a Project? I've tried the following changes with the same (no new page) result:

<record id="view_project_project_tree" model="ir.ui.view">
    <field name="name">project.project.my.tree</field>
    <field name="model">project.project</field>
    <field name="inherit_id" ref="project.edit_project"/>
    <field name="arch" type="xml">
        <page string="Team" position="after">
            <page string="My Dates">
                <field colspan="6" name="my_ids" nolabel="1">
                    <tree string="My Dates Go Here">
                        <field name="effective" string="Effective"/>
                        <field name="note" string="Note" select="1"/>
                        <field string="OT End" name="ot_cp_end" select="1"/>
                        <field string="PT End" name="pt_cp_end" select="1"/>
                        <field string="ST End" name="st_cp_end" select="1"/>
                    </tree>
                </field>
            </page>
        </page>
    </field>
</record>

Another great idea yielded the same result:

<record id="view_project_project_tree" model="ir.ui.view">
    <field name="name">project.project.my.tree</field>
    <field name="model">project.project</field>
    <field name="inherit_id" ref="project.edit_project"/>
    <field name="arch" type="xml">
        <xpath expr="//notebook/page[@string='Team']" position="after" >
            <page string="My Dates">
                <field colspan="6" name="my_ids" nolabel="1">
                    <tree string="My Dates Go Here">
                        <field name="effective" string="Effective"/>
                        <field name="note" string="Note" select="1"/>
                        <field string="OT End" name="ot_cp_end" select="1"/>
                        <field string="PT End" name="pt_cp_end" select="1"/>
                        <field string="ST End" name="st_cp_end" select="1"/>
                    </tree>
                </field>
            </page>
        </xpath>
    </field>
</record>

And moving the position in the xpath to "before" yielded the same results.

1

Daniel Reis

--Daniel Reis--
3436
| 6 7 9
Lisbon, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt


Daniel Reis
On 11/22/13, 8:01 PM
  • Try removing groups="base.group_extended"(that group is deprecated in v7, AFAIK)
  • The second page tag should be inside the first, so:
    • remove the trailing / from the first page, and
    • add a second closing <page/>

No error (Yea!) No new page (Bummer!)

Moore Works, Dale E. Moore
on 11/22/13, 8:17 PM

Any other suggestions are very much appreciated!

Moore Works, Dale E. Moore
on 11/23/13, 10:14 AM

Are you sure you are reinstalling the module, and refreshing the page?

Daniel Reis
on 11/24/13, 11:25 AM

Thank you for this reminder Daniel! I found that on that server I was working in the wrong "addons paths" folder. Your suggestions did work!

Moore Works, Dale E. Moore
on 11/24/13, 1:44 PM
3

Anil R. Kesariya

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

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 11/24/13, 2:31 AM

Hello Dale E. Moore ,

Try using xpath:

<xpath expr="//notebook/page[@string='Team']" position="after" >
      <page string="My Dates">
            <field colspan="6" name="my_ids" nolabel="1">
                <tree string="My Dates Go Here">
                    <field name="effective" string="Effective"/>
                    <field name="note" string="Note" select="1"/>
                    <field string="OT End" name="ot_cp_end" select="1"/>
                    <field string="PT End" name="pt_cp_end" select="1"/>
                    <field string="ST End" name="st_cp_end" select="1"/>
                </tree>
            </field>
        </page>
</xpath>

Hope this will help.

If this short xpath gives an error: than give full xpath .

Regards, Anil R.K.(SerpentCS)

In Developer Mode, Manage Views, Edit I can see that something's changed. Where I expect to see "<page string="Medical Dates"> I have <view id=707> then <page string="Other Info"> (which is a repeat of the same tag from earlier) THEN <page string="Medical Dates">.

Moore Works, Dale E. Moore
on 11/24/13, 7:49 AM

Is there a way in Developer Mode that I can find the full xpath?

Moore Works, Dale E. Moore
on 11/24/13, 7:50 AM

for Eg : if your notebook is under <form> <div><group><notebook><page string="test1"> </page><page string="test2"> </page><page string="test13"> </page></notebook></group></div></form> Now your want to add your page after test2 page than you will follow <xpath expr="//form/div/group/notebook/page[@string='test2']" position="after"> <page string="your page"></page> </xpath>

Anil R. Kesariya
on 11/24/13, 10:38 AM

Thanks Anil; I appreciate your thoughts!

Moore Works, Dale E. Moore
on 11/24/13, 1:45 PM
1
akram
On 11/24/13, 11:15 AM

Try with adding only page without any field first:

<record id="view_project_project_tree" model="ir.ui.view"> <field name="name">project.project.my.tree</field> <field name="model">project.project</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> <page string="Team" position="after"> <page string="My Dates">

        </page>
    </page>
</field>

</record>

Thanks akram; I appreciate your thoughts!

Moore Works, Dale E. Moore
on 11/24/13, 1:45 PM

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

1 follower(s)

Stats

Asked: 11/22/13, 4:40 PM
Seen: 1546 times
Last updated: 3/16/15, 8:10 AM