Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: MIS Builder

Entity: mis.report.style

Compute Method: _compute_description

Inputs Method Outputs
for style in self:
            descriptions = {}
            for prop in PROPS:
                if getattr(style, f"{prop}_inherit"):
                    continue
                else:
                    value = getattr(style, prop)
                    if prop in ["color", "background_color"]:
                        value = (
                            "<span style='"
                            f"background-color: {value};"
                            " width: 15px;"
                            " height: 15px;"
                            " display: inline-block;"
                            " border: 1px black solid;"
                            " border-radius: 5px;"
                            "' />"
                        )
                    elif prop in ["font_weight", "font_style"]:
                        value = (
                            f"<span style='"
                            f"{prop.replace('_', '-')} : {value};"
                            f"'>{value}</span>"
                        )
                    elif prop in ["prefix", "suffix"]:
                        value = f"'<code>{value}</code>'"
                    descriptions[style._fields[prop].string] = value

            description = " ; ".join([f"{k} : {v}" for k, v in descriptions.items()])
            style.description = f"<div>{description}</div>"

Back to entity