Skip to Content
मेन्यू
This question has been flagged


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



Avatar
Discard
Best Answer

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

   

       

           

                New Button

           

       

   

Avatar
Discard
Related Posts Replies Views Activity
0
मई 19
3098
1
फ़र॰ 19
7961
1
मार्च 15
4523
1
दिस॰ 23
3004
1
जुल॰ 22
3875