This is my issue. I have a form to which I have added a button to scan near to Save button. What should happen is ,when pressing the button scan a wizard should be shown, but it does not happen. Why ?
template xml<t t-extend="FormView.buttons">
<t t-jquery=".o_form_buttons_edit" t-operation="append">
<button t-if="widget.modelName == 'model name'" accesskey="w" class="btn btn-success btn-sm o_button_scan" type="button">
<i class="fa fa-leanpub"></i>
Scan file
</button>
</t>
</t>
.jsconst ExtendFormController = FormController.include({
renderButtons: function ($node) {
this._super.apply(this, arguments);
this.$buttons.on('click', '.o_button_scan', this._force_f.bind(this));
this._updateButtons();
},
_force_f: function () {
var self = this;
rpc.query({
model: 'model name',
method: 'call_wizard',
context: self.context,
// args: [125447],
}).then(function (result) {
console.log('rpc result');
console.log(result);
});
},
_updateButtons: function () {
this._super.apply(this, arguments);
}
.pydef call_wizard(self):
compose_form = self.env.ref(
'l10n_cu_document.wizard_with_scanners_form'
)
# your treatment to click button next
# ...
# update state to step2
self_class = self.env['df.client.thread.class']
self.env['df.client.thread.class'].discovery(self_class)
# return view
return {
'type': 'ir.actions.act_window',
'res_model': 'wizard_with_scanner',
'view_mode': 'form',
'view_type': 'form',
'views': [(compose_form.id, 'form')],
'view_id': compose_form.id,
'target': 'new',
}
I already resolved it. Thank
Hi Wildredo,
You may want to tag this one as Solved and even supply what you did so it can help others :)
Open wizard on button click: https://learnopenerp.blogspot.com/2020/01/open-wizard-on-button-click-in-odoo.html