Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在odoo8的many2many字段中附加新文档时添加已删除的文档_Javascript_Python 2.7_Odoo 8 - Fatal编程技术网

Javascript 在odoo8的many2many字段中附加新文档时添加已删除的文档

Javascript 在odoo8的many2many字段中附加新文档时添加已删除的文档,javascript,python-2.7,odoo-8,Javascript,Python 2.7,Odoo 8,我们正在使用sync\u mail\u multi\u attach\u ext(多附件上传器模块)当我上传文档并删除这些文档,然后再次上传其他文档时,在odoo 8的许多字段中使用此模块小部件。删除的文档也会被添加。如何将删除的文档添加到cuurent文档中 'session.web.form.FieldMany2ManyBinaryMultiFiles.include({ on_file_change: function (event) { event

我们正在使用sync\u mail\u multi\u attach\u ext(多附件上传器模块)当我上传文档并删除这些文档,然后再次上传其他文档时,在odoo 8的许多字段中使用此模块小部件。删除的文档也会被添加。如何将删除的文档添加到cuurent文档中

'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();
            }
        },
'