Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1862 Lượt xem

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 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 24
1502
1
thg 9 23
2911
2
thg 4 23
5004
2
thg 1 23
7531
get the model in js Đã xử lý
3
thg 3 25
3423