Odoo Help


How to use XML and Javascript to drag and drop in calender view in odoo9.0?

on 6/17/16, 8:07 AM 313 views

Hi all,

I want to drag image from calender side bar to calendar view but its getting error as

Odoo Client Error

ReferenceError: drag is not defined

I wrote the following  code in web_fullcalendar.xml to drag the image.

<t t-name="CalendarView.sidebar.responsible">

<div t-foreach="filters" class="o_calendar_responsible" >

<t t-if="filters_value.value"><!-- don't display if no value given (or undefined) -->

<div class="o_checkbox">

<input type="checkbox" name="selection" t-att-value="filters_value.value" checked="checked" /><span/>


<t t-if="filters_value.value == -1">

<span><i class="fa fa-users fa-fw o_cal_avatar"></i></span>


<t t-if="(filters_value.value != -1) &amp;&amp; filters_value.avatar_model ">

<img t-attf-src="/web/image/#{filters_value.avatar_model}/#{filters_value.value}/image_small" class="o_cal_avatar"/>


<span t-attf-class="color_filter o_underline_color_#{filters_value.color}" ><t t-esc="filters_value.label" /></span>

<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>

<img t-if="layout == current_layout"

src="/web/static/src/img/back-enable.jpg" ondragstart="drag(event)" width="50" height="50" class="oe_dashboard_selected_layout"/>




and i called ondrop="drop(event)" ondragover="allowDrop(event) and ondragstart="drag(event)" in javascript.


function allowDrop(ev) {



function drag(ev) {

ev.dataTransfer.setData("text", ev.target.id);


function drop(ev) {


var data = ev.dataTransfer.getData("text");



So how to call drag and drop in javascript? Can some one correct me in writing javascipt for drag and drop?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/17/16, 8:07 AM
Seen: 313 times
Last updated: 6/17/16, 11:13 AM