Author: |
Sudokeys |
License: |
no license |
Branch: |
10.0_dev |
Repository: |
njeudy/web |
Dependencies: |
base,
and
web |
Languages: |
JavaScript (122, 58.7%),
Python (16, 7.7%),
XML (31, 14.9%),
and
reStructuredText (39, 18.8%) |
Other branches: |
saas-16,
and
web_template_v10 |
<p>Provide QWEB templating for formatting some fields.</p>
<p>Since version 8.0, this is less usefull as whole form can be templated.
But in list views, it's still very much constrained, and this module
make sense.</p>
<a name="form"></a>
<h2>Form</h2>
<a name="general-usage"></a>
<h3>General usage</h3>
<p>In forms, by specifying the correct <code>widget</code>, the XML content of the <code>field</code>
will then be interpreted by QWEB (the javascript version):</p>
<pre>
<code>...
<field name="foo" widget="many2one_template">
<!-- QWEB template, with 'record' being the m2o targetted record -->
</field>
...</code>
</pre>
<p>Depending on the widget, you'll get some environment variable already filled
with target data. For instance any <code>*2m</code> will receive <code>records</code> the list
of targetted values, and any <code>*2o</code> will receive <code>record</code> the targetted
value.</p>
<a name="widgets"></a>
<h3>Widgets</h3>
<p>These are the form widget available and the given template vars:</p>
<ul class="simple">
<li><code>one2many_template</code> with inner <code>records</code> variable.</li>
<li><code>many2one_template</code> with inner <code>record</code> variable.</li>
<li><code>many2many_template</code> with inner <code>records</code> variable.</li>
<li><code>template</code> with inner <code>value</code>.</li>
</ul>
<a name="list"></a>
<h2>List</h2>
<p>In list, there's only one widget called <code>template</code> and the XML content of the <code>field</code>
will then be interpreted by QWEB (the javascript version):</p>
<pre>
<code>...
<field name="foo" widget="template">
<!-- QWEB template, with 'value' being the value
- *2o: value is the target record.
- *2m: value is the array of records.
- other: value is the direct value
-->
</field>
...</code>
</pre>