Ir al contenido
Menú
Se marcó esta pregunta

Here is my code , i want that my button actes like an activation button so after clicking on it i want to change its style and put class="btn btn-primary" instead of "btn btn-secondary" 





 


/** @odoo-module **/


import { ListController } from '@web/views/list/list_controller';

import { patch } from '@web/core/utils/patch';

import { useService } from '@web/core/utils/hooks';


let isChecked = false; // Définition en dehors de la fonction setup


patch(ListController.prototype,{

    setup() {

        super.setup(...arguments);

        this._action = useService("action");

        this.isChecked = isChecked;

    },


    display_archives() {

        if (this.isChecked){

            this._action.doAction({

                type: "ir.actions.act_window",

                name: "Cahiers des charges archivés",

                domain: [["jours_restants", "=", 0]],

                views: [[false, "list"], [false, "form"]],

                res_model: "bp.cdc",

                target: 'self',

                view_mode: "list,form"

            });

        }else {

            this._action.doAction({

                type: "ir.actions.act_window",

                name: "Cahiers des charges en cours",

                domain: [["jours_restants", "!=", 0]],

                views: [[false, "list"], [false, "form"]],

                res_model: "bp.cdc",

                target: 'self',

                view_mode: "list,form"

            });

        }

        isChecked = !isChecked;

        this.isChecked = !this.isChecked;

    }

});


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 24
691
3
oct 24
2263
4
may 25
7490
2
dic 24
5175
3
abr 24
4642