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
_name
on the class - set the name on
defaultValue
field, egmodule.classname
- if the object is inherted from other object create a attribute called
_inherit
- the parent object is set on
defaultValue
field, egres.partner
- set the Odoo field type on
type
field - Example
Char()
will be converted tofields.Char()
,Integer()
tofields.Integer()
- The
Documentation
field 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
). documentation
property 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
name
property to identifierdocumentation
property to docstring- If
multiplicity
is 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
isStatic
property is true, or a class method (@classmethod
) ifisStatic
property is false name
property to identifierdocumentation
property to docstring- UMLParameter to method parameter
- converted to inheritance