Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
5633 Prikazi

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 )
Avatar
Opusti
Best Answer

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

Avatar
Opusti
Avtor

it's not work

can you share code so i can help you?

Avtor

that's all what I do in the Q

Related Posts Odgovori Prikazi Aktivnost
1
sep. 21
5758
2
jun. 20
5990
1
maj 21
9231
3
apr. 25
18940
1
dec. 19
10983