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

odoo.define('vad_base_extend.basic_fields', function (require) {    
"use strict";
    var BasicField = require('web.basic_fields');    
var StateSelectionWidget = BasicField.StateSelectionWidget;    console.log("Hello")    
var VADStateSelectionWidget = StateSelectionWidget.include({        _prepareDropdownValues: function () {            
console.log("Hello 01")            
var _data = [];                        
_.map(this.field.selection || [], function (selection_item) {                
var value = {                    
'name': selection_item[0],                    
'tooltip': selection_item[1],                };               
 if (selection_item[0] === 'doing') {                    
value.state_class = 'vad_oe_project_kanban_legend vad_o_status_yellow';                    value.state_name = 'Đang thực hiện';                } 
else if (selection_item[0] === 'waiting') {                    
value.state_class = 'vad_oe_project_kanban_legend vad_o_status_blue';                    value.state_name = 'Chờ';                }
else if (selection_item[0] === 'ready_to_next') {                   
 value.state_class = 'vad_oe_project_kanban_legend vad_o_status_purple';                    value.state_name = 'Sẵn sàng chuyển giai đoạn';                }
 else if (selection_item[0] === 'done') {                   
 value.state_class = 'vad_oe_project_kanban_legend vad_o_status_green';                    value.state_name = 'Hoàn thành';                } 
else if (selection_item[0] === 'need_back') {                   
 value.state_class = 'vad_oe_project_kanban_legend vad_o_status_orange';                    value.state_name = 'Lùi giai đoạn';                } 
else if (selection_item[0] === 'blocked') {                    
value.state_class = 'vad_oe_project_kanban_legend vad_o_status_red';                    value.state_name = 'Hoãn';                } 
else if (selection_item[0] === 'cancel') {                   
 value.state_class = 'vad_oe_project_kanban_legend vad_o_status_grey';                    value.state_name = 'Huỷ';                } 
else {                    
value.state_class = 'vad_oe_project_kanban_legend vad_o_status_blue';                    value.state_name = 'Chờ';                }                    
_data.push(value);                       
     });                   
return _data;        },    });    
return VADStateSelectionWidget    });

I check the console log in my web just Hello, didn't show Hello 01 

Аватар
Відмінити
Найкраща відповідь

Hi,

 Try to use extend instead of include:const VADStateSelectionWidget = StateSelectionWidget.extend({

    /**

     * display the label next to the icon

     * @override

     */

    _render() {

        this._super.apply(this, arguments);

     }

     _prepareDropdownValues: function () {

     }          

});


Hope it helps

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
січ. 24
1722
1
вер. 23
3166
2
квіт. 23
5344
2
січ. 23
7832
get the model in js Вирішено
3
бер. 25
3737