Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
9655 Vizualizări

I try to replace one field in below form but get an error 


<record id="view_order_form" model="ir.ui.view">

            <field name="name">sale.order.form</field>

            <field name="model">sale.order</field>

            <field name="arch" type="xml">

                <form string="Sales Order" class="o_sale_order">

   ...

                   <sheet>

                     ...

                     <notebook>

                        ...

                        <page string="Other Information">

                            <group>

                               <group string="Sales Information" name="sales_person">

                                   ...

                                   <field name="related_project_id"

                                           attrs="{'readonly': ['|',('project_id','!=',False),('invoice_count','!=',0),             

                                           ('state','=','sale')],'invisible':[('state','!=','sale')]}"

                                           context="{'default_partner_id':partner_invoice_id, 'default_name':name}"

                                           groups="analytic.group_analytic_accounting"/>

                                </group>

                            </group>

                        </page>

                     </notebook>

                   </sheet>

               </form>

my xml:

(line 4)<record id="view_order_form_inherit" model="ir.ui.view">

            <field name="name">sale.order.form.inherit</field>

            <field name="model">sale.order</field>

            <field name="inherit_id" rel="sale.view_order_form"/>

            <field name="arch" type="xml">

                                <group string="Sales Information" name="sales_person">

                                    <xpath expr="//field[@name='related_project_id']" position="replace">

                                        <field name="related_project_id"

                                           attrs="{'readonly': ['|',('project_id','!=',False),('invoice_count','!=',0),

                                    ('state','=','sale'),('invoice_status','!=','to invoice')],'invisible':[('state','!=','sale')]}"

                                           context="{'default_partner_id':partner_invoice_id, 'default_name':name}"

                                           groups="analytic.group_analytic_accounting"/>

                                    </xpath>

                                </group>

            </field>

        </record>

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,
The inherited code is correct except one thing that you have made a simple mistake here that's why the error is shown. That is you wrote the inheritance reference as 'rel' instead of 'ref'. This is the error in the mentioned code. So please follow the code given below;

<record id="view_order_form_inherit" model="ir.ui.view">


    <field name="name">sale.order.form.inherit</field>


    <field name="model">sale.order</field>


    <field name="inherit_id" ref="sale.view_order_form"/>


    <field name="arch" type="xml">


        <group string="Sales Information" name="sales_person">


            <xpath expr="//field[@name='related_project_id']" position="replace">


                <field name="related_project_id"


                       attrs="{'readonly': ['|',('project_id','!=',False),('invoice_count','!=',0),


                                ('state','=','sale'),('invoice_status','!=','to invoice')],'invisible':[('state','!=','sale')]}"


                       context="{'default_partner_id':partner_invoice_id, 'default_name':name}"


                       groups="analytic.group_analytic_accounting"/>


            </xpath>


        </group>


    </field>


</record>


Regards

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Remove the following line from the inherited code and see,

<group string="Sales Information" name="sales_person">. also remove corresponding closing , </group>


Thanks

Imagine profil
Abandonează
Autor

Hi Niyas, the same error indicated line 4: <record id="view_order_form_inherit" model="ir.ui.view">

Related Posts Răspunsuri Vizualizări Activitate
2
dec. 19
2850
0
nov. 18
3194
1
apr. 15
13143
1
sept. 17
6850
1
aug. 24
2078