You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

63 lines
1.7 KiB

{% extends "header.template" %}
{% block body %}
from openerp import models, fields
from openerp.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) %}
{% if line %}
# {{line}}
{% else %}
#
{% endif %}
{% endfor %}
{{ unprefix(field.name) }} = fields.{{ field.ttype|capitalize }}(
string=_("{{ field.field_description }}"),
{% if field.selection %}
selection={{ selection }},
{% endif %}
{% if field.relation %}
comodel_name="{{ field.relation }}",
{% endif %}
{% if field.column1 %}
column1="{{ field.column1 }}",
{% endif %}
{% if field.column2 %}
column1="{{ field.column2 }}",
{% endif %}
required={{ field.required }},
translate={{ field.translate }},
readonly={{ field.readonly }},
{% if field.size %}
size={{ field.size }},
{% endif %}
{% if field.domain %}
domain={{ field.domain }},
{% endif %}
{% if field.context %}
context={{ field.context }},
{% endif %}
{% if field.limit %}
limit={{ field.limit }},
{% endif %}
{% if field.ttype == 'many2one' and field.on_delete %}
on_delete="{{ field.on_delete }}",
{% endif %}
{% if field.helper %}
help=_("{{ field.helper }}"),
{% endif %}
)
{% endfor %}
{% endblock %}