تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6966 أدوات العرض

when i write this code 

elif val > mVal and val < totalVal: 

 warning = { 

 'title': _('Warning.'), 

 'message': _('You are Between ThreshHold Value.')} 

 return {'warning': warning}

if i remove this code its working well .....

its show me error like this 



File "/home/usman/Documents/odoo12/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/usman/Documents/odoo12/odoo/odoo/api.py", line 747, in call_kw
    return _call_kw_model_create(method, model, args, kwargs)
  File "/home/usman/Documents/odoo12/odoo/odoo/api.py", line 728, in _call_kw_model_create
    return result.id if isinstance(args[0], Mapping) else result.ids
AttributeError: 'dict' object has no attribute 'id'



الصورة الرمزية
إهمال
أفضل إجابة

If I am not wrong, it seems like you have override the create method and trying to do some validation. 

The warning works only in the onchange method and not any other method. If you want to do some validations, either use raise exception or constraints.

الصورة الرمزية
إهمال
الكاتب

wow you pick exact ....point thank you soo much

الكاتب

can you pls tell me example for raise exception how i can write in create method ?

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
ديسمبر 19
9054
0
نوفمبر 19
4258
0
يوليو 19
2459
1
مايو 17
8717
5
فبراير 17
7148