Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
14306 Представления

Hi,

I have defined a field as

invLogo = fields.Binary("Upload Company Logo (for Invoice)", attachment=True,
help="This field holds the image used for as companyLogo")

and i have defined the view as

<field name="invLogo" widget="image" class="oe_avatar" options='{"preview_image": "image_medium"}'/>

Everything works fine.. it displays a image upload box and everything, but the problem is that when i select a image and select save the picture won't get saved and also in the table in the db the column is also null. Why is this happening? Did i define the field wrong? Please help me!

Thanks

Аватар
Отменить
Автор

For some weird reason i created another binary field and it worked fine. No matter what or how i tried i couldn't get the old field working. Now the binary field shows the image even after saving, database holds some value in the respective column, it's not null like before and more importantly i didn't declare store=True.

For me, the problem was that the name of the field has to be set in the "preview_image" option of the widget, like this:

<field name="img_avatar" widget="image" class="oe_avatar" options='{"preview_image": "img_avatar"}'/>

Hope it helps

Лучший ответ

Remove options='{"preview_image": "img_avatar"}'/> in the xml code
now it will work.

i had a same problem and it worked for me.


Аватар
Отменить
Лучший ответ

Hello ,

It's mean your attachment (Image) not store in DB so you can use store= True.

invLogo = fields.Binary("Upload Company Logo (for Invoice)", attachment=True,store=True
help="This field holds the image used for as companyLogo")

and if you are store images in file system then check your file store path in odoo config file.

Thanks

Аватар
Отменить
Автор

Hi Manish,

As mentioned in the question itself yes, it's not storing in the database and I have tried declaring the field as store=True but no luck. Still the data was not getting stored.

So, I don't know about this config file and what to check in it... can you elaborate about what is should check?

Автор Лучший ответ

For some weird reason i created another binary field and it worked fine. No matter what or how i tried i couldn't get the old field working. Now the binary field shows the image even after saving, database holds some value in the respective column, it's not null like before and more importantly i didn't declare store=True.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
апр. 19
5916
3
мая 25
1584
5
мая 25
9390
1
апр. 25
1183
3
сент. 24
14030