码迷,mamicode.com
首页 > 其他好文 > 详细

ReadOnly field saved with NULL value

时间:2014-07-24 22:02:32      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   for   re   c   div   js   

On CRM opportunity form view, i added readonly="1" for probability field. When i saved, whatever the value of my probability, it‘s stored with NULL value. Is it a bug on OpenERP ?

 

I think its a bug in openerp. I have created a patch for that. In the openerp addons, web module, goto static/src/js/view_form.js.

Index: view_form.js
===================================================================
--- openerp/addons/web/static/src/js/view_form.js   
+++ openerp/addons/web/static/src/js/view_form.js   
@@ -833,11 +833,9 @@
                     // Special case id field, do not save this field
                     // on create : save all non readonly fields
                     // on edit : save non readonly modified fields
-                    if (!f.get("readonly")) {
-                        values[f.name] = f.get_value();
-                    } else {
-                        readonly_values[f.name] = f.get_value();
-                    }
+                   values[f.name] = f.get_value();
+                    if (f.get("readonly"))
+                       readonly_values[f.name] = f.get_value();
                 }
             }
             if (form_invalid) {

ReadOnly field saved with NULL value,布布扣,bubuko.com

ReadOnly field saved with NULL value

标签:style   blog   color   for   re   c   div   js   

原文地址:http://www.cnblogs.com/chjbbs/p/3866140.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!