Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6412 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
lis 16
2810
2
bře 15
8261
1
lis 22
14160
2
bře 21
3004
0
bře 15
3912