تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
12159 أدوات العرض

Hi everyone,

I'm using Odoo 10 and try to customize a view in my module.

My code:

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

        <field name="name">calendar.event.form</field>
        <field name="model">calendar.event</field>
        <field name="inherit_id" ref="calendar.view_calendar_event_form_popup"/>
        <field name="priority" eval="2"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='alarm_ids']" position="after">
                <field name="delete_series" attrs="{'invisible': [('recurrency', '=', False)]}"/>
            </xpath>
        </field>
    </record>

But when opening the form, I got this error:

Uncaught Error: Unknown field recurrency in domain [["recurrency","==",false]]

And I'm sure that the field 'recurrency' is existing in the object 'calendar.event'

Did I make something wrong?

Thank you.

الصورة الرمزية
إهمال

Please do not mix questions.

أفضل إجابة

Hello Vu Huynh,


recurrency field must be in calendar.event model.

You have to add this field also in the view.


Try this :-

<record id="view_calendar_event_form_popup" model="ir.ui.view">
    <field name="name">calendar.event.form</field>
    <field name="model">calendar.event</field>
    <field name="inherit_id" ref="calendar.view_calendar_event_form_popup"/>
    <field name="priority" eval="2"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='alarm_ids']" position="after">
            <field name="recurrency" invisible="1"/>
            <field name="delete_series" attrs="{'invisible': [('recurrency', '=', False)]}"/>
        </xpath>
    </field>
</record>


Hope it will works for you.

Thanks,

الصورة الرمزية
إهمال
الكاتب

Thank you Jignesh,

One more thing, I define the field 'delete_series' in my custom module. And I don't want to store it in db, just want to display it as a checkbox to user.

delete_series = fields.Boolean("Delete in series", store=False)

But, it's always shown in the view as read-only field.

How can I enable for user check on it?

Thank you