我需要在Odoo 9上找到正确的XPath到产品ID。我试过这个,但它抱怨"字符串"有一些问题。
错误详情:
View inheritance may not use attribute 'string' as a selector.
代码:
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
答案 0 :(得分:2)
真的需要这么详细的选择器吗?看起来像这样简单的选择器可以很好地完成这项工作:
<div class="field">
<div id="dvMessage" runat="server" style="color: Red" >
</div>
<label>
Category Name <em>*</em>
</label>
<div>
<asp:TextBox ID="txtCategoryName" runat="server" CssClass="form-01-control" onkeyup="checkfunction(this.value)" placeholder="Enter Category Name" ></asp:TextBox>
</div>
<div id="dvMsg" runat="server" style="color: Red">
</div>
<label>
Category Description <em>*</em></label>
<div>
<asp:TextBox ID="txtCategoryDescription" runat="server" CssClass="form-01-control" onkeyup="checkfunction(this.value)" placeholder="Enter Category Description"></asp:TextBox>
</div>
<label>
Parent Category </label>
<div>
<asp:DropDownList ID="ddlParentCategory" runat="server" Width="250px" class="form-01-control">
</asp:DropDownList>
</div>
<label>
Category Image</label>
<div>
<asp:FileUpload ID="fuImage" runat="server" />
<asp:Image ID="imgCategory" Width="100" Height="100" runat="server" />
</div>
</div>
答案 1 :(得分:2)
在odoo v9中,您不允许在xpath中使用字符串作为选择器。 因此,最好在xpath中使用name作为选择器。
您应该尝试以下操作:
<xpath expr="//page/field[@name='order_line']/form/group/group/field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>
或者您也可以像这样编写xpath,
<xpath expr="//field[@name='order_line']//form//field[@name='product_id']" position="before">
<field name="image_small" widget="image"/>
</xpath>