Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Problem with loading attachments in mail.channel using xmlrpc in python

Odebírat

Get notified when there's activity on this post

This question has been flagged
pythonxmlrpcir.attachmentmail.channel
1 Odpovědět
3910 Zobrazení
Avatar
Maryam

Hello everyone, 

I'm trying to send messages with attachments in mailbox using xmlrpc (ir.attachment and mail.channel).

With admin account as sender, I can see my attachments without any problem. But as receiver in the same chat conversation, the images are not shown (I see just camera icon) and pdf files have the following error: PDF.js Version 2.2.228 (build: d7afb74a)
Message: Missing PDF "http://10.20.168.7:8069/web/content/884".

Here is a part of my script:

with open(attachment_filepath ,'rb') as raw_data:
​attachment1 = base64.b64encode(raw_data.read())
attachment = attachment1.decode('ascii')
file_type = re.search('\.(.*)',entry_name)
filetype = file_type.group()
name = 'attachment' + filetype
 
if filetype == '.pdf':
​mimetype = 'application/pdf'
elif filetype == '.jpg' or filetype == '.jpeg' :
​mimetype = 'image/jpeg'
elif filetype == '.png':
​mimetype = 'image/png'
else:
​mimetype = 'text/plain' 
 
if has_attachment is True:
​attach_args = [{
​ ​'name' : name,
​ ​'datas' : attachment,
​ ​'store_fname' :attachment,
​ ​'mimetype' : mimetype,
​ ​'type': 'binary', 
​}]
​attachment_exe = models.execute_kw(db, uid, API_KEY, 'ir.attachment', 'create', attach_args)
​attachment_ids = [attachment_exe]
else:
​attachment_ids = []

args = [{
​'author_id': 3,
​'email_from': 'administrator',
​'create_uid': [2, 'administrator'],
​'subject': subject,
​'body': body,
​'attachment_ids' : attachment_ids,
​'message_type' : 'email',
​'model' : 'mail.channel',
​'starred': True,
​'reply_to': 'administrator',
​'partner_ids': partner_ids,
​'reaction_ids' : [3],
​'is_internal' : True,
​'reply_to_force_new': True,
​'mail_server_id': 1,
​'parent_id' : False,
​'res_id' : res_id,
}]
message = models.execute_kw(db, uid, API_KEY, 'mail.message', 'create', args)

Is it something related to access right? Does anybody have an idea?


Thank you in advance

Maryam

0
Avatar
Zrušit
Avatar
Mahmoud El Bouyahyaoui
Nejlepší odpověď

It seems like you're running into an issue with the permissions of the user account you're using to send the messages with attachments. The images and pdf files are not being displayed properly because the user account you're using does not have the necessary permissions to access the attachments.

You can check the permissions of the user account by going to Settings > Users > Users and editing the user account in question. On the Access Rights tab, you can check if the user has the correct permissions to access the attachments.

One thing you can try is to give the user account permissions to access the ir.attachment model and the mail.channel model by setting the appropriate access rights. Another thing you can try is to check the permissions for the group the user is in.

Make sure that the user has the correct permissions to access the attachments and also check that the user has the correct access rights to the ir.attachment and mail.channel models. This should resolve the issue with the images and pdf files not being displayed properly.

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
404 when testing demo xmlrpc client in python
python xmlrpc
Avatar
Avatar
Avatar
Avatar
3
čvc 25
3078
Creating journal entries via external API (XML-RPC) Vyřešeno
python xmlrpc
Avatar
1
srp 23
16585
XMLRPC Error 302 Temporarily moved (odoo.sh v13)
python xmlrpc
Avatar
0
čvn 20
61
Adding translations while creating records for models with XMLRPC
python translations xmlrpc
Avatar
Avatar
1
kvě 24
4487
Create invoice via xmlrpc Vyřešeno
python invoice xmlrpc
Avatar
Avatar
1
lis 22
5000
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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