diff --git a/module_prototyper/models/default_description.py b/module_prototyper/models/default_description.py
index 42e6bce20..2aedf2428 100644
--- a/module_prototyper/models/default_description.py
+++ b/module_prototyper/models/default_description.py
@@ -61,8 +61,8 @@ For further information, please visit:
* https://www.odoo.com/forum/help-1
-Roadmap
-=======
+Known issues / Roadmap
+======================
* ...
diff --git a/module_prototyper/models/module_prototyper.py b/module_prototyper/models/module_prototyper.py
index 5dd33ca1d..6cc7e6c5a 100644
--- a/module_prototyper/models/module_prototyper.py
+++ b/module_prototyper/models/module_prototyper.py
@@ -25,10 +25,9 @@ import lxml.etree
import os
import re
import textwrap
-import base64
-from datetime import date
from collections import namedtuple
+from datetime import date
from jinja2 import Environment, FileSystemLoader
@@ -82,15 +81,15 @@ class ModulePrototyper(models.Model):
description = fields.Text(
'Description',
required=True,
- help=('Enter the description of your module, what it does, how to'
- 'install, configure and use it, the roadmap or known issues.'
+ help=('Enter the description of your module, what it does, how to '
+ 'install, configure and use it, the roadmap or known issues. '
'The description will be exported in README.rst'),
default=get_default_description
)
author = fields.Char('Author', required=True, help=('Enter your name'))
maintainer = fields.Char(
'Maintainer',
- help=('Enter the name of the person or organization who will'
+ help=('Enter the name of the person or organization who will '
'maintain this module')
)
website = fields.Char('Website', help=('Enter the URL of your website'))
@@ -120,7 +119,7 @@ class ModulePrototyper(models.Model):
'ir.module.module', 'module_prototyper_module_rel',
'module_prototyper_id', 'module_id',
'Dependencies',
- help=('Enter the list of required modules that need to be installed'
+ help=('Enter the list of required modules that need to be installed '
'for your module to work properly')
)
data_ids = fields.Many2many(
@@ -140,34 +139,34 @@ class ModulePrototyper(models.Model):
field_ids = fields.Many2many(
'ir.model.fields', 'prototype_fields_rel',
'module_prototyper_id', 'field_id', 'Fields',
- help=('Enter the list of fields that you have created or modified'
- 'and want to export in this module. New models will be'
+ help=('Enter the list of fields that you have created or modified '
+ 'and want to export in this module. New models will be '
'exported as long as you choose one of his fields.')
)
menu_ids = fields.Many2many(
'ir.ui.menu', 'prototype_menu_rel',
'module_prototyper_id', 'menu_id', 'Menu Items',
- help=('Enter the list of menu items that you have created and want'
- 'to export in this module. Related windows actions will be'
+ help=('Enter the list of menu items that you have created and want '
+ 'to export in this module. Related windows actions will be '
'exported as well.')
)
view_ids = fields.Many2many(
'ir.ui.view', 'prototype_view_rel',
'module_prototyper_id', 'view_id', 'Views',
- help=('Enter the list of views that you have created and want to'
+ help=('Enter the list of views that you have created and want to '
'export in this module.')
)
group_ids = fields.Many2many(
'res.groups', 'prototype_groups_rel',
'module_prototyper_id', 'group_id', 'Groups',
- help=('Enter the list of groups that you have created and want to'
+ help=('Enter the list of groups that you have created and want to '
'export in this module.')
)
right_ids = fields.Many2many(
'ir.model.access', 'prototype_rights_rel',
'module_prototyper_id', 'right_id',
'Access Rights',
- help=('Enter the list of access rights that you have created and'
+ help=('Enter the list of access rights that you have created and '
'want to export in this module.')
)
rule_ids = fields.Many2many(
diff --git a/module_prototyper/templates/8.0/__init__.py.template b/module_prototyper/templates/8.0/__init__.py.template
index 82452828d..384a9cd45 100644
--- a/module_prototyper/templates/8.0/__init__.py.template
+++ b/module_prototyper/templates/8.0/__init__.py.template
@@ -1,6 +1,7 @@
{% extends "header.template" %}
{% block body %}
-{% if models -%}
+{% if models %}
+
from . import models
{% endif %}
{% endblock %}
diff --git a/module_prototyper/templates/8.0/__openerp__.py.template b/module_prototyper/templates/8.0/__openerp__.py.template
index 23d1125cb..5c8e687ec 100644
--- a/module_prototyper/templates/8.0/__openerp__.py.template
+++ b/module_prototyper/templates/8.0/__openerp__.py.template
@@ -1,17 +1,18 @@
{% extends "header.template" %}
{% block body %}
+
{
- 'name': '{{ prototype.name }}',
+ '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
+ # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml # noqa
# for the full list
- 'category': '{{ prototype.category_id.name }}',
+ 'category': '{{ prototype.with_context({}).category_id.name }}',{# In english please! #}
'summary': '{{ prototype.summary }}',
'description': """
{{ prototype.description }}
@@ -23,33 +24,36 @@
# any module necessary for this one to work correctly
'depends': [
- {% for dependency in prototype.dependency_ids -%}
+ {% for dependency in prototype.dependency_ids %}
'{{ dependency.name }}',
- {% endfor -%}],
+ {% endfor %}
+ ],
'external_dependencies': {
'python': [],
},
-
+
# always loaded
'data': [
- {% for data_file in data_files -%}
+ {% for data_file in data_files %}
'{{ data_file }}',
- {% endfor -%}],
+ {% endfor %}
+ ],
# only loaded in demonstration mode
'demo': [
- {% for demo_file in prototype.demo_ids -%}
+ {% for demo_file in prototype.demo_ids %}
'{{ demo_file.name }}',
- {% endfor -%}],
-
+ {% endfor %}
+ ],
+
# used for Javascript Web CLient Testing with QUnit / PhantomJS
- # https://www.odoo.com/documentation/8.0/reference/javascript.html#testing-in-odoo-web-client
+ # https://www.odoo.com/documentation/8.0/reference/javascript.html#testing-in-odoo-web-client # noqa
'js': [],
'css': [],
'qweb': [],
'installable': True,
- # Install this module automatically if all dependency have been previously and independently installed.
- # Used for synergetic or glue modules.
+ # 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 }},
}
diff --git a/module_prototyper/templates/8.0/header.template b/module_prototyper/templates/8.0/header.template
index 2e6251e7b..c09b2426b 100644
--- a/module_prototyper/templates/8.0/header.template
+++ b/module_prototyper/templates/8.0/header.template
@@ -19,4 +19,5 @@
# along with this program. If not, see .
#
##############################################################################
-{% block body %}{% endblock %}
\ No newline at end of file
+{% block body %}
+{% endblock %}
diff --git a/module_prototyper/templates/8.0/models/__init__.py.template b/module_prototyper/templates/8.0/models/__init__.py.template
index caf9d7c74..8e1a1083d 100644
--- a/module_prototyper/templates/8.0/models/__init__.py.template
+++ b/module_prototyper/templates/8.0/models/__init__.py.template
@@ -1,6 +1,9 @@
{% extends "header.template" %}
{% block body %}
-{% for model in models -%}
+{% for model in models %}
+{% if loop.first %}
+
+{% endif %}
from . import {{ model }}
{% endfor %}
{% endblock %}
diff --git a/module_prototyper/templates/8.0/models/model_name.py.template b/module_prototyper/templates/8.0/models/model_name.py.template
index 8f8ff5378..b35202d38 100644
--- a/module_prototyper/templates/8.0/models/model_name.py.template
+++ b/module_prototyper/templates/8.0/models/model_name.py.template
@@ -1,22 +1,35 @@
{% extends "header.template" %}
{% block body %}
+
from openerp import models, fields
from openerp.tools.translate import _
-class {{ name }}(models.Model):
- _inherit = "{{ inherit }}"
- {% if description -%}_description = "{{ description }}"{% endif %}
+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 -%}
- {% if field.notes -%}# {{ field.notes }}{% endif %}
- {{ field.name }} = fields.{{ field.ttype|capitalize }}(
+ {% 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 %}
-
+ readonly={{ field.readonly }}
+ {% if field.size %}
+ size={{ field.size }},
+ {% endif %}
+ {% if field.helper %}
+ help=_("{{ field.helper }}"),
+ {% endif %}
+ )
+ {% endfor %}
{% endblock %}
diff --git a/module_prototyper/templates/8.0/views/model_menus.xml.template b/module_prototyper/templates/8.0/views/model_menus.xml.template
index 642a682d8..e8067ecaa 100644
--- a/module_prototyper/templates/8.0/views/model_menus.xml.template
+++ b/module_prototyper/templates/8.0/views/model_menus.xml.template
@@ -1,24 +1,29 @@
- {% for menu in menus -%}
-
+ {% for menu in menus %}
+
-
- {% endfor -%}
+
+ {% if not loop.last %}
+
+ {% endif %}
+ {% endfor %}
diff --git a/module_prototyper/templates/8.0/views/model_views.xml.template b/module_prototyper/templates/8.0/views/model_views.xml.template
index b919abea7..218ec67df 100644
--- a/module_prototyper/templates/8.0/views/model_views.xml.template
+++ b/module_prototyper/templates/8.0/views/model_views.xml.template
@@ -2,22 +2,16 @@
-
- {% for view in views -%}
-
- {{ view.name }}.view
- {{ view.model }}
- {{ view.type }}
-
-
- {# the arch given by odoo start with an xml tag that
- will break the xml tree we build.
- Be careful, custom field have a x_ prefix that has to be
- removed
- #}
- {{ view.arch|replace('"', "'")|replace("", "")|replace("'x_", "'")|replace("> ", "/>") }}
-
-
+ {% for view in views %}
+
+ {{ unprefix(view.name) }}.view
+ {{ unprefix(view.model) }}
+ {{ view.type }}
+
+
+ {{ fixup_arch(view.arch) }}
+
+
{% endfor %}