TheOdemMove
TheOdemMove

Reputation: 43

How to change field input border color in odoo 16.0?

In the 16th version of Odoo, for some reason, my input field became transparent.

It can be found if you know approximately where it is located and click on it with the mouse, and then only the lower border of the stroke of this field will appear:

what does it look like now

Unfortunately, I could not find options in Odoo 16 how to do this correctly.

My solution at the moment now looks like this, I painted over the form in a different color, and fill the color of the input fields with white, I don’t think this is the right option.

<form delete="false" default_order="name" style="background-color:#DDDDE4;">
    <field name="title" style="background-color:#ff0000;" placeholder="title"/>
    <field name="body" widget="html" style="background-color:#FFFFFF;" placeholder="body"/>
</form>`

what does my solution look like

This is my temporary solution, but I'm not sure if it's correct.

Upvotes: 0

Views: 1376

Answers (2)

TheOdemMove
TheOdemMove

Reputation: 43

Perhaps someone will need it. It`s working for me.

My page XML:

<form delete="false" default_order="name">
    <field name="title"/>
</form>

My page.py:

from odoo import fields, models

class InfoPageSection(models.Model):
    _name = "my_module.page.section"
    title = fields.Char("Title", required=True, index=True)

My manifest.py:

'assets': {
        'web.assets_common': [
            ('prepend', 'my_module/static/src/css/mycss.css'),
        ], },

Upvotes: 2

Shahid Raza
Shahid Raza

Reputation: 56

The Solution is add a custom CSS file and override the field CSS

the best location for the custom CSS file module_name -> static -> src -> css -> css_file.css

for example add a border on input fields at the lower side the put css

.o_form_view .o_input {
    padding: 2px 4px;
    border-bottom: 1px solid #000 !important;
}

Note: this CSS is only for Char fields

Upvotes: 3

Related Questions