Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2079 Vizualizări


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



Imagine profil
Abandonează
Cel mai bun răspuns

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

   

       

           

                New Button

           

       

   

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
mai 19
3099
1
feb. 19
7965
1
mar. 15
4524
1
dec. 23
3006
1
iul. 22
3875