跳至內容
選單
此問題已被標幟
1 回覆
6584 瀏覽次數

Hello guys,

We are on Odoo 8. In Warehouse->Inventory Control-­­>Inventory Adjustements

The view is stock.view_inventory_form at this place.

Is it possible to display prices and values for each inventory line there?

Thanks

頭像
捨棄
最佳答案

My solution (with current cost price, not history):

class stock_inventory_line(models.Model):
    _inherit = 'stock.inventory.line'

    @api.one
    def _get_value(self):
        self.value = self.price * self.product_qty

    price = fields.Float(string='Cost price',related='product_id.standard_price',radonly=True,company_dependent=True)
    value = fields.Float(string='Value',compute='_get_value')


unfortunately company_dependent=True - see issue https://github.com/odoo/odoo/issues/9450



Update #1

In the view :

<record id="view_inventory_form_inherit_pt" model="ir.ui.view">

    <field name="name">stock.inventory.form.inherit.pt</field>

    <field name="model">stock.inventory</field>

    <field name="inherit_id" ref="stock.view_inventory_form"/>

    <field name="arch" type="xml">

    <xpath expr="//field[@name='theoretical_qty']" position="after">

            <field name="value"/>

    </xpath>

    </field>

</record>

頭像
捨棄
作者

what a beast. I will see it soon. thanks.

作者

Great, it works the first shot! Thanks a lot my friend.

相關帖文 回覆 瀏覽次數 活動
0
7月 24
1950
1
3月 24
2223
Out of Stock 已解決
4
2月 24
5253
1
7月 23
2855
1
5月 23
3524