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

I'm trying to override the placeholder function located inside /odoo/addons/web/controllers/main.py


class Binary(http.Controller):

@staticmethod
def placeholder(image='placeholder.png'):
image_path = image.lstrip('/').split('/') if '/' in image else ['web', 'static', 'src', 'img', image]
with tools.file_open(get_resource_path(*image_path), 'rb') as fd:
return fd.read()


This is what I have in my module, but it doesn't seem to be working for Odoo 14:



from odoo.addons.web.controllers.main import Binary

class BinaryInherit(Binary):

@staticmethod
def placeholder(image='placeholder.png'):
image_path = ['default_product_image', 'static', 'src', 'img', 'default-product.jpg']
with tools.file_open(get_resource_path(*image_path), 'rb') as fd:
return fd.read()



Any help would be appreciated. Thank you.

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
aug. 23
5305
1
dec. 24
4373
2
mei 24
5211
2
jun. 22
4667
0
jun. 21
2607