I manage to find a way to have the product price on stock.picking
, but now I have a view error.
This is my model:
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
class StockPicking(models.Model):
_inherit = 'stock.picking'
product_id = fields.Many2one("product.product", "Product")
price_unity = fields.Float(string="Precio", store=True, readonly=True, related="product_id.lst_price")
Now, the offending code in my view:
<record id="view_stock_picking_form" model="ir.ui.view">
<field name="name">Stock Picking Price Form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//page/field[@name='pack_operation_product_ids']/tree/field[@name='qty_done']" position="after">
<field name="price_unity"/>
</xpath>
</field>
</record>
It says Error details:
Field
price_unitydoes not exist
how is this even possible?
On tree view it doesn't throws this error:
<record id="view_stock_picking_tree" model="ir.ui.view">
<field name="name">Stock Picking Price Tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree"/>
<field name="arch" type="xml">
<field name="state" position="before">
<field name="price_unity"/>
</field>
</field>
</record>
So, how is it that in form view I can't declare it'
Am I missing something?
Thanks in advance!