flectra/addons/digest/wizard/digest_custom_fields_view.xml

64 lines
3.1 KiB
XML

<?xml version="1.0"?>
<flectra>
<record id="digest_custom_fields_view_form" model="ir.ui.view">
<field name="name">digest.custom.fields.form</field>
<field name="model">digest.custom.fields</field>
<field name="arch" type="xml">
<form string="Customized Digest">
<group col="4">
<field name="field_name"/>
<field name="label_name"/>
<field name="available_group_name" required="1"/>
<field name="position" required="1"/>
<field name="new_group_name" attrs="{'required': [('position', '!=', 'inside')], 'invisible': [('position', 'not in', ['before', 'after'])]}"/>
</group>
<group>
<label for="model_id"/>
<div>
<field name="model_id" options="{'no_create': True}" required="1"/>
<field name="model_name" invisible="1"/>
<field name="model_real" invisible="1"/>
<field name="model_domain" widget="domain"
options="{'model': 'model_real'}"/>
</div>
</group>
<group>
<field name="related_date_field_id" options="{'no_create': True}" domain="[('model', '=', model_real), ('ttype', 'in', ['date', 'datetime'])]" required="1"/>
</group>
<notebook>
<page string="Compute Details">
<group>
<field name="compute_field_name"/>
<field name="ttype"/>
<field name="compute" widget="ace" options="{'mode': 'python'}"/>
</group>
</page>
<page string="Help">
<h3>How to define a computed field</h3>
<div class="alert alert-info" role="alert">
The field <code>Compute</code> is the Python code to compute the value of the field on a set of records.
The value of the field must be assigned to each record with a dictionary-like assignment.
<pre>
for record in self:
record['size'] = len(record.name)</pre>
</div>
</page>
</notebook>
<footer>
<button name="action_add_customize_digest" string="Save" type="object" class="btn btn-sm btn-primary"/>
<button string="Cancel" class="btn btn-sm btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="digest_custom_fields_action" model="ir.actions.act_window">
<field name="name">Customized Digest</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">digest.custom.fields</field>
<field name="view_mode">form</field>
<field name="view_id" ref="digest_custom_fields_view_form"/>
<field name="target">new</field>
</record>
</flectra>