Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
I got this Code from Base code itself, anyway this will be helpful for those who searching for default image in odoo 9.
In Header,
from openerp.tools import openerp,image_colorize, image_resize_image_big
In Py,
photo = fields.Binary(string="Image to upload", default=lambda self:self._get_default_image())
@api.model
def _get_default_image(self, colorize=False):
image = image_colorize(open(openerp.modules.get_module_resource('base','static/src/img', 'avatar.png')).read())
return image_resize_image_big(image.encode('base64'))
In Xml, should specify widget="image" for showing image in Form.
<field name="photo" widget="image" />
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 16
|
2002 | ||
|
2
thg 8 25
|
7461 | ||
|
5
thg 12 23
|
29429 | ||
|
1
thg 7 25
|
2026 | ||
|
2
thg 11 24
|
1088 |