Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
13177 Lượt xem

Hello,

I'm experiencing a strange functionality when I create a custom field. I use Openerp v.7. Either the field is created from Technical->Database Structure->Fields or inside the related Model, sometimes it is converted to a base field. I can't figure out how this is done, the name of the field starts with an x_ as it should and at the creation field form I can see it is of type Custom Field before saving. After saving and reloading the page I just see that the type has changed. Moreover, I can't delete that field or use it in a view because it throws xml validation error.

Does anyone know why this is happening or how can I deal with this?

Ảnh đại diện
Huỷ bỏ

Are you saying that the field is changing from a Custom Field to a Base Field after its saved?

Tác giả

Yes, that's what I'm saying. The Type of the field changes without being able to control it.

That is strange. So does it still have the x_ appended to the front of the name after it's saved? Or is it cropped off once the field is saved? Does the xml view have that name spelled the same way on it? Because I know it will cause that xml validation error if the view doesn't recognize another field because the name is spelled differently.

Tác giả

No, it still has the x_. However, I'm not able to use it in the view at all. It throws xml validation error. This is how I noticed the problem the first time. I created a field inside a model and then went to edit the view and it caused validation error. I also searched the database to see if there was a column with that name but nothing. It's like that I can see the field in the field list but it doesn't really exist. I also restarted the service but nothing changed.

What message do you get when you try deleting the field?

Tác giả

On Delete I get this:Error This column contains module data and cannot be removed! On edit I get:Error!

Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably through a custom addon!

On Delete, does the error tell you what table the module data exists in?

Tác giả

Do you mean on the delete pop-up window? No, there it doesn't say anything else. If it helps, I had created the field inside the res.partner model and I can see it in the model's field list and in form view of the field it also says model:Partner

if you open your Postgres database, and look up the table ir_model_fields, do you see the field exist in there?

Tác giả

Yes, I can see it there. On state it says "base". Should I deleted from there?

Yes I would delete it from there. Then restart your service and clear your browsing history also. This way you should get a fresh start

Tác giả

It is really weird how this has happened at first.Thanks a lot for your help!

Câu trả lời hay nhất

FYI, I have this same issue.  It looks like the field became available on different models, and in those models, the type was set to "Base Field".  In the original model I put it in, it still had "Custom Field".  I was able to delete that field.  So perhaps  there is some kind of propagation error where the field is copied to other models where it can be used, and during the copy process it set's Base Field.  This might be a bug.


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Yes, that's what I'm saying. The Type of the field changes without being able to control it.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Dear All,

I encountered this problem when trying to set "required" for custom field. The error did not prompt when I did not key into the field.

For the default field (base), the erir will prompt if  I did not key in the field.

Anyone know what is the problem?? Thanks in advance.

https://dl.dropboxusercontent.com/u/42025188/default_field.png

https://dl.dropboxusercontent.com/u/42025188/custom_field.png

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 16
6016
2
thg 3 15
8771
0
thg 7 22
2580
1
thg 1 24
6435
0
thg 5 22
2718