当我在odoo11中的看板视图中添加图像字段时,它将错误引发为“QWeb2 - template ['kanban-box']:运行时错误:TypeError:无法读取未定义”“的属性”raw_value“。相同的代码在odoo 9中为我工作。我很清楚这个问题的原因。这是我的代码。
Python代码:
public static ArrayList<String> tags_array ;// static array list if you want to pass array data
public void sendDataBundle(){
tags_array = new ArrayList();
tags_array.add("hashtag");//few array data
tags_array.add("selling");
tags_array.add("cityname");
tags_array.add("more");
tags_array.add("mobile");
tags_array.add("android");
tags_array.add("dress");
Intent su = new Intent(mContext, ViewItemActivity.class);
Bundle bun1 = new Bundle();
bun1.putString("product_title","My Product Titile");
bun1.putString("product_description", "My Product Discription");
bun1.putString("category", "Product Category");
bun1.putStringArrayList("hashtag", tags_array);//to pass array list
su.putExtras(bun1);
mContext.startActivity(su);
}
XML代码:
class Test(models.Model):
_name = "test.test"
image = fields.Binary(attachment=True)
感谢您的支持和时间。
答案 0 :(得分:0)
您可以通过添加“id”
来尝试<record id = "test_id" model = "ir.ui.view">
<field name = "name">Test Image</field>
<field name = "model">test.test</field>
<field name = "arch" type = "xml">
<kanban>
<field name="id"/>
<field name="image"/>
<templates>
<t t-name="kanban-box">
<div class="oe_resource_vignette">
<div class="oe_resource_image">
<img t-att-src="kanban_image('test.test','image',record.id.raw_value)" class="oe_resource_picture"/>
</div>
</templates>
</kanban>
</field>