I need to modify the method called by the "delete" button, so I would like to know:
- how to load the buttons menu of the sidebar? 
- how to modify the name that puts the items? 
- how to configure which methods of the python class to call? 
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
I need to modify the method called by the "delete" button, so I would like to know:
how to load the buttons menu of the sidebar?
how to modify the name that puts the items?
how to configure which methods of the python class to call?
Solution: add "ir.actions.server"
Former:
< record id = "action_model_done_something" model = "ir.actions.server" >< field name = "name" > Label </ field >
< field name = "model_id" ref = "model_name_class" />
< field name = "binding_model_id" ref = "module.model_name_class" />
< field name = "state" > code </ field >
< field name = "code" >
for rec in records: rec.action_feedback (feedback = 'Closed automatically in batch')
</ field >
</record >
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren| Verknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
|---|---|---|---|---|
|  | 1 Mai 21  | 3093 | ||
|  | 0 März 15  | 3589 | ||
|  | 0 März 15  | 4591 | ||
|  | 1 März 15  | 6031 | ||
|  | 1 Sept. 24  | 1647 | 
That is, how can I customize 'options.actions' in the .py file of the class?
File : web/static/src/js/chrome/sidebar.js
odoo.define('web.Sidebar', function (require) {
"use strict";
var Context = require('web.Context');
var core = require('web.core');
var pyeval = require('web.pyeval');
var Widget = require('web.Widget');
var QWeb = core.qweb;
var _t = core._t;
var Sidebar = Widget.extend({
events: {
"click .dropdown-menu li a": "_onDropdownClicked"
},
init: function (parent, options) {
this._super.apply(this, arguments);
this.options = _.defaults(options || {},
{ 'editable': true });
this.env = options.env;
this.sections = options.sections || [
{name: 'print', label: _t('Print')},
{name: 'other', label: _t('Action')},
];
this.items = options.items || {
print: [],
other: [],
};
if (options.actions) {
this._addToolbarActions(options.actions);
}
},
file: web/static/src/js/views/form/form_controller.js
FORM_CONTROLLER:
renderSidebar: function ($node) {
if (!this.sidebar && this.hasSidebar) {
var otherItems = [];
if (this.is_action_enabled('delete')) {
otherItems.push({
label: _t('Delete'),
callback: this._onDeleteRecord.bind(this),
});
}
if (this.is_action_enabled('create') && this.is_action_enabled('duplicate')) {
otherItems.push({
label: _t('Duplicate'),
callback: this._onDuplicateRecord.bind(this),
});
}
this.sidebar = new Sidebar(this, {
editable: this.is_action_enabled('edit'),
viewType: 'form',
env: {
context: this.model.get(this.handle).getContext(),
activeIds: this.getSelectedIds(),
model: this.modelName,
},
actions: _.extend(this.toolbarActions, {other: otherItems}),
});
this.sidebar.appendTo($node);
// Show or hide the sidebar according to the view mode
this._updateSidebar();
}
},