Odoo Help

Welcome!

This community 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.

0

Qweb could not be loaded.

By
THEFree
on 9/6/16, 2:35 AM 151 views

First refresh IS ok

but 

1: click on the other window view

2: once again return to the Qweb, can not load part of the JS


(function() {

openerp.andy_message = function(instance) {

instance.HomePage = openerp.Widget.extend({

template: "andy_message",

init: function (parent) {

this._super(parent);

messageJs(self,instance);

ADD_MainWidget();

},

start: function () {

MainEvent();

},

});

instance.web.client_actions.add('andy_message.homepage', 'instance.HomePage');

function MainEvent(){

var model = new instance.web.Model("mail.message");

model.call("qweb_AllUser",{context:new instance.web.CompoundContext()}).then(function(result){

for(var i in result){

var tr = "<tr>"+

"<td><input type=\"checkbox\" class=\"andy_checked\"/><span class='resID'>"+result[i].id+"</span></td>"+

"<td>"+result[i].name+"</td>"+

"</tr>"

self.$(".andy_inputName_table tr:last").after(tr);

}

});

self.$(".andy_messageFirst_all").on('click', function () {

self.$(".andy_background").show();

});

self.$(".andy_inputButton_right").on('click', function () {

self.$(".andy_background").hide();

});

self.$('.andy_inputButton_left').on('click', function () {

resID = [];

for(var i = 0;i<self.$(".andy_checked").length;i++){

var checkbox = self.$(".andy_checked").eq(i);

if(checkbox.is(":checked")){

resID.push(self.$(".resID").eq(i).text());

}

}

self.$(".andy_background").hide();

if(resID.length > 0){

self.$(".andy_messageFirst_all").text('已经选中');

}else{

self.$(".andy_messageFirst_all").text('选择用户');

}

});

self.$(".andy_messageFirst_button").on('click', function () {

var andy_messageInput = self.$(".andy_messageInput").val();

var andy_messageTextarea = self.$(".andy_messageTextarea").val();

if(andy_messageInput == '' || andy_messageTextarea == ''){

alert('请输入消息内容');

}else{

if(resID.length > 0){

var model = new instance.web.Model("mail.message");

model.call("qweb_Newreply",{"RECORD":andy_messageInput,"BODY":andy_messageTextarea,"RESID":resID},{context:new instance.web.CompoundContext()}).then(function(result){

if(result == 1){

self.$(".andy_messageInput").val('');

self.$(".andy_messageTextarea").val('');

self.$(".andy_checked").attr("checked",false);

self.$(".andy_message_reply").text(' ');

ADD_MainWidget();

}else{

alert('发送失败');

}

});

}else{

alert('还未选择收件人');

}

}

});

self.$(".andy_Reply_input_ButtonClose").on('click', function () {

self.$(".andy_Reply_input").hide();

});

self.$(".andy_Reply_input_Button").on('click', function () {

var ReplyInput = self.$(".andy_Reply_input_Textarea").val();

var model = new instance.web.Model("mail.message");

model.call("qweb_reply_message_to",{"number_id":ReplyMessageID,"body":ReplyInput},{context:new instance.web.CompoundContext()}).then(function(result) {

self.$(".andy_Reply_input_Textarea").val('');

self.$(".andy_Reply_input").hide();

var newReply = new andy_scorll_reply_Two(result[0].author_avatar,result[0].email_from,result[0].create_date,result[0].body);

newReply.appendTo(ReplyMessageDID);

});

});

}

}

})();



<template id="andy_new_qweb_backend" name="andy_message assets" inherit_id="web.assets_backend">

<xpath expr="." position="inside">

<link rel="stylesheet" href="/andy_message/static/src/css/MessageFirst.css"/>

<script type="text/javascript" src="/andy_message/static/src/js/andy_message_action.js"></script>

<script type="text/javascript" src="/andy_message/static/src/js/andy_message_Widget.js"></script>

<script type="text/javascript" src="/andy_message/static/src/js/andy_message.js"></script>

</xpath>

</template>


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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/6/16, 2:35 AM
Seen: 151 times
Last updated: 9/6/16, 3:17 AM