How to display your own kanban card in calendar view in Odoo 10?

天涯浪子 提交于 2020-01-14 04:52:47

问题


I have just asked this: How to display your own kanban card in calendar view in Odoo 11?

I thought I was working with version 11 but it was 10, that is the reason why templates tag did not work. And of course I had to do it for version 10. The problem is that both versions are quite different at this point, and templates tag does not exist.

MY PURPOSE

I want to show a customised card in a calendar view (view_calendar_event_calendar, from the calendar.event model). What templates tag does would be perfect, but it seems that I cannot use it in version 10.

SOME INFORMATION

I was looking for the possibilities of the calendar tag in base/rng/view.rng:

<rng:define name="calendar">
    <rng:element name="calendar">
        <rng:optional><rng:attribute name="string" /></rng:optional>
        <rng:optional><rng:attribute name="color" /></rng:optional>
        <rng:optional><rng:attribute name="date_start" /></rng:optional>
        <rng:optional><rng:attribute name="date_stop" /></rng:optional>
        <rng:optional><rng:attribute name="day_length" /></rng:optional>
        <rng:optional><rng:attribute name="date_delay" /></rng:optional>
        <rng:optional><rng:attribute name="all_day" /></rng:optional>
        <rng:optional><rng:attribute name="event_open_popup" /></rng:optional>            
        <rng:optional><rng:attribute name="attendee" /></rng:optional>
        <rng:optional><rng:attribute name="color_is_attendee" /></rng:optional>
        <rng:optional><rng:attribute name="avatar_filter" /></rng:optional>
        <rng:optional><rng:attribute name="avatar_model" /></rng:optional>
        <rng:optional><rng:attribute name="avatar_title" /></rng:optional>
        <rng:optional><rng:attribute name="use_contacts" /></rng:optional>
        <rng:optional><rng:attribute name="quick_add" /></rng:optional>
        <rng:optional><rng:attribute name="display" /></rng:optional>            
        <rng:optional><rng:attribute name="type" /></rng:optional>
        <rng:optional>
            <rng:attribute name="mode">
                <rng:choice>
                    <rng:value>month</rng:value>
                    <rng:value>week</rng:value>
                    <rng:value>day</rng:value>
                </rng:choice>
            </rng:attribute>
        </rng:optional>
        <rng:oneOrMore>
            <rng:ref name="field"/>
        </rng:oneOrMore>
        <rng:zeroOrMore>
            <rng:ref name="html"/>
        </rng:zeroOrMore>
    </rng:element>
</rng:define>

It seems that I can declare an html element inside the calendar tag.

MY ATTEMPT

But I cannot do it, I get the JS error Uncaught TypeError: Cannot read property 'type' of undefined. This is what I have tried so far (among a lot of things):

<record id="view_calendar_event_calendar" model="ir.ui.view">
    <field name="name">calendar.event.calendar</field>
    <field name="model">calendar.event</field>
    <field name="inherit_id" ref="calendar.view_calendar_event_calendar"/>
    <field name="arch" type="xml">
        <xpath expr="//calendar[1]" position="replace">
            <calendar string="Meetings" date_start="start" date_stop="stop" date_delay="duration"
                all_day="allday" display="[color_confirmed]" color="color_confirmed"
                event_open_popup="%(calendar.view_calendar_event_form_popup)s" mode="month">
                <field name="name"/>
                <html>
                    <div>HELLO</div>
                </html>
            </calendar>
        </xpath>
    </field>
</record>

Does anyone know how to achieve my purpose?

来源:https://stackoverflow.com/questions/59426000/how-to-display-your-own-kanban-card-in-calendar-view-in-odoo-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!