This question has been flagged

Odoo 9 community edition


Hi,

I'm new in Odoo/Openerp. How do I enable stock availability in Sales Quotation View?


Thanks!

Jing

Avatar
Discard
Best Answer

Use below code,

In PYTHON file:

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
qty_available = fields.Float(related='product_id.qty_available', string="Qty Available", readonly=True)

In XML file:

     <record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
<field name="qty_available"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="before">
<field name="qty_available"/>
</xpath>
</data>
</field>
</record>

Avatar
Discard