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

I created a new module and extended the model for some module settings:

class TransferSettings(models.TransientModel):
    _inherit = 'res.config.settings'
    _name = 'custom.config.settings'

And added custom fields. 

I created a view for it and appended it to an existing menu. 

Now what I want is to only have one record of this settings but when I open the input form I can only insert new records. It doesen't load previous setting for editing. If I manually write id=1 in the url I get the first inserted record that gets updated, but what I want is to always get the first record since this are settings for the module..

How can I accomplish this?

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

This because you do new _name = 'custom.config.settings' , so the framework will create new model with new tables, you can just remove "_name = 'custom.config.settings" and will work fine

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 19
5151
3
thg 6 17
11591
3
thg 9 23
3529
1
thg 8 19
3925
9
thg 6 17
17229