跳至内容
菜单
此问题已终结
1 回复
8228 查看

Hello, I'm getting difficulties to add an element to existing view by inheriting it and adding the new element as specified in the documentation. In fact the original view is not changed, and the inherited view has no effect..

Here is what I get whether before or after adding the inherit view (which should add a page for Radiology ) : http://img11.hostingpics.net/pics/596530Screenshotfrom20140721132617.png

Here is the code of the original view : ( I pasted only the part specific to the <form> )

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
         <record id="view_oemedical_patient_form" model="ir.ui.view">
             <field name="name">oemedical.patient.form</field>
             <field name="model">oemedical.patient</field>
             <field name="priority" eval="8" />
             <field name="arch" type="xml">
              <form string="Patient" version="7.0">
                    <sheet>
                        <div>
                            <field name="photo" widget='image' class="oe_left oe_avatar"/>
                            <div>
                                 <h1>
                                    <field name="first_name" placeholder="First Name" style="width: 20%%" on_change="onchange_name(first_name, lastname, slastname, context)"  />
                                    <!-- some other fields -->
                                </h1>
                            </div>
                 <!-- some other code -->
                        </div>
                    <notebook>
                        <page string="General Information">
                            <group  col="6" colspan="4">
                                 <field name="blood_type" style="width: 8%%"/>
                                 <field name="rh" nolabel="1"/>
                                   <field name="ethnic_group" />
                            </group>
                            <group string="Contact Information">
                                <group>
                                    <label for="street" string="Address"/>
                                    <div>
                                        <field name="use_parent_address" class="oe_edit_only oe_inline" invisible="1"/>
                                        <label for="use_parent_address" class="oe_edit_only" invisible="1"/>
                                        <field name="street" placeholder="Street..." />
                     <!-- many other fields -->
                                </group>
                            </group>
                         </page>

<!-- other pages composing the notebook -->

                        <page string="Misc">
                            <group colspan="4" col="4">
                                <separator colspan="4" string="Patient Extra Information"/>
                                  <field name="general_info" nolabel="1"  colspan="4"/>
                            </group>
                            <newline/>
                            <group colspan="4" col="6">
                                <field name="deceased"/>
                                <field name="dod" attrs="{'invisible':[('deceased','=',False)],'required':[('deceased','=',True)]}"/>
                                <field name="cod" attrs="{'invisible':[('deceased','=',False)]}"/>
                            </group>
                        </page>

<!-- some other code -->

                    </notebook>
                 </sheet>
                 </form>
             </field>
         </record>

    </data>
</openerp>

And here is the code of the inherited view :

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="view_oemedical_patient_form_radio_logy">
            <field name="name">oemedical.patient.view.inherit.radio_logy</field>
            <field name="model">oemedical.patient</field>
            <field name="inherit_id" ref="oemedical.view_oemedical_patient_form" />
            <field name="type">form</field>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//notebook/page[@string='Misc']" position="before">
                        <page string="Radiology" id="page_radiology">
                            <notebook>
                                <page string="Main" id="page_ses_main">
                                    <group colspan="4" col="4" id="group_ses_holder2">
                                        <field name="ses"/>
                                        <field name="housing"/>
                                        <field name="education"/>
<!--                                        <field name="occupation"/>-->
                                    </group>
                                    <newline/>

<!-- other groups -->

                                </page>
                            </notebook>
                        </page>
                    </xpath>
                </data>
            </field>
        </record>

    </data>
</openerp>

Everything remains the same, no errors, nothing, the original view is not affected.. I tried to create a new database for my openerp and to re-install the module on it but nothing changed..

Any help please ?!

形象
丢弃
最佳答案

Before iherit view you have to the exact view_id by reading code or using web client (Setting -> Technical -> User Interface -> Views). You have and simple option whose consiste to activate the developper mode(Right Top of screen -> User Name -> About Odoo -> Activate developper mode). By doing this the Deboguer field will appear on every view.

After this, go the view you want to ihnerit   and choose option manage views in Deboguer field . You will get the way to inherit easly your view.

形象
丢弃
相关帖文 回复 查看 活动
0
3月 15
3734
1
3月 15
5570
1
11月 23
1182
11
1月 24
13195
7
8月 18
5744