openerp - How to update automatically other fields when quantity on hand get increase or decrease odoo? -


i need update automatically field(qty_available_onhand) either when quantity on hand increase or decrease below have mentioned code. current below code working when fill field(squ_meter) i'm entering in field multiplied field(qty_avl) qty_avl nothing quantity on hand. answer appreciated

class product_template(osv.osv):     _name = "product.template"     _inherit = "product.template"     _columns = {          'squ_meter':fields.float('square meter'),          'qty_available_onhand': fields.float(              'qty sqm available',               compute='_compute_qty_available_onhand',               require = true           ),           'qty_avl':fields.related(              'virtual_available',              relation='product.product',              string='quantity on hand'          ),     }      @api.depends('qty_avl', 'squ_meter')     def _compute_qty_available_onhand(self):         record in self:             record.qty_available_onhand = record.qty_avl * record.squ_meter 

view.xml

<field name="name">product.product.inherited</field> <field name="model">product.template</field> <field name="inherit_id" ref="product.product_template_form_view"/> <field name="type">form</field> <field name="arch" type="xml">     <xpath expr="//field[@name='active']" position="after">            <field name="qty_available_onhand"/>            <field name="qty_avl" invisible='1'/>            <field name="squ_meter"/>    </xpath> 


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -