Search code examples
pythonodoo

How to align images in Odoo form views?


I have a form view with a page containing 5 binary fields with the image widget. If the user uploads images with different sizes it will not align correctly. How can I align those images regardless of the image size

This is my code:

                  <notebook>
                    <page name="fotos" string="Fotos">
                        <group>
                            <group>
                                <field name="foto_punto" widget="image"/>
                                <field name="foto_plantas" widget="image" />
                                <field name="foto_parcela" widget="image" />
                            </group>
                            <group>
                                <field name="foto_beneficiario_representante" widget="image" />
                                <field name="foto_firma" widget="image"/>
                            </group>
                        </group>
                    </page>
                  </notebook>

Note that column 2 row 2 picture is not align with column 1 row 2 picture


Solution

  • You can assign whatever size in options in widget image field tag. Assign same size to all widget image field tag.

    For e.g.

    <field name="foto_plantas" widget="image" options='{"size": [20, 20]}'/>