This question has been flagged
5 Replies
50674 Views

in .xml py

<field name="picture" widget="image" />

Now I want to know how shall we can control the size of  "picture";

When user upload as figure to "picture", I find the figure is too small to see clear, and I want to show it in a big size to see it clear; how shall I  do this?

Avatar
Discard
Best Answer

Hi!!

I use this for version 15.0:

name="image_1920" widget="image" options="{'size': [150, 150]}"/>

I'm not sure if it works for version like 13.0 from back. I suposed that it works on 14.0 version due to both are quite similars.

I hope it helps anyone.

Avatar
Discard
Best Answer

Try it

xml
<field name="picture" widget="image" class="Your_custom_class"/>
css
.openerp .Your_custom_class > img { 
    height: 90px; 
    width: 90px;
 }

Revised Answer (Forget above)

<style>
    .openerp .Your_custom_class > img { height: 6000px; width: 10000px; }
    .openerp .oe_form .oe_form_field_image img { max-width:656px; max-height: 1056px; }
</style>
<field name="picture" widget="image" class="Your_custom_class"/>



Avatar
Discard
Author

thank you for your help;

I have done according to your advice as below:

1. I create a file named "im.css" in /modules/static/src/css;

2. add the below code in "im.css"

.openerp .my_image > img {

height: 90px;

width: 90px;

}

3. open my .xml file and edit as below:

<field name="picture" widget="image" class="my_image"/>

4. restart my odoo-server;

I find nothing changed; maybe I do something wrong?

You should connect the css to your module in xml

<template id="assets_backend" inherit_id="web.assets_backend">

<xpath expr="." position="inside">

<link rel="stylesheet" href="/modules/static/src/css.im.css"/>

</xpath>

</template>

Then upgrade the module.

Or try following

<style>

.openerp .my_image > img {

height: 90px;

width: 90px;

}

</style>

Author

Thank you very much, Shameem PKS;

I have done it according to your guiding;

But I still have a little problem about it as below:

if I set as "height: 90px;width: 90px;", the figure is very small; and so I set it as: "height: 600px;width:800px;", the picture is bigger; and then I set ti as: "height: 6000px;width: 10000px;", I find the picture is almost the same big as before( "height: 600px;width: 800px;",); in the fact I want to the picture can be in larger size; shall I?

You can solve your problem by adding few lines

.openerp .Your_custom_class > img {

height: 6000px;

width: 10000px;

}

.openerp .oe_form .oe_form_field_image img {

max-width:656px;

max-height: 1056px;

}

It is working in odoo9.

Note that it may be effected to other image fields.

Author

Thank you very much; it is perfect!

good job, happy life!

Best Answer

Use the odoo inbuilt class 'oe_avatar'.

i.e., <field name="image" widget="image" class="oe_avatar"/>
(recommanded version 11.0)
 

Avatar
Discard
Best Answer
just do css styles: 



and then


Avatar
Discard
Best Answer

I just added max-width and max-height to the



Avatar
Discard