Skip to Content
Menu

Mermaid Widget

by
Odoo
v 18.0 Third Party 242
Download for v 18.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 82
Technical Name web_widget_mermaid_field
LicenseLGPL-3
Versions 15.0 16.0 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 82
Technical Name web_widget_mermaid_field
LicenseLGPL-3
Versions 15.0 16.0 17.0 18.0

This modules add the Mermaid.js library to Odoo. Mermaid is a simple markdown-like script language for generating charts from text via JavaScript. It is used to create diagrams and flowcharts.

Create a Text field in a model and add the widget "mermaid" to the field.

mermaid_diagram = fields.Text('Mermaid Diagram', compute='_get_mermaid_diagram')
def _get_mermaid_diagram(self):
    for rec in self:
        rec.mermaid_diagram = """
        graph LR;
            A-->B;
            A-->C;
            B-->D;
            C-->D;
        """
<field name="mermaid_diagram" widget="mermaid"/>

To update the initialization configuration of the mermaid library, you can add it to the options attribute of the field.

<field name="mermaid_diagram" widget="mermaid" options="{'theme': 'dark'}"/>
Mermaid Widget Screenshot

Available options: 'mermaid_scroll_x', 'division_ration'

Can be used to have a horizontal scroll bar for the diagram.

<group>
    <field colspan="2" nolabel="1" name="mermaid_diagram" widget="mermaid" options="{'mermaid_scroll_x': True, 'division_ration': 1.5}"/>
</group>
        
Mermaid Widget Screenshot

To update the library, you can download the latest minified version and replace the file in the module.

Contributing:

If you're interested in contributing, please visit the GitHub repository @ github.com/VictorHachard/odoo-modules

Issue:

If you encounter any issues, please visit the GitHub repository issue section @ github.com/VictorHachard/odoo-modules/issues

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.