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

Hello everyone,

I have a problem with the following piece of code. I'd expect the "load" variable to contain data of the attachments that I've searched for. Unfortunately it only contains their IDs. Am I trying to access it the wrong way?

load = self.env['ir.attachment']._search([('res_model', '=', 'crm.lead'),('res_id', '=', self.id)])
for attachment in load:
container_dir = 'mnt/extra-addons/inne/' + cat_name + attachment.name
bin_value = base64.b64decode(attachment.datas)
fp = open(container_dir, 'wb')
fp.write(bin_value)
link_total = root_dir + cat_name
Avatar
Annuleer
Beste antwoord

Hello,

Please try to using this way:

self.env['ir.attachment'].search([('res_model', '=', 'crm.lead'),('res_id', '=', self.id)])


Regards,




Email:   odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
nov. 16
2829
2
mrt. 15
8295
1
nov. 22
14188
2
mrt. 21
3040
0
mrt. 15
3942