Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
15739 Представления

i'm trying to replace a field in a treeview ... help me please

this is my script in _view.xml

*<record model="ir.ui.view" id="view_purchase_requisition_form">
        <field name="name">purchase.requisition.form.inherit</field>
        <field name="model">purchase.requisition</field>
        <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
        <field name="arch" type="xml">
    <field name="origin" position="replace"/>
    <xpath expr="/form/group/field[@name='date_end']" position="after">
               <field name="origine" />
    </xpath>
        </field>
   </record>

   <record model="ir.ui.view" id="view_purchase_requisition_tree">
    <field name="name">purchase.requisition.tree.inherit</field>
       <field name="model">purchase.requisition.tree</field>
       <field name="type">tree</field>
    <field name="inherit_id2" ref="purchase_requisition.view_purchase_requisition_tree"/>
       <field name="arch" type="xml">
            <field name="origin" position="replace"/>
    <xpath expr="/tree/field[@name='date_end']" position="after">
               <field name="origine" />
    </xpath>
       </field>
   </record>*

in the form it functions but in tree view no.... i can't understand where is the error....

Аватар
Отменить

I think you missed something, you have wrong model and no inherid_id on the second view definition

Лучший ответ
<record model="ir.ui.view" id="project_task_tree_view">
<field name="name">project.task.treefield>
<field name="model">project.taskfield>
<field name="type">treefield>
<field name="inherit_id" ref="project.view_task_tree2"/>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='tag_ids']" position="after">
<field name="total" />
xpath>
field>
record>

ODOO 15

Ahson Mahmood

Functional Consultant | ODOO Developer

ahsonmahmood113.am@gmail.com


Аватар
Отменить
Лучший ответ

correct definition should be:

<record model="ir.ui.view" id="view_purchase_requisition_tree_inherit">
       <field name="name">purchase.requisition.tree.inherit</field>
       <field name="model">purchase.requisition</field>
       <field name="type">tree</field>
       <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_tree"/>
       <field name="arch" type="xml">
               <xpath expr="/tree/field[@name='date_end']" position="after">
                   <field name="origine" />
               </xpath>
       </field>
   </record>
Аватар
Отменить
Автор

thanks :-)