Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2320 Widoki

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
sie 23
5226
1
gru 24
4259
2
maj 24
5120
2
cze 22
4570
0
cze 21
2531