forked from OCA/server-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix template description being indented
[FIX] Use human name and english category name for manifest [IMP] multi line notes, unprefix names, pep8 py files [IMP] whitespace cleanup in templates [FIX] base models get _name, custom get _inherit add missing spaces
- Loading branch information
Vincent Vinet
authored and
Maxime Chambreuil
committed
Oct 9, 2015
1 parent
d44e189
commit dbbd49d
Showing
9 changed files
with
98 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{% extends "header.template" %} | ||
{% block body %} | ||
{% if models -%} | ||
{% if models %} | ||
|
||
from . import models | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} |
35 changes: 24 additions & 11 deletions
35
module_prototyper/templates/8.0/models/model_name.py.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %} |
41 changes: 23 additions & 18 deletions
41
module_prototyper/templates/8.0/views/model_menus.xml.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<openerp> | ||
<data> | ||
{% for menu in menus -%} | ||
<record id="action_{{ menu.action.name }}_{{ menu.action.view_type }}_view" model="{{ menu.action.type }}"> | ||
<field name="name">{{ menu.action.name }}</field> | ||
<field name="type">{{ menu.action.type }}</field> | ||
<field name="res_model">{{ 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> | ||
{% 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_{{ menu.action.name }}_{{ menu.action.view_type }}_view" | ||
name="{{ menu.name }}" | ||
id="menu_action_{{ menu.name|replace('.', '_') }}_{{ menu.action.view_type }}" | ||
{% if menu.parent_id %}parent="{{ menu.parent_id.get_xml_id(cr,1,1).values()[0] }}"{% endif %} | ||
sequence="{{ menu.sequence }}" | ||
groups="{% for group in menu.groups_id %}{{ group.get_xml_id(cr,1,1).values()[0] }},{% endfor %}" | ||
/> | ||
{% endfor -%} | ||
<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(cr,1,1).values()[0] }}"{% endif %} | ||
sequence="{{ menu.sequence }}" | ||
groups="{% for group in menu.groups_id %}{{ group.get_xml_id(cr,1,1).values()[0] }},{% endfor %}" | ||
/> | ||
{% if not loop.last %} | ||
|
||
{% endif %} | ||
{% endfor %} | ||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters