Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions web_widget_mermaid/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
========================
Mermaid flowchart widget
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:136879c1f5cb11ecd5f2466b0b12748e10fa17e1a95bd0bc9296316444760a86
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/18.0/web_widget_mermaid
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_mermaid
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a basic widget for rendering text fields as flowcharts
using `mermaid <https://mermaidjs.github.io>`__.

**Table of contents**

.. contents::
:local:

Usage
=====

Put a ``widget="mermaid"`` attribute in relevant field tags in the view
declaration:

.. code:: xml

<field name="flowchart" widget="mermaid" />

Optionally, use an ``options`` attribute to pass a JSON object with
`mermaid
configuration <https://mermaid.js.org/config/schema-docs/config.html>`__:

.. code:: xml

<field
name="flowchart"
widget="mermaid"
options="{'theme': 'forest', 'gantt': {'fontSize': 14}}"
/>

A specific ``options`` keyword has been added to enable Odoo theming

.. code:: xml

<field name="flowchart" widget="mermaid" options="{'odoo_theme': true}" />

The syntax for creating diagrams is described in `mermaid's
documentation <https://mermaid.js.org/syntax/flowchart.html>`__.

As an example, this text:

::

graph LR
10.0 --> 11.0
11.0 --> 12.0
12.0 -.-> 13.0

Produces this flowchart:

|Flowchart|

Demonstration
-------------

In demo mode, the addon adds a flowchart field to users so you can try
it. This shows up in Runbot instances.

.. |Flowchart| image:: https://github.com/OCA/web/18.0/web_widget_mermaid/static/description/flowchart_example.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_mermaid%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Therp BV

Contributors
------------

- Jan Verbeek <jverbeek@therp.nl>
- RoboHeart <heart4robots@gmail.com>
- Yann Papouin <ypa@decgroupe.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_widget_mermaid>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_widget_mermaid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
23 changes: 23 additions & 0 deletions web_widget_mermaid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

{
"name": "Mermaid flowchart widget",
"category": "Web",
"author": "Therp BV,Odoo Community Association (OCA)",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"summary": "Render mermaid markdown flowcharts",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"demo": [
"demo/res_users_flowchart.xml",
],
"assets": {
"web.assets_backend": [
"web_widget_mermaid/static/src/scss/web_widget_mermaid.scss",
"web_widget_mermaid/static/src/js/web_widget_mermaid.esm.js",
"web_widget_mermaid/static/src/xml/web_widget_mermaid.xml",
],
},
}
62 changes: 62 additions & 0 deletions web_widget_mermaid/demo/res_users_flowchart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.model.fields" id="res_users_flowchart1">
<field name="name">x_flowchart1</field>
<field name="model_id" ref="base.model_res_users" />
<field name="field_description">Demo mermaid flowchart #1</field>
<field name="ttype">char</field>
</record>
<record model="ir.model.fields" id="res_users_flowchart2">
<field name="name">x_flowchart2</field>
<field name="model_id" ref="base.model_res_users" />
<field name="field_description">Demo mermaid flowchart #2</field>
<field name="ttype">char</field>
</record>
<record model="ir.model.fields" id="res_users_flowchart3">
<field name="name">x_flowchart3</field>
<field name="model_id" ref="base.model_res_users" />
<field name="field_description">Demo mermaid flowchart #3</field>
<field name="ttype">char</field>
</record>
<record model="ir.ui.view" id="view_users_form_flowchart">
<field name="name">res.users.form.flowchart@web_widget_mermaid</field>
<field name="inherit_id" ref="base.view_users_form" />
<field name="model">res.users</field>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page name="mermaid_page" string="Mermaid flowchart">
<p>Default widget</p>
<field name="x_flowchart1" widget="mermaid" />
<p>Widget with Odoo theme</p>
<field
name="x_flowchart2"
widget="mermaid"
options="{'odoo_theme': true}"
/>
<p>Widget with custom theme</p>
<field
name="x_flowchart3"
widget="mermaid"
options="{
'themeVariables': {
'primaryColor': '#FF0000',
'textColor': '#0000FF'
}
}"
/>
</page>
</xpath>
</field>
</record>
<record model="res.users" id="base.user_demo">
<field name="x_flowchart1">graph TD
A[This is an example flowchart] --> B{{Edit it}}
B -. save it .-> C(See what happens)</field>
<field name="x_flowchart2">graph TD
A[This is an example flowchart] --> B{{Edit it}}
B -. save it .-> C(See what happens)</field>
<field name="x_flowchart3">graph TD
A[This is an example flowchart] --> B{{Edit it}}
B -. save it .-> C(See what happens)</field>
</record>
</odoo>
27 changes: 27 additions & 0 deletions web_widget_mermaid/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_mermaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-02-17 13:45+0000\n"
"Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: web_widget_mermaid
#: model:ir.model.fields,field_description:web_widget_mermaid.res_users_flowchart
msgid "Demo mermaid flowchart"
msgstr "Diagrama de flux de sirena de demostració"

#. module: web_widget_mermaid
#: model_terms:ir.ui.view,arch_db:web_widget_mermaid.view_users_form_flowchart
msgid "Mermaid flowchart"
msgstr "Diagrama de flux de sirena"
27 changes: 27 additions & 0 deletions web_widget_mermaid/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_mermaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-09-16 14:00+0000\n"
"Last-Translator: claudiagn <claudia.gargallo@qubiq.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"

#. module: web_widget_mermaid
#: model:ir.model.fields,field_description:web_widget_mermaid.res_users_flowchart
msgid "Demo mermaid flowchart"
msgstr "Diagrama de flujo de sirena de demostración"

#. module: web_widget_mermaid
#: model_terms:ir.ui.view,arch_db:web_widget_mermaid.view_users_form_flowchart
msgid "Mermaid flowchart"
msgstr "Diagrama de flujo de sirena"
27 changes: 27 additions & 0 deletions web_widget_mermaid/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_mermaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-02-01 12:44+0000\n"
"Last-Translator: Yann Papouin <y.papouin@dec-industrie.com>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: web_widget_mermaid
#: model:ir.model.fields,field_description:web_widget_mermaid.res_users_flowchart
msgid "Demo mermaid flowchart"
msgstr "Organigramme de démonstration Mermaid"

#. module: web_widget_mermaid
#: model_terms:ir.ui.view,arch_db:web_widget_mermaid.view_users_form_flowchart
msgid "Mermaid flowchart"
msgstr "Organigramme Mermaid"
27 changes: 27 additions & 0 deletions web_widget_mermaid/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_mermaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-15 06:45+0000\n"
"Last-Translator: Marcel Savegnago <marcel.savegnago@gmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: web_widget_mermaid
#: model:ir.model.fields,field_description:web_widget_mermaid.res_users_flowchart
msgid "Demo mermaid flowchart"
msgstr "Fluxograma de demonstração do mermaid"

#. module: web_widget_mermaid
#: model_terms:ir.ui.view,arch_db:web_widget_mermaid.view_users_form_flowchart
msgid "Mermaid flowchart"
msgstr "Fluxograma Mermaid"
25 changes: 25 additions & 0 deletions web_widget_mermaid/i18n/web_widget_mermaid.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_mermaid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: web_widget_mermaid
#: model:ir.model.fields,field_description:web_widget_mermaid.res_users_flowchart
msgid "Demo mermaid flowchart"
msgstr ""

#. module: web_widget_mermaid
#: model_terms:ir.ui.view,arch_db:web_widget_mermaid.view_users_form_flowchart
msgid "Mermaid flowchart"
msgstr ""

3 changes: 3 additions & 0 deletions web_widget_mermaid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions web_widget_mermaid/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Jan Verbeek \<jverbeek@therp.nl\>
- RoboHeart \<heart4robots@gmail.com\>
- Yann Papouin \<ypa@decgroupe.com\>
2 changes: 2 additions & 0 deletions web_widget_mermaid/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds a basic widget for rendering text fields as flowcharts
using [mermaid](https://mermaidjs.github.io).
Loading