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

i 'am trying to set a default logo for company, but nothing changes 
i tried this code

class logocompany(models.Model):
_inherit = 'res.company'

@api.model
def _default_company_image(self):
image_path = modules.get_module_resource('auto_product', 'static/src/img', 'autoparts.png')
return tools.image_resize_image_big(base64.b64encode(open(image_path, 'rb').read()))

logo = fields.Binary(default=_default_company_image )
Awatar
Odrzuć
Najlepsza odpowiedź

Hi mohamad,

Try this:

def _default_company_image():

    with open(modules.get_module_resource('auto_product', 'static/src/img', 'autoparts.png'), 'rb') as f:

        return base64.b64encode(f.read())

logo = fields.Binary(default=_default_company_image)

I hope it will helpful for you.

Regards

Haresh Kansara

Awatar
Odrzuć
Autor

it's not work

can you share code so i can help you?

Autor

that's all what I do in the Q

Powiązane posty Odpowiedzi Widoki Czynność
1
wrz 21
5711
2
cze 20
5872
1
maj 21
9065
3
kwi 25
18689
1
gru 19
10928