How to replace the product by product's form view. When click on product it will open the product form view and fill all the fields using JS.
I used the following code. It open the product's form view on click but not fill the fields.
selected_item: function(e){
e.preventDefault();
// var name = e.currentTarget.dataset.action_name;
// var oe_id = $(event.currentTarget).data('id');
return this.do_action({
type: 'ir.actions.act_window',
res_model: 'product.product',
view_type: 'form',
view_mode: 'form',
views: [[false, 'form']],
target: 'current',
});
}
Specify which record you need to show by adding: res_id: res_id,
.
To specify the record id you can try:
selected_item: function(e){
e.preventDefault();
// var name = e.currentTarget.dataset.action_name;
var oe_id = $(e.currentTarget).data('id');
return this.do_action({
type: 'ir.actions.act_window',
res_model: 'product.product',
view_type: 'form',
view_mode: 'form',
res_id: oe_id,
views: [[false, 'form']],
target: 'current',
});
}