Hi guys,
How could I show the prices from the products under Warehouse > Physical Inventories?
I know it is in the module 'stock' and the logic is in stock.py and stock_view.xml. So inside my stock_view.xml I would like to add a field here:
<record id="view_inventory_form" model="ir.ui.view">
<field name="name">stock.inventory.form</field>
<field name="model">stock.inventory</field>
<field name="arch" type="xml">
<form string="Physical Inventory" version="7.0">
//Lots of irrelevant code was here..
<page string="General Information">
<field name="inventory_line_id">
<tree string="Products" editable="bottom">
<field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations"/>
<field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','<>','service')]"/>
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="prod_lot_id" groups="stock.group_production_lot"/>//SHOW PRODUCT PRICES HERE (I'd like both the price per product and the total from the quantity if possible)
So the simple question is how? What exactly should I add in stock.py and where? I've been trying for hours but have no idea how to do this in V7.
With kind regards
Yenthe
price of inventory line's products will not be available to you directly as it is not given in standard stock module. You need to customize code to achieve this. Create custom module.
Hi Mansi thanks for the answer but I did know I would have to do that or extend the current module.. I'm just not sure about how to do this for this case in V7 though :/
Its just you need to take 2 fields one should be related field on product_id that will fetch price of the product, and second you have to take functional field which will calculate your quantity into price(which you have fetched in 1st custom field). Now put both of the fields to the inventory view and update the module, And yeah if you are adding fields through code then you need to restart server too. Hope this will help you :P
Hi Mansi thanks for your response! The problem is that I tried to add fields to the .py file and then to the view (XML) but it would always throw me invalid errors and that those fields aren't allowed etc.. So think you could give me a little example? I just can't seem to find the exact place in the python file to make it work in the XML file.