Odoo Help

0

0
1 Answer
1
Avatar

Zbik

--Zbik--
10913
| 7 6 9
Łódź, Polen
--Zbik--


Zbik
18-01-16 06:07

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>

2 Comments
Pascal Tremblay
18-01-16 07:25

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

Pascal Tremblay
18-01-16 08:15

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

Stel een vraag
Writer
Keep Informed
1 volger(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now