콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1373 화면

Hi,

I'm trying to add a custom button next to the 'Create' button on the Contacts page in both Kanban and List views, which should open a wizard when clicked. I followed several blogs and tutorials to create a custom module, but after installing it, the Contacts app only opens the new contact form and hides the Kanban and List views. Has anyone done this successfully before? Any help would be appreciated!

My Implementation


list_button.xml










kaban_button.xml










list_button.js
odoo.define('button_near_create.list_button', function (require) {
"use strict";
var ListController = require('web.ListController');
var ListView = require('web.ListView');
var viewRegistry = require('web.view_registry');
var ListButton = ListController.extend({
buttons_template: 'button_near_create.list_buttons',
events: _.extend({}, ListController.prototype.events, {
'click .open_wizard_action_list': '_OpenWizardList',
}),
_OpenWizardList: function () {
var self = this;
this.do_action({
type: 'ir.actions.act_window',
res_model: 'test.wizard',
name :'Open Wizard',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
res_id: false,
});
}
});
var PartnerListView = ListView.extend({
config: _.extend({}, ListView.prototype.config, {
Controller: ListButton,
}),
});
viewRegistry.add('button_in_list', PartnerListView);
});

​kanban_button.js
odoo.define('button_near_create.kanban_button', function(require) {
"use strict";
var KanbanController = require('web.KanbanController');
var KanbanView = require('web.KanbanView');
var viewRegistry = require('web.view_registry');
var KanbanButton = KanbanController.include({
buttons_template: 'button_near_create.kanban_buttons',
events: _.extend({}, KanbanController.prototype.events, {
'click .open_wizard_action_kanban': '_OpenWizardKanban',
}),
_OpenWizardKanban: function () {
var self = this;
this.do_action({
type: 'ir.actions.act_window',
res_model: 'test.wizard',
name :'Open Wizard',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
res_id: false,
});
}
});
var PartnerKanbanView = KanbanView.extend({
config: _.extend({}, KanbanView.prototype.config, {
Controller: KanbanButton
}),
});
viewRegistry.add('button_in_kanban', PartnerKanbanView);
});

assets.xml









views.xml



res.partner.view.list.inherit
res.partner



button_in_list






res.partner.view.kanban.inherit
res.partner



button_in_kanban









아바타
취소
관련 게시물 답글 화면 활동
1
8월 24
1788
2
8월 22
3645
13
3월 16
5274
1
9월 15
5963
2
8월 24
2159