0
我正在嘗試擴展產品模板表單視圖,以合併顯示其他相關產品模板的照片的其他字段(因此product_template ID 10顯示在product_template的其他字段圖像中)Odoo 10 - 顯示給定產品模板的圖像
我看到像場在模型中定義爲:
# image: all image fields are base64 encoded and PIL-supported
image = fields.Binary(
"Image", attachment=True,
help="This field holds the image used as image for the product, limited to 1024x1024px.")
image_medium = fields.Binary(
"Medium-sized image", attachment=True,
help="Medium-sized image of the product. It is automatically "
"resized as a 128x128px image, with aspect ratio preserved, "
"only when the image exceeds one of those sizes. Use this field in form views or some kanban views.")
image_small = fields.Binary(
"Small-sized image", attachment=True,
help="Small-sized image of the product. It is automatically "
"resized as a 64x64px image, with aspect ratio preserved. "
"Use this field anywhere a small image is required.")
這將是確定這一新領域的方式是什麼?可以使用計算字段嗎?有沒有更簡單的參考可以使用?
只是提到他,因爲我是用<字段名=「...」小工具=‘圖像’類=‘oe_avatar’只讀=‘真’/>在我只是在_get_default_image方法返回product_image形式。爲什麼要解碼和編碼?剛返回product_image有什麼缺失嗎? –
這篇文章有一個小錯誤。只有分配給_name的現有模型的名稱才能繼承。 可能的定義是:_inherit和_name(繼承),只有_inherit而不是_name(擴展名),_name和_inherit ** s **(委派)。 在odoo文檔中查看[繼承](https://www.odoo.com/documentation/10.0/reference/orm.html#inheritance-and-extension)。 – coreuter
繼承與自定義名稱創建一個新表的權利? @coreuter –