问题描述
我们正在使用 sync_mail_multi_attach_ext(多重附件上传器模块),当我上传文档并删除并再次上传其他文档时,此模块小部件已在odoo 8的many2many字段中使用添加。如何从将已删除的文档添加到当前文档中来解决该问题。
'session.web.form.FieldMany2ManyBinaryMultiFiles.include({
on_file_change: function (event) {
event.stopPropagation();
var self = this;
var $target = $(event.target);
if ($target.val() !== '') {
var filename = $target.val().replace(/.*[\\\/]/,'');
// don't uplode more of one file in same time
if (self.data[0] && self.data[0].upload ) {
return false;
}
for (var id in this.get('value')) {
// if the files exits,delete the file before upload (if it's a new file)
if (self.data[id] && (self.data[id].filename || self.data[id].name) == filename && !self.data[id].no_unlink ) {
self.ds_file.unlink([id]);
}
}
// block UI or not
if(this.node.attrs.blockui>0) {
instance.web.blockUI();
}
// TODO : unactivate send on wizard and form
_.each($target[0].files,function(file){
var querydata = new FormData();
querydata.append('callback','oe_fileupload_temp2');
querydata.append('ufile',file);
querydata.append('model','hr.documents');
querydata.append('id','0');
querydata.append('multi','true');
$.ajax({
url: '/web/binary/upload_attachment',type: 'POST',data: querydata,cache: false,processData: false,contentType: false,success: function(id){
self.data[id] = {
'id': parseInt(id),'name': file.name,'filename': filename.name,'url': '','upload': false
};
},});
});
// submit file
this.$('form.oe_form_binary_form').submit();
}
},'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)