Hello guys, we did that for a customer, here is the following code we put in some module:
class sale_order_line(osv.osv): _inherit = 'sale.order.line' def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order, packaging, fiscal_position, flag) if product and self.pool.get('product.product').browse(cr, uid, product, {}).virtual_available < 1: if result['warning'] and result['warning']['message']: result['warning']['message'] += "\n\n" + _('Not available in stock!') else: result['warning'] = {'title':_('Not available in stock!'),'message':_('Not available in stock!')} return result sale_order_line() This will display a warning popup telling the product is out of stock eventually when you select it in the sale order interface. Hope this helps. ------------------------ Raphaël Valyi CEO and OpenERP consultant at http://www.akretion.com -------------------- m2f -------------------- -- http://www.openobject.com/forum/viewtopic.php?p=58980#58980 -------------------- m2f --------------------
_______________________________________________ Tinyerp-users mailing list http://tiny.be/mailman2/listinfo/tinyerp-users
