post.twitter_preview = self.env.ref('social_medias.twitter_preview').render({ AttributeError: 'ir.ui.view' object has no attribute 'render'
//Odoo 9 code
@api.depends('message', 'scheduled_date', 'image_ids')
def _compute_twitter_preview(self):
for post in self:
post.twitter_preview = self.env.ref('social_medias.twitter_preview').render({
'message': post.message,
'images': [
image.datas if not image.id
else base64.b64encode(open(image._full_path(image.store_fname), 'rb').read()) for image in post.image_ids
]
})