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

I'm creating a google map module which allows a user to create a product by right-clicking the map

the right click event is caught and fires the following:

dispatchNewProductAction: function() {

console.log('called dispatch action');

this.do_action({

type: 'ir.actions.act_window',

res_model: "product.template",

views: [[false, 'form']],

context: {}

});

},

The product form view is displayed... How can I pass the co-ordinates into the form view?

Another question... If I use

target: 'new'

the save button is no longer available, how can I allow the popup form to save a new product record?

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

I have managed to pass data using the context field, but the model property needs to be prepended with the word "default_"

dispatchNewProductAction: function(lat, long) {

console.log('called dispatch action');

this.do_action({

type: 'ir.actions.act_window',

res_model: "product.template",

views: [[false, 'form']],

context: {'default_latitude': lat, 'default_longitude': long}

});

},

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

To pass default data in create form view, you have to prepend fields name with "default_".

For the target="new" save problem, you have to manage the buttons yourself when you use that type of target.
Add a button that call an action on your object to save the information.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 4 21
2329
0
thg 9 18
2466
0
thg 7 25
262
1
thg 7 25
5034
0
thg 7 25
590