Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
1333 Prikazi

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 

Avatar
Opusti
Best Answer

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

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
jan. 24
1072
1
sep. 23
2325
2
apr. 23
4351
2
jan. 23
6882
3
mar. 25
2842