Reputation: 21188
Is it possible to use Qweb
template in calendar view? I want to modify it a bit, but all I can do is just add new fields to be showed in calendar item, like this - field1, field2, field3.....
Is there any better way to customize calendar view, like you can with kanban view by using Qweb templating engine?
For example if I use like this:
<record model="ir.ui.view" id="view_calendar_service_work_calendar">
<field name="name">Service Works Calendar</field>
<field name="model">calendar.service.work</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<calendar string="Service Works" date_start="start_time" color="employee_id" date_stop="end_time" mode="week">
<field name="name"/>
<field name="employee_id"/>
<template>
<t t-name="something"></t>
</template>
</calendar>
</field>
</record>
This will throw error:
Uncaught TypeError: Cannot read property 'type' of undefined
http://localhost:8090/web_calendar/static/src/js/web_calendar.js:414
As a matter of fact, if I use anything else other than field tag, it will throw that error. I can't even use div tag. So it seems you can't style calendar at all?
Upvotes: 5
Views: 5413
Reputation: 2324
You can Define in Calendar Controller Following Attributes. This is the Rules are Define in odoo Framework this all are Attribute is use in calendar tag. so you can not use template tag in calendar.
Example :
<field name="arch" type="xml">
<calendar string="Meetings" date_start="start" date_stop="stop" date_delay="duration" all_day="allday"
display="[name]" color="color_partner_id" attendee="partner_ids" avatar_model="res.partner"
use_contacts="True" event_open_popup="%(calendar.view_calendar_event_form_popup)s">
<field name="name"/>
<field name="user_id"/>
<field name="color_partner_id"/>
<field name="partner_ids"/>
</calendar>
</field>
If you change the view of the calendar then you can modified in web_calendar module.
i hope you understand.
Upvotes: 2
Reputation: 764
The calendar view is not very customizable since its own design is quite involved already. It may still work using a different widget.
You could use:
<field name="someField" widget="yourWidget"/>
If that works you can code your own widget using a template of your choosing.
Setting up your own widget doesn't require much code but is a bit involved in terms of required understanding of the Odoo Web Client.
See here for the specific part of the documentation, complete with a minimal example: https://www.odoo.com/documentation/8.0/howtos/web.html#creating-a-new-type-of-field
Upvotes: 0