Skip to Content
Menu
This question has been flagged

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

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 23
2575
1
Apr 24
2301
1
May 24
1734
1
Mar 24
2266
2
Jul 23
3597