Nicolas JEUDY
5 years ago
17 changed files with 201 additions and 48 deletions
-
5module_prototyper/data/module_prototyper_api_version_data.xml
-
41module_prototyper/models/module_prototyper.py
-
7module_prototyper/templates/12.0/__init__.py.template
-
54module_prototyper/templates/12.0/__manifest__.py.template
-
6module_prototyper/templates/12.0/data/model_name.xml.template
-
6module_prototyper/templates/12.0/demo/model_name.xml.template
-
4module_prototyper/templates/12.0/header.template
-
9module_prototyper/templates/12.0/models/__init__.py.template
-
35module_prototyper/templates/12.0/models/model_name.py.template
-
4module_prototyper/templates/12.0/security/ir.model.access.csv.template
-
8module_prototyper/templates/12.0/security/model_name.xml.template
-
27module_prototyper/templates/12.0/views/model_menus.xml.template
-
15module_prototyper/templates/12.0/views/model_views.xml.template
-
4module_prototyper/tests/test_prototype.py
-
4module_prototyper/tests/test_prototype_module_export.py
-
6module_prototyper/views/module_prototyper_view.xml
-
14module_prototyper/wizard/module_prototyper_module_export.py
@ -0,0 +1,7 @@ |
|||
{% extends "header.template" %} |
|||
{% block body %} |
|||
{% if models %} |
|||
|
|||
from . import models |
|||
{% endif %} |
|||
{% endblock %} |
@ -0,0 +1,54 @@ |
|||
{% extends "header.template" %} |
|||
{% block body %} |
|||
|
|||
{ |
|||
'name': '{{ prototype.human_name }}', |
|||
'version': '{{ prototype.version }}', |
|||
'author': '{{ prototype.author }}', |
|||
'maintainer': '{{ prototype.maintainer }}', |
|||
'website': '{{ prototype.website }}', |
|||
'license': '{{ prototype.licence }}', |
|||
|
|||
# Categories can be used to filter modules in modules listing |
|||
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml # noqa |
|||
# for the full list |
|||
'category': '{{ prototype.with_context({}).category_id.name }}',{# In english please! #} |
|||
'summary': '{{ prototype.summary }}', |
|||
'description': """ |
|||
{{ prototype.description }} |
|||
""", |
|||
|
|||
# any module necessary for this one to work correctly |
|||
'depends': [ |
|||
{% for dependency in prototype.dependency_ids %} |
|||
'{{ dependency.name }}', |
|||
{% endfor %} |
|||
], |
|||
'external_dependencies': { |
|||
'python': [], |
|||
}, |
|||
|
|||
# always loaded |
|||
'data': [ |
|||
{% for data_file in data_files %} |
|||
'{{ data_file }}', |
|||
{% endfor %} |
|||
], |
|||
# only loaded in demonstration mode |
|||
'demo': [ |
|||
{% for demo_file in prototype.demo_ids %} |
|||
'{{ demo_file.name }}', |
|||
{% endfor %} |
|||
], |
|||
|
|||
'js': [], |
|||
'css': [], |
|||
'qweb': [], |
|||
|
|||
'installable': True, |
|||
# Install this module automatically if all dependency have been previously |
|||
# and independently installed. Used for synergetic or glue modules. |
|||
'auto_install': {{ prototype.auto_install }}, |
|||
'application': {{ prototype.application }}, |
|||
} |
|||
{% endblock %} |
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
{{ data }} |
|||
|
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
{{ demo }} |
|||
|
|||
</odoo> |
@ -0,0 +1,4 @@ |
|||
# Copyright {{ export_year }} {% if author %}{{ author }}{% endif %} ({% if website %}({{ website }}).{% endif %}) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
{% block body %} |
|||
{% endblock %} |
@ -0,0 +1,9 @@ |
|||
{% extends "header.template" %} |
|||
{% block body %} |
|||
{% for model in models %} |
|||
{% if loop.first %} |
|||
|
|||
{% endif %} |
|||
from . import {{ model }} |
|||
{% endfor %} |
|||
{% endblock %} |
@ -0,0 +1,35 @@ |
|||
{% extends "header.template" %} |
|||
{% block body %} |
|||
|
|||
from odoo import models, fields |
|||
from odoo.tools.translate import _ |
|||
|
|||
|
|||
class {{ unprefix(name) }}(models.Model): |
|||
{% if model.state == 'base' %} |
|||
_name = "{{ model.model }}" |
|||
{% else %} |
|||
_inherit = "{{ model.model }}" |
|||
{% endif %} |
|||
{% if description %} |
|||
_description = "{{ description }}" |
|||
{% endif %} |
|||
|
|||
{% for field in fields %} |
|||
{% for line in wrap(field.notes, replace_whitespace=False) %} |
|||
# {{line}} |
|||
{% endfor %} |
|||
{{ unprefix(field.name) }} = fields.{{ field.ttype|capitalize }}( |
|||
string=_("{{ field.field_description }}"), |
|||
required={{ field.required }}, |
|||
translate={{ field.translate }}, |
|||
readonly={{ field.readonly }} |
|||
{% if field.size %} |
|||
size={{ field.size }}, |
|||
{% endif %} |
|||
{% if field.helper %} |
|||
help=_("{{ field.helper }}"), |
|||
{% endif %} |
|||
) |
|||
{% endfor %} |
|||
{% endblock %} |
@ -0,0 +1,4 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
{% for rule in access_rules %} |
|||
{{ rule.id }},{{ rule.name }},{{ rule.model_id.id }},{{ rule.group_id.id }},{{ rule.perm_write }},{{ rule.perm_write }},{{ rule.perm_create }},{{ rule.perm_unlink }} |
|||
{% endfor %} |
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
|
|||
{{ groups }} |
|||
|
|||
{{ rules }} |
|||
|
|||
</odoo> |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
{% for menu in menus %} |
|||
<record id="action_{{ menu.action.name }}_{{ menu.action.view_type }}_view" model="{{ menu.action.type }}"> |
|||
<field name="name">{{ unprefix(menu.action.name) }}</field> |
|||
<field name="type">{{ menu.action.type }}</field> |
|||
<field name="res_model">{{ unprefix(menu.action.res_model) }}</field> |
|||
<field name="view_type">{{ menu.action.view_type }}</field> |
|||
<field name="view_mode">{{ menu.action.view_mode }}</field> |
|||
{% if menu.action.help %} |
|||
<field name="help" type="html">{{ menu.action.help }} |
|||
</field> |
|||
{% endif %} |
|||
</record> |
|||
|
|||
<menuitem action="action_{{ unprefix(menu.action.name) }}_{{ menu.action.view_type }}_view" |
|||
name="{{ menu.name }}" |
|||
id="menu_action_{{ unprefix(menu.name)|replace('.', '_') }}_{{ menu.action.view_type }}" |
|||
{% if menu.parent_id %}parent="{{ menu.parent_id.get_xml_id().values()[0] }}"{% endif %} |
|||
sequence="{{ menu.sequence }}" |
|||
groups="{% for group in menu.groups_id %}{{ group.get_xml_id().values()[0] }},{% endfor %}" |
|||
/> |
|||
{% if not loop.last %} |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
</odoo> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0"?> |
|||
<odoo> |
|||
<!-- TODO: put here a reminder on what to do at the first edition --> |
|||
{% for view in views %} |
|||
<record id="{{ unprefix(view.name)|replace('.', '_')}}_view" model="ir.ui.view"> |
|||
<field name="name">{{ unprefix(view.name) }}.view</field> |
|||
<field name="model">{{ unprefix(view.model) }}</field> |
|||
<field name="view_type">{{ view.type }}</field> |
|||
<field name="inherit_id" ref="{{ view.inherit_id.get_xml_id().values()[0] }}"/> |
|||
<field name="arch" type="xml"> |
|||
{{ fixup_arch(view.arch) }} |
|||
</field> |
|||
</record> |
|||
{% endfor %} |
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue