Replace custom js by 'target': 'main'

This commit is contained in:
Guewen Baconnier
2020-01-24 17:21:07 +01:00
committed by Hai Lang
parent 439d2bc72c
commit 9ae58438ad
4 changed files with 11 additions and 34 deletions

View File

@@ -177,6 +177,12 @@ class VerticalLiftShuttle(models.Model):
"res_id": self.id,
}
def action_back_to_settings(self):
action_xmlid = "stock_vertical_lift.vertical_lift_shuttle_action"
action = self.env.ref(action_xmlid).read()[0]
action["target"] = "main"
return action
def action_manual_barcode(self):
return {
"type": "ir.actions.act_window",

View File

@@ -2,10 +2,7 @@ odoo.define('stock_vertical_lift.vertical_lift', function (require) {
"use strict";
var KanbanRecord = require('web.KanbanRecord');
var basicFields = require('web.basic_fields');
var field_registry = require('web.field_registry');
var FormController = require('web.FormController');
var FieldInteger = basicFields.FieldInteger;
KanbanRecord.include({
@@ -27,27 +24,6 @@ odoo.define('stock_vertical_lift.vertical_lift', function (require) {
});
var ExitButton = FieldInteger.extend({
tagName: 'button',
className: 'btn btn-danger btn-block btn-lg o_shuttle_exit',
events: {
'click': '_onClick',
},
_render: function () {
this.$el.text(this.string);
},
_onClick: function () {
// The only reason to have this field widget is to be able
// to inject clear_breadcrumbs in the action:
// it will revert back to a normal - non-headless - view
this.do_action('stock_vertical_lift.vertical_lift_shuttle_action', {
clear_breadcrumbs: true,
});
},
});
FormController.include({
init: function () {
this._super.apply(this, arguments);
@@ -94,10 +70,7 @@ odoo.define('stock_vertical_lift.vertical_lift', function (require) {
});
field_registry.add('vlift_shuttle_exit_button', ExitButton);
return {
ExitButton: ExitButton,
};
return {};
});

View File

@@ -103,10 +103,6 @@
font-size: 2em;
text-transform: uppercase;
}
.o_shuttle_exit {
text-align: center;
}
}
.o_vlift_shuttle_popup {

View File

@@ -23,8 +23,10 @@
class="btn-primary btn-block btn btn-lg"/>
</div>
<div class="col-6">
<field name="id" string="Back to settings"
widget="vlift_shuttle_exit_button" readonly="1"/>
<button name="action_back_to_settings"
type="object"
string="Back to settings"
class="btn-danger btn-block btn-lg" />
</div>
</div>
<footer></footer>