コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2211 ビュー

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.

アバター
破棄
関連投稿 返信 ビュー 活動
3
8月 23
5033
1
12月 24
4105
2
5月 24
4988
2
6月 22
4392
0
6月 21
2410