Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1019 Переглядів

Hi , so firtly i defined a basic button "btn-secondary" on my xml file and then i added this javascript function that call an action onclick , i want to change the text inside the button and change its color so it can look like primary btn once it's clicked :

/** @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;


patch(ListController.prototype,{
setup() {
super.setup(...arguments);
this._action = useService("action");
this.isChecked = isChecked;
},

display_archives() {
isChecked = !isChecked;
this.isChecked = isChecked;

if (this.isChecked == true){
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 if(this.isChecked == false){
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"
});
}
}
});


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 24
1312
3
жовт. 24
2689
4
трав. 25
8728
2
груд. 24
6081
3
квіт. 24
5583