Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6766 มุมมอง

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ค. 24
2077
1
มี.ค. 24
2292
Out of Stock แก้ไขแล้ว
4
ก.พ. 24
5388
1
ก.ค. 23
2950
1
พ.ค. 23
3606