コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2089 ビュー


I want to make a new button here.


I already make the element and the js function

        <?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <t t-name="DoGanttView.buttons" t-extend="GanttView.buttons">
        <p>asdpoasidpaisdpaisd</p>
        <t t-jquery="*[hasclass='o_gantt_range']" t-operation="after">
            <button class="o_gantt_button_move_plan btn btn-primary" title="Move Button" data-hotkey="c">
                New Button
            </button>
        </t>
    </t>
</templates>

gantt_controller.js

/** @odoo-module alias=do_web_gantt.GanttController **/

import GanttController from 'web_gantt.GanttController';
import {_t} from 'web.core';
import { ControllerMixin } from './mixins';

const DoGanttController = GanttController.extend(ControllerMixin, {
    events: _.extend({}, GanttController.prototype.events, {
        'click .o_gantt_button_move_plan': '_onMovePlanClick',
    }),
    buttonTemplateName: 'DoGanttView.buttons',
});

export default DoGanttController;

gantt_view.js

/** @odoo-module alias=do_web_gantt.GanttView */
import DoGanttController from 'do_web_gantt.GanttController';
import view_registry from 'web.view_registry';
import GanttView from 'web_gantt.GanttView';

console.log('GanttView loaded');
const MassGanttView = GanttView.extend({
    config: Object.assign({}, GanttView.prototype.config, {
        Controller: DoGanttController,
    })
});
view_registry.add('do_gantt', MassGanttView);
export default MassGanttView;





manifest

    'assets': {
        'web._assets_primary_variables': [
            'do_web_gantt/static/src/scss/web_gantt.variables.scss',
        ],
        'web.assets_backend': [
            'do_web_gantt/static/src/**/*',
            'do_web_gantt/static/src/xml/**/*',
        ],
    },



But the button still not showing in the gantt view



Note : yes. this is edited because the previous case looks like hard. or at least I think it's hard because there is no example. but this one have example and I don't know why it doesn't work



アバター
破棄
最善の回答

Please try this xml template it will help you to get the button. 

   

       

           

                New Button

           

       

   

アバター
破棄
関連投稿 返信 ビュー 活動
0
5月 19
3103
1
2月 19
7971
1
3月 15
4525
1
12月 23
3008
1
7月 22
3877