Search code examples
odooodoo-8odoo-9

Disable the create option from calendar view ODOO


I can able to disable the quick_add in calendar view while clicking, but it leads to open of "form view" and user can able to create a task.

My Snippet is as follows as

<!--  Calendar View Begins-->
  <record id="pms_view_task_calendar" model="ir.ui.view">
        <field name="name">project.task.calendar</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="project.view_task_calendar"/>
        <field name="arch" type="xml">
            <calendar position="attributes">
                <attribute name="quick_add">false</attribute>
            </calendar>
        </field>
  </record>
  <!--  Calendar View Ends-->

How to disable the create option in calendar view while clicking the calendar


Solution

  • Finally, I removed the create option from the calendar view in click action by inheriting the JS.

    odoo.define('module_name.calender_view', function (require) {
    "use strict";
    
    var calenderView = require('web_calendar.CalendarView');
        calenderView.include({
        open_quick_create: function(){
        if (this.model != 'model.name') {
            this._super();
        }
    }
    });
    });