コンテンツへスキップ
メニュー
この質問にフラグが付けられました

im inheriting the color_picker from odoo to create a new widget because i need to show specific color only, but on the original color_picker, there are no brown and gray color. is there anyone knows how to add more color? i need to add brown and gray


this below is my javascript code
/** @odoo-module */

import { registry } from "@web/core/registry";

import { ColorPickerField } from "@web/views/fields/color_picker/color_picker_field"

import { Component } from "@odoo/owl";

import { _lt } from "@web/core/l10n/translation";


class CustomColorPickerField extends ColorPickerField {

    setup(){

        super.setup()

        console.log("Email Field Inherited")

    }

    get canToggle() {

        return this.props.record.activeFields[this.props.name].viewType !== "list";

    }


    get isExpanded() {

        return !this.canToggle && !this.props.readonly;

    }


    switchColor(colorIndex) {

        this.props.update(colorIndex);

    }

}


CustomColorPickerField.supportedTypes = ["Integer"]

CustomColorPickerField.RECORD_COLORS = [0, 1, 4, 11, 10, 12];


registry.category("fields").add("custom_color_picker", CustomColorPickerField);

im also still very new in javascript so this is all new for me

アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 23
2855
1
4月 24
2540
1
5月 24
2031
1
3月 24
2615
2
7月 23
3904