This extension for StarUML(http://staruml.io) support to generate Odoo code from UML model. Install this extension from Extension Manager of StarUML.
Understanding UML diagrams: https://creately.com/blog/diagrams/class-diagram-relationships/
Please check here for detailed installtion process of the extension:
https://docs.staruml.io/user-guide/managing-extensions
- Click the menu (
Tools > Odoo > Generate Code...) - Select a base model (or package) that will be generated to Odoo.
- Select a folder where generated Odoo source files (.py) will be placed.
Belows are the rules to convert from UML model elements to Odoo source codes.
- create an attributed called
_nameon the class - set the name on
defaultValuefield, egmodule.classname
- if the object is inherted from other object create a attribute called
_inherit - the parent object is set on
defaultValuefield, egres.partner
- set the Odoo field type on
typefield - Example
Char()will be converted tofields.Char(),Integer()tofields.Integer()
- The
Documentationfield will bo converted tohelp=attribute
- converted to a python Package (as a folder with
__init__.py).
- converted to a python Class definition as a separated module (
.py). documentationproperty to docstring
- converted to a python class inherited from Enum as a separated module (
.py). - literals converted to class variables
- converted to an instance variable
nameproperty to identifierdocumentationproperty to docstring- If
multiplicityis one of0..*,1..*,*, then the variable will be initialized with:0..*or1..*: fields.One2Many()1: fields.Many2one()*: fields.Many2many()
- converted to an instance method if
isStaticproperty is true, or a class method (@classmethod) ifisStaticproperty is false nameproperty to identifierdocumentationproperty to docstring- UMLParameter to method parameter
- converted to inheritance