Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
11109 Lượt xem

In the custom module odoo version 7 Form view added many2many attachment_ids :-

Example

'attachment_ids': fields.many2many('ir.attachment', 'sample_ir_attachments_rel', 'sample_id', 'attachment_id','Attachments'),

<field name="attachment_ids" widget="many2many_binary"/>

When deleting document in a many2many field with widget="many2many_binary"  its still shows in the form view and attachemnt not deleted in database. How to fix this issue in version 7?. If already fixed please give me the File changes difference.

Ảnh đại diện
Huỷ bỏ
Tác giả

In Openerp version 7 is any other custom widget code available for Attach Files? (more than one file). Default many2many_binary issues to delete attachment and view delete icon.

Câu trả lời hay nhất

HI, I get the same problem.

I  find one solution to solve it. 

---------------------------------------------------

Open file view_form.js (../addons/web/static/src/js/view_form.js)  , Then find this code

   on_file_delete: function (event) {
        event.stopPropagation();
        var file_id=$(event.target).data("id");
        if (file_id) {
            var files=[];
            for(var i in this.get('value')){
                if(file_id != this.get('value')[i].id){
                    files.push(this.get('value')[i]);
                }
                else if(!this.get('value')[i].no_unlink) {    #  remove '!'  then delete method will be ok
                    this.ds_file.unlink([file_id]);
                }
            }
            this.set({'value': files});
        }

near line 5348

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you for your help

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 23
157
1
thg 2 24
1893
2
thg 11 23
6859
5
thg 5 23
15140
0
thg 7 24
2904