Revamp the kanban view of fleet.vehicle.log.services. Add some ux improvements (new filters, better naming,..). Fix bug where contracts/services of archived fleet.vehicle were not counted in statinfo. When a fleet.vehicle is archived, archive its related contracts/services. closes odoo/odoo#62556 Taskid: 2389823 Related: odoo/upgrade#2063 Related: odoo/enterprise#15036 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
odoo.define('fleet.FleetForm', function(require) {
|
|
"use strict";
|
|
|
|
const FormController = require('web.FormController');
|
|
const FormView = require('web.FormView');
|
|
const viewRegistry = require('web.view_registry');
|
|
const Dialog = require('web.Dialog');
|
|
|
|
const core = require('web.core');
|
|
const _t = core._t;
|
|
|
|
const FleetFormController = FormController.extend({
|
|
/**
|
|
* @override
|
|
* @private
|
|
**/
|
|
_getActionMenuItems: function (state) {
|
|
if (!this.hasActionMenus || this.mode === 'edit') {
|
|
return null;
|
|
}
|
|
var menuItems = this._super.apply(this, arguments);
|
|
var archiveAction = _.find(menuItems.items.other, (actionItem) => {return actionItem.description === _t("Archive");});
|
|
if (archiveAction) {
|
|
archiveAction.callback = () => {
|
|
Dialog.confirm(this, _t("Each Services and contracts of this vehicle will be considered as Archived. Are you sure that you want to archive this record?"), {
|
|
confirm_callback: () => this._toggleArchiveState(true),
|
|
});
|
|
};
|
|
}
|
|
return menuItems;
|
|
},
|
|
|
|
});
|
|
|
|
var FleetFormView = FormView.extend({
|
|
config: _.extend({}, FormView.prototype.config, {
|
|
Controller: FleetFormController,
|
|
}),
|
|
});
|
|
|
|
viewRegistry.add('fleet_form', FleetFormView);
|
|
|
|
return FleetFormView;
|
|
});
|