Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Odoo file upload after drag and drop

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
uploadodoo10drag&dropodoov10odoo-10
4 Trả lời
10945 Lượt xem
Ảnh đại diện
Willmore BattleShipNet

I would like to allow a user to drag and drop a file onto span defined in data/dragdrop.xml . I managed to catch drop event but cannot make file upload. What do I have to do?


    <?xml version="1.0" encoding="UTF-8"?>
    <templates>
       <t t-name="mail.chatter.ChatComposer" t-extend="mail.chatter.ChatComposer">
           <t t-jquery=".o_composer_attachments_list" t-operation="before">
                <span class="o_chatter_composer_info" id="chatter_drop_target">
                    ~~~drag here~~~
                </span>
            </t>
        </t>
    </templates>


This is the code for module but it doesn't work. Where is my mistake in code? After drag and drop a file icon appears also in console I can see that file upload request status is 200. But the file icon is still showing "uploading" like the file didn't finish upload.


    odoo.define('dragdrop1.dragdrop', function(require) {
        "use strict";
        
    
        var core = require('web.core');
    
        var Composer = require('mail.composer');
    
        var MailThread = core.form_widget_registry.get('mail_thread');
    
        var ExtendedBasicComposer = Composer.BasicComposer.include({
            ondrop: function(event) {
                var form_upload = document.querySelector('form.o_form_binary_form');
    
                if (null === form_upload) {
                    return;
                }
    
                var form_data = new FormData(form_upload);
                var e = event.originalEvent;
                for (var iterator = 0, file; file = e.dataTransfer.files[iterator]; iterator++) {
                    if (file.name !== '') {
                        var filename = file.name.replace(/.*[\\\/]/,'');
                        // if the files exits for this answer, delete the file before upload
                        var attachments = [];
                        for (var i in this.get('attachment_ids')) {
                            if ((this.get('attachment_ids')[i].filename || this.get('attachment_ids')[i].name) === filename) {
                                if (this.get('attachment_ids')[i].upload) {
                                    //return false;
                                }
                                this.AttachmentDataSet.unlink([this.get('attachment_ids')[i].id]);
                            } else {
                                attachments.push(this.get('attachment_ids')[i]);
                            }
                        }
                        var form_data = new FormData(this.$('form.o_form_binary_form'));
                        form_data.set('ufile', file);
                        // submit filename
                        this.$('form.o_form_binary_form').submit();
                        this.$attachment_button.prop('disabled', true);
            
                        attachments.push({
                            'id': 0,
                            'name': filename,
                            'filename': filename,
                            'url': '',
                            'upload': true,
                            'mimetype': '',
                        });
                        this.set('attachment_ids', attachments);
                    }
                }
            },    
        });
    
        var NewChatterX = MailThread.include({
            on_open_composer_log_note: function(){
                this._super.apply(this, arguments);
                var self = this;
                var c = self.composer;
                var main = document.querySelector('body'); 
                $(document).on('drop', '#chatter_drop_target', function(event){
                    event.stopPropagation();
                    event.preventDefault();
                    c.ondrop(event);
                });
                $(document).on('dragenter', '#chatter_drop_target', function(event){
                    event.preventDefault();
                });
                $(document).on('dragover', '#chatter_drop_target', function(event){
                    event.stopPropagation();
                    event.preventDefault();
                });
                $(document).on('dragleave', '#chatter_drop_target', function(event){
                    event.preventDefault();
                });
            },
        });
        
    });

Any help appreciated, Thank you.

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Sudhir Arya (ERP Harbor Consulting Services)
Câu trả lời hay nhất

Hi,

Why are you writing it when we have the module available for this feature?

Followings are the links of the modules:

OCA

ERP Harbor

Sudhir Arya
ERP Harbor Consulting Services
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
5
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Victor
Câu trả lời hay nhất

Hi, this module is great

https://apps.odoo.com/apps/modules/18.0/drag_and_drop_binary_field

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Willmore BattleShipNet
Tác giả Câu trả lời hay nhất

Thank you. I didn't know before about those modules. I am trying to attach files to "internal notes" not the record currently open neither work with internal notes attachments unfortunately :/.

0
Ảnh đại diện
Huỷ bỏ
Sudhir Arya (ERP Harbor Consulting Services)

What do you mean by internal notes?

Willmore BattleShipNet
Tác giả

In Odoo chatter there is a link (next to "New Message") "Log an internal note". When clicked on "Log an internal note" the text box appears where I can write note, and there is also attachment button. When clicked on the attachment button then appears file choose window. Once I choose file it is immediately uploaded to the server as an attachment to that note. I would like to allow a user to drag and drop a file on the "Log an internal note" :) and once the file is dropped it should upload immediately. This would save users time because they will not have to browse to the file they would just drag and drop needed files. But "Drag and drop" is not supported in "Log an internal note" (in chatter), how to enable it? I tried with the source code above but files didn't upload, it's stuck :/

Ảnh đại diện
Ujjwal Singh Baghel
Câu trả lời hay nhất

Hi Willmore,
I am also stuck with the same problem.
Have you figured out the solution yet?
If yes, please help me out in this, I will be really grateful.

0
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
[SOLVED] enable field Discount at invoice line and vendor bill odoo 10 Đã xử lý
discount odoo10 odoov10
Ảnh đại diện
Ảnh đại diện
2
thg 2 25
8271
Extend view to fullscreen
ir.ui.view odoo10 odoov10
Ảnh đại diện
Ảnh đại diện
1
thg 9 20
7993
Odoo 10 create user menu (new menu in account)
odoo10 odoo10.0 odoov10
Ảnh đại diện
0
thg 10 17
3592
how to add a column in a list view
listview column odoo10 odoov10
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
5
thg 9 19
13162
Dynamic Filtering - Filter records in "This Month" for example Đã xử lý
filter_domain odoo10 odoo10.0 odoov10
Ảnh đại diện
1
thg 9 18
239
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now