I define an ir.ui.view as follows:
<record id="product_view_extension" model="ir.ui.view">
<field name="name">Product View Extension</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
...
Inside the body of `arch`, I wish to iterate through a data structure generated on the server side. Here is a pseudo code of what I want on the server side:
p = the product.template being shown in ir.ui.view
result = []
for price_list in p.price_lists
result.append(price_list.do_some_calculation())
make result available for view
However, for the case of `ir.ui.view`, there is no controller involved, so I don't know how to make `result` available for the view.
Ultimately I want to be able to do something like this in the view:
<t t-foreach="result" t-as="dict">
<div>
<span t-field="dict.field" />
</div>
</t>
Whereas `result` is the array generated above, and `hash` is a plain old Python dictionary.
This type of stuff is very simple to do in frameworks like Rails and Laravel, however, I can't figure out how to do it in Odoo.
Hmm, this feels unlogical. Why don't you simply create a field in the model which is computed on the moment the view opens?