ReadOnly field saved with NULL value

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

时间: 2024-11-03 00:18:02

ReadOnly field saved with NULL value的相关文章

A const field of a reference type other than string can only be initialized with null Error [duplicate]

I'm trying to create a 2D array to store some values that don't change like this. const int[,] hiveIndices = new int[,] { {200,362},{250,370},{213,410} , {400,330} , {380,282} , {437, 295} , {325, 405} , {379,413} ,{343,453} , {450,382},{510,395},{46

转载:readonly和const比较

原文地址:http://www.cnblogs.com/panjun-Donet/archive/2008/03/28/1127680.html 前天犯了个低级错误,是关于readonly的,总结了一下:    C#的readonly关键字只能在字段上面使用public readonly TcpClient client;不能在类,方法,属性上面使用readonly!!顺便看了一下readonly和const的区别: readonly和const都是用来标识常量的. const可用于修饰clas

const和readonly差别

我们都知道,const和static readonly的确非常像:通过类名而不是对象名进行訪问,在程序中仅仅读等等.在多数情况下能够混用.二者本质的差别在于,const的值是在编译期间确定的,因此仅仅能在声明时通过常量表达式指定其值.而static readonly是在执行时计算出其值的,所以还能够通过静态构造函数来赋值.明确了这个本质差别,我们就不难看出以下的语句中static readonly和const是否能互换了: 1. static readonly MyClass myins = n

关于C#中的ReadOnly

readonly field can be initialized either at the declaration or in a constructor.' data-guid="257637d5ffda9953f70ee09ecc32366c">readonly 字段可以在声明或构造函数中初始化. class Age { readonly int age; public Age() { age = 10; } public void ChangeAge() {//age

readonly(C# 参考)

readonly 关键字是可以在字段上使用的修饰符. 当字段声明包括 readonly 修饰符时,该声明引入的字段赋值只能作为声明的一部分出现,或者出现在同一类的构造函数中. 示例 在此示例中,字段 year 的值无法在 ChangeYear 方法中更改,即使在类构造函数中给它赋了值. C# class Age { readonly int _year; Age(int year) { _year = year; } void ChangeYear() { //_year = 1967; //

How to perform a SQL query for fields that are null (or not null)

Okay, maybe this is lame, but when I've been away from writing SQL database queries for a while I can never remember how to search for database table fields that are either NULL, or NOT NULL. I always try to use the = operator or something else. So,

static, readonly, const

static Use the static modifier to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with classes, fields, methods, properties, operators, events, and constructors, but it canno

MongoDB - MongoDB CRUD Operations, Query Documents, Query for Null or Missing Fields

Different query operators in MongoDB treat null values differently. The examples on this page use the db.collection.find() method in the mongo shell. To populate the users collection referenced in the examples, run the following in mongo shell: db.us

readonly(C#)

1.readonly关键字是可以在字段上使用的修饰符.当字段生命包括readonly修饰符时,该声明引入的字段赋值只能作为声明的一部分出现,或者出现在同一类的构造函数中 2.在此实例中,字段year的值无法再ChangeYear方法中更改,即使在类构造函数中中给它赋了值. class Age { readonly int _year; Age(int year) { _year = year; } void ChangeYear() { //_year = 1967; // Compile er