Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
9546 Weergaven

Hello,

I'm trying to make a feature in Odoo that allows a user to upload multiple files from an attachment form, and when he submits it, it creates as many attachments as selected documents.

I created a widget for the 'binary' field that allows the multi selection (Adding 'multiple' argument to 'input' tag in a Qweb template), but at this point i'm struggling with attachments creation and linking them with the concerned field from JS.

my widget :

odoo.define('lettermgmt', function(require)
{
    'use strict';
    var core = require('web.core');
    var FieldBinaryFile = core.form_widget_registry.get('binary');
    var FieldBinaryMultipleFiles = FieldBinaryFile.extend({
        template : 'FieldBinaryMultipleFiles',
    });
    core.form_widget_registry.add('binary_multiple_files',FieldBinaryMultipleFiles);

});

My first guess was to override on_file_change method, loop over "e.target.files" and make a POST request for each file on '/web/binary/upload_attachment'. this creates the attachments but i couldn't figure out how to link them to my model (relational field).

I'll appreciate any help :)

Avatar
Annuleer
Beste antwoord

Have you seen:

https://www.odoo.com/apps/modules/8.0/sync_mail_multi_attach_ext/

https://apps.openerp.com/apps/modules/10.0/max_base_multi_attachment/

Avatar
Annuleer
Auteur

Hi Ray,

For the first module (v8) it's not compatible with V9, i couldn't adapt it.

For the second one it's not what i'm looking for.

Thank you for your response :)

Gerelateerde posts Antwoorden Weergaven Activiteit
0
okt. 20
7452
0
mrt. 21
3916
0
aug. 20
3406
0
apr. 20
3058
0
dec. 19
10142