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

Im trying to automatically select the event.booth in my custom wizard

@api.model
def default_get(self, fields_list):
res = super(CreateOrderWizard, self).default_get(fields_list)
default_booth_id = self.env.context.get('default_event_booth_id', False)
print(default_booth_id)

res.update({'event_booth_id': default_booth_id})
res['event_booth_id'] = default_booth_id
return res

 ↑ This is what the default_get looks like and

<button context="{'default_event_booth_id': event_booth}" id="action_rectanglemaps_create_order" type="action" name="%(action_rectanglemaps_create_order)d" string="Angebot erstellen" icon="fa-pencil-square"/>


 ↑ This is what the button that is used to call the wizard looks like

The botton is in the correct view (the event.booth.form)

The print(default_booth_id) statement prints the correct id.

As you can see i tried to use

res.update({'event_booth_id': default_booth_id})
as well as

res['event_booth_id'] = default_booth_id

to set the id

Neither of them work.

What am i doing wrong?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 22
2275
1
thg 8 23
3604
1
thg 6 22
12572
1
thg 8 19
8913
2
thg 8 19
12734