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

i want to change a custom Field

test= fields.Integer(string="Test")
to
test = fields.Char(string="TEst")


if i do this it works but all existing Values will be lost in DB. Is it possible to make this without loosing the existing values? (castet to Strings in DB)

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

You can change fields from integer to char. Then all values store in test_moved0(created new column). You can run below update query to fill values in new column.

update table_name set test = test_moved0;

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

i_m sorry but found the solution already here:

https://www.odoo.com/de_DE/forum/hilfe-1/question/change-data-type-of-field-on-active-db-142575

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