In Odoo V10, I am editing the default sale.order.form.sale.stock. Here is the full original view:
<?xml version="1.0" encoding="UTF-8"?><data> <xpath expr="//button[@name='action_view_invoice']" position="before"> <field name="picking_ids" invisible="1" /> <button type="object" name="action_view_delivery" class="oe_stat_button" icon="fa-truck" attrs="{'invisible': [('delivery_count', '=', 0)]}" groups="base.group_user"> <field name="delivery_count" widget="statinfo" string="Delivery" /> </button> </xpath> <xpath expr="//group[@name='sales_person']" position="before"> <group string="Shipping Information" name="sale_shipping"> <field name="warehouse_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" /> <field name="incoterm" widget="selection" groups="base.group_user" /> <field name="picking_policy" required="True" /> </group> </xpath> <xpath expr="//page/field[@name='order_line']/form/group/group/field[@name='tax_id']" position="before"> <field name="product_tmpl_id" invisible="1" /> <field name="product_packaging" context="{'default_product_tmpl_id': product_tmpl_id, 'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id}" domain="[('product_tmpl_id','=',product_tmpl_id)]" groups="product.group_stock_packaging" /> </xpath> <xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before"> <field name="route_id" groups="sale_stock.group_route_so_lines" /> </xpath> <xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="before"> <field name="route_id" groups="sale_stock.group_route_so_lines" /> </xpath></data>
I am simply trying to edit the last field, to add a domain like this:
<field name="route_id" groups="sale_stock.group_route_so_lines" domain="[('product_ids', 'in', product_tmpl_id)]"/>
However, when I click into the Routes field in the UI, I get the error:
Uncaught Error: AttributeError: object has no attribute 'product_tmpl_id'
Why would this error be occurring? The sale.order.line object has a product_tmpl_id field, so why am I getting an error that it does not have that attribute?