Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
2088 Vues


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
Ignorer
Meilleure réponse

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

   

       

           

                New Button

           

       

   

Avatar
Ignorer
Publications associées Réponses Vues Activité
0
mai 19
3103
1
févr. 19
7971
1
mars 15
4525
1
déc. 23
3007
1
juil. 22
3877