Browse Source

[ADD] allow hiding controls via options on the widget

pull/480/head
Holger Brunn 8 years ago
parent
commit
d4e5116b4b
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 2
      field_rrule/README.rst
  2. 4
      field_rrule/static/src/xml/field_rrule.xml

2
field_rrule/README.rst

@ -23,6 +23,8 @@ Technically, this is a wrapper around serialized fields. The value always will b
If you want to pass a default, use the internal representation you'll find in the database - a list of dictionaries with the keyword arguments to be passed to rrule's constructor and a `type` field that for now can only be `rrule`: A context of ``{"default_rrule": [{"count": 1, "freq": 1, "type": "rrule", "interval": 1, "bymonthday": [1]}]}`` would give you a default for the field ``rrule`` which occurs one time at the first of the month. If you want to pass a default, use the internal representation you'll find in the database - a list of dictionaries with the keyword arguments to be passed to rrule's constructor and a `type` field that for now can only be `rrule`: A context of ``{"default_rrule": [{"count": 1, "freq": 1, "type": "rrule", "interval": 1, "bymonthday": [1]}]}`` would give you a default for the field ``rrule`` which occurs one time at the first of the month.
In case you work with defaults and want to dumb down the UI a bit, use ``{'no_add_rule': true}``.
Further, as this is a serialized field, a value of `not set` will be represented in the database as ``'null'`` - this is then also what you have to search for when you need records with your field unset. Further, as this is a serialized field, a value of `not set` will be represented in the database as ``'null'`` - this is then also what you have to search for when you need records with your field unset.
Known issues / Roadmap Known issues / Roadmap

4
field_rrule/static/src/xml/field_rrule.xml

@ -1,11 +1,11 @@
<template> <template>
<div t-name="FieldRRule" class="oe_form_field_rrule"> <div t-name="FieldRRule" class="oe_form_field_rrule">
<div t-if="!widget.get('effective_readonly')">
<div t-if="!widget.get('effective_readonly') and !widget.options.no_add_rule">
<a class="oe_link add_rule">Add instance</a> <a class="oe_link add_rule">Add instance</a>
</div> </div>
<form t-foreach="widget.get('value')" t-as="rule" class="rule_item"> <form t-foreach="widget.get('value')" t-as="rule" class="rule_item">
<table t-if="rule.type == 'rrule'" class="rule_item" t-att-data-id="rule.__id"> <table t-if="rule.type == 'rrule'" class="rule_item" t-att-data-id="rule.__id">
<tr t-if="!widget.get('effective_readonly')">
<tr t-if="!widget.get('effective_readonly') and !widget.options.no_add_rule">
<td colspan="2" class="rule_header"> <td colspan="2" class="rule_header">
<a class="oe_link rule_remove" title="Remove this rule"><i class="fa fa-times" /></a> <a class="oe_link rule_remove" title="Remove this rule"><i class="fa fa-times" /></a>
</td> </td>

Loading…
Cancel
Save