Hello,
we extended a Model with an additional Image field:
class ProductTemplate(models.Model):
_inherit = 'product.template'
img = fields.Image(string="Image")
Now, when we want to display the image, we add the corresponding form view:
(Odoo doesn't correctly display xml, so i substituted < with (tag open) and > with (tag close))
(tag open) xpath expr="//field[@name='template_name']" position="after" (tag close)
(tag open) field name="img" colspan="2" widget="image" height="'250'" / (tag close)
(tag open)/xpath(tag close)
Finally when we want to actually display the form view, following error is thrown:
UncaughtPromiseError > OwlError
Uncaught Promise > Invalid props for component 'ImageField': 'height' is not a number
OwlError: Invalid props for component 'ImageField': 'height' is not a number OwlError@http://<>/web/assets/776-1aebd68/web.assets_common.min.js:1133:1 validateProps@http://<>/web/assets/776-1aebd68/web.assets_common.min.js:1586:67 template@http:// Function:17:13
When "height= ... " is removed as attribute from the field tag in the template, everything works (without correct height of course).
I even dug into the Odoo source and found that height is fully supported:
(Remove white spaces, I dont have enough karma for links)
https://github.com/odoo/odoo/blob/92c232cca15517bd9a33a5100e7cdc42c3c25397/addons/web/static/src/views/fields/image/image_field.js#L131C45-L131C45
And props declaration should work this way, if this document is correct: https://github.com/odoo/owl/blob/master/doc/reference/props.md
So why the fuck is this error thrown? Doesn't matter if I set height=250, height="250" or height='250' ... Odoo isn't recognizing the number 250 as a Number.