跳至内容
菜单
此问题已终结
1 回复
5662 查看

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 )
形象
丢弃
最佳答案

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

形象
丢弃
编写者

it's not work

can you share code so i can help you?

编写者

that's all what I do in the Q

相关帖文 回复 查看 活动
1
9月 21
5805
2
6月 20
6038
1
5月 21
9287
3
4月 25
19135
1
12月 19
11032