This question has been flagged
3 Replies
6600 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.

Avatar
Discard
Best Answer
  • 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/>
Avatar
Discard
Author

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

Author

Any other suggestions are very much appreciated!

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

Author

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!

Best Answer

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)

Avatar
Discard
Author

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">.

Author

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

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>

Author

Thanks Anil; I appreciate your thoughts!

Best Answer

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>

Avatar
Discard
Author

Thanks akram; I appreciate your thoughts!