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

Hi everyone, 

I have integrated WhatsApp with Odoo 15 using the WhatsApp Meta app from
https://developers.facebook.com/ . The integration is working — I can send messages from Odoo to customers on WhatsApp.

Now I want to send a file link along with the message, like an invoice. for this I am using controller method, So I am generating a public link for the file, for example:

http://my_domain.com/whatsapp/public_file/21809

But when I click on this link, it shows this error:

Not Found

The requested URL was not found on the server.

I've been stuck on this problem for a few days. Can anyone help me understand what might be wrong?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

The “Not Found” error means your route /whatsapp/public_file/<id> isn’t defined or not being picked up by Odoo. Make sure you have a controller like this:

Pyhton script:

@http.route('/whatsapp/public_file/<int:file_id>', type='http', auth='public')

def whatsapp_public_file(self, file_id, **kw):

    attachment = request.env['ir.attachment'].sudo().browse(file_id)

    if not attachment.exists():

        return request.not_found()

    return request.make_response(

        attachment._file_read(attachment.store_fname),

        headers=[('Content-Type', attachment.mimetype),

                 ('Content-Disposition', 'inline; filename="%s"' % attachment.name)]

    )


After adding, restart Odoo and update your module. Hope this should fix the link issue.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Please refer to the module:

https://apps.odoo.com/apps/modules/15.0/all_in_one_whatsapp_integration

This module helps you to send a whatsapp message to your partners that are in sale order, purchase order, invoice and bills, and deliver orders.


Hope it helps.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

To send a file link via WhatsApp from Odoo, you need to use the correct URL that Odoo uses to serve attachments.


You can directly use Odoo’s built-in route for attachments:

http://my_domain.com/web/content/21809


Make sure the attachment with ID 21809 actually exists in your database. You can find it in the `ir.attachment` model.


Also, ensure that the attachment is not restricted (check if it's public or associated with a record that the user has access to). If needed, set public=True or share it with proper access rights.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 25
294
2
thg 9 25
661
3
thg 8 25
1537
3
thg 7 25
964
2
thg 7 25
1599