Hello,
I want to display a warning message when the user add an existing sale order line,
exp: i have a sale order line with an item x, when i add an other sale order line with the item x i want to display the warning message.
global list_product list_product = []
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, context=None):
context = context or {}
lang = lang or context.get('lang',False)
................... if product in list_product: WRNNING MESSAGE HERE
list_product.append(product)
if warning_msgs:
warning = {
'title': _('Configuration Error!'),
'message' : warning_msgs
}
return {'value': result, 'domain': domain, 'warning': warning}
sale_order_line()
with this code i can not initialize the variable list_product[]
Any ideas?