跳至内容
菜单
此问题已终结

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;

    }

});


形象
丢弃
相关帖文 回复 查看 活动
0
3月 24
1015
3
10月 24
2684
4
5月 25
8712
2
12月 24
6069
3
4月 24
5561