1+ .. image :: https://odoo-community.org/readme-banner-image
2+ :target: https://odoo-community.org/get-involved?utm_source=readme
3+ :alt: Odoo Community Association
4+
15===============
26Web Form Banner
37===============
@@ -7,13 +11,13 @@ Web Form Banner
711 !! This file is generated by oca-gen-addon-readme !!
812 !! changes will be overwritten. !!
913 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10- !! source digest: sha256:abc8ad462d827f2f1b07f5fed63fe06f86ee2a9121f5a0c0e77f1ae8607ef8f1
14+ !! source digest: sha256:1906dbf6835e99a279704d8927db5c2e74b3583721880d44069dc0e1f9cfe84c
1115 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1216
1317.. |badge1 | image :: https://img.shields.io/badge/maturity-Beta-yellow.png
1418 :target: https://odoo-community.org/page/development-status
1519 :alt: Beta
16- .. |badge2 | image :: https://img.shields.io/badge/licence -AGPL--3-blue.png
20+ .. |badge2 | image :: https://img.shields.io/badge/license -AGPL--3-blue.png
1721 :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1822 :alt: License: AGPL-3
1923.. |badge3 | image :: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
@@ -58,42 +62,42 @@ Usage
5862Usage of message fields:
5963------------------------
6064
61- - **Message ** (message): Text shown in the banner. Supports
62- ${placeholders} filled from values returned by message_value_code.
63- Ignored if message_value_code returns an html value.
64- - **HTML ** (message_is_html): If enabled, the message string is
65- rendered as HTML; otherwise it's treated as plain text.
66- - **Message Value Code ** (message_value_code): Safe Python expression
67- evaluated per record. Return a dict such as {"visible": True,
68- "severity": "warning", "values": {"name": record.name}}. Use either
69- message or html (from this code), not both. Several evaluation
70- context variables are available.
65+ - **Message ** (message): Text shown in the banner. Supports
66+ ${placeholders} filled from values returned by message_value_code.
67+ Ignored if message_value_code returns an html value.
68+ - **HTML ** (message_is_html): If enabled, the message string is rendered
69+ as HTML; otherwise it's treated as plain text.
70+ - **Message Value Code ** (message_value_code): Safe Python expression
71+ evaluated per record. Return a dict such as {"visible": True,
72+ "severity": "warning", "values": {"name": record.name}}. Use either
73+ message or html (from this code), not both. Several evaluation context
74+ variables are available.
7175
7276Evaluation context variables available in Message Value Code:
7377-------------------------------------------------------------
7478
75- - \` env\` : Odoo environment for ORM access.
76- - \` user\` : Current user (env.user).
77- - \` ctx\` : Copy of the current context (dict(env.context)).
78- - \` record\` : Current record (the form's record).
79- - \` draft\` : The persisted field values of the ORM record (before
80- applying the current form's unsaved changes) + the current unsaved
81- changes on trigger fields. Should be used instead of record when your
82- rule is triggered dynamically by an update to a trigger field. It
83- doesn't include any values from complex fields (one2many/reference,
84- etc).
85- - \` record_id\` : Integer id of the record being edited, or False if the
86- form is creating a new record.
87- - \` model\` : Shortcut to the current model (env[record._name]).
88- - \` url_for(obj): Helper that returns a backend form URL for \` obj.
89- - \` context_today(ts=None)\` : User-timezone “today” (date) for reliable
90- date comparisons.
91- - time, \` datetime\` : Standard Python time/datetime modules.
92- - \` dateutil\` : { "parser": dateutil.parser, "relativedelta":
93- dateutil.relativedelta }
94- - \` timezone\` : pytz.timezone for TZ handling.
95- - float_compare, float_is_zero, \` float_round\` : Odoo float utils for
96- precision-safe comparisons/rounding.
79+ - \` env\` : Odoo environment for ORM access.
80+ - \` user\` : Current user (env.user).
81+ - \` ctx\` : Copy of the current context (dict(env.context)).
82+ - \` record\` : Current record (the form's record).
83+ - \` draft\` : The persisted field values of the ORM record (before
84+ applying the current form's unsaved changes) + the current unsaved
85+ changes on trigger fields. Should be used instead of record when your
86+ rule is triggered dynamically by an update to a trigger field. It
87+ doesn't include any values from complex fields (one2many/reference,
88+ etc).
89+ - \` record_id\` : Integer id of the record being edited, or False if the
90+ form is creating a new record.
91+ - \` model\` : Shortcut to the current model (env[record._name]).
92+ - \` url_for(obj): Helper that returns a backend form URL for \` obj.
93+ - \` context_today(ts=None)\` : User-timezone “today” (date) for reliable
94+ date comparisons.
95+ - time, \` datetime\` : Standard Python time/datetime modules.
96+ - \` dateutil\` : { "parser": dateutil.parser, "relativedelta":
97+ dateutil.relativedelta }
98+ - \` timezone\` : pytz.timezone for TZ handling.
99+ - float_compare, float_is_zero, \` float_round\` : Odoo float utils for
100+ precision-safe comparisons/rounding.
97101
98102All of the above are injected by the module to the safe_eval locals.
99103
@@ -116,19 +120,19 @@ Message setting examples:
116120
117121**A) Missing email on contact (warning) **
118122
119- - Model: res.partner
120- - Message: This contact has no email.
121- - Message Value Code:
123+ - Model: res.partner
124+ - Message: This contact has no email.
125+ - Message Value Code:
122126
123127.. code :: python
124128
125129 {" visible" : not bool (record.email)}
126130
127131 **B) Show partner comment if available **
128132
129- - Model: purchase.order
130- - Message: Vendor Comments: ${comment}
131- - Message Value Code (single expression):
133+ - Model: purchase.order
134+ - Message: Vendor Comments: ${comment}
135+ - Message Value Code (single expression):
132136
133137.. code :: python
134138
@@ -149,9 +153,9 @@ explicit values key:
149153
150154 **C) High-value sale order (dynamic severity) **
151155
152- - Model: sale.order
153- - Message: High-value order: ${amount_total}
154- - Message Value Code:
156+ - Model: sale.order
157+ - Message: High-value order: ${amount_total}
158+ - Message Value Code:
155159
156160.. code :: python
157161
@@ -163,9 +167,9 @@ explicit values key:
163167
164168 **D) Quotation past validity date **
165169
166- - Model: sale.order
167- - Message: This quotation is past its validity date (${validity_date}).
168- - Message Value Code:
170+ - Model: sale.order
171+ - Message: This quotation is past its validity date (${validity_date}).
172+ - Message Value Code:
169173
170174.. code :: python
171175
@@ -176,9 +180,9 @@ explicit values key:
176180
177181 **E) Pending activities on a task (uses \` env\` ) **
178182
179- - Model: project.task
180- - Message: There are ${cnt} pending activities.
181- - Message Value Code (multi-line with result):
183+ - Model: project.task
184+ - Message: There are ${cnt} pending activities.
185+ - Message Value Code (multi-line with result):
182186
183187.. code :: python
184188
@@ -187,10 +191,10 @@ explicit values key:
187191
188192 **F) Product is missing internal reference (uses trigger fields) **
189193
190- - Model: product.template
191- - Trigger Fields: default_code
192- - Message: Make sure to set an internal reference!
193- - Message Value Code:
194+ - Model: product.template
195+ - Trigger Fields: default_code
196+ - Message: Make sure to set an internal reference!
197+ - Message Value Code:
194198
195199.. code :: python
196200
@@ -199,10 +203,10 @@ explicit values key:
199203 **G) HTML banner linking to the customer's last sales order (uses
200204trigger fields) **
201205
202- - Model: sale.order
203- - Trigger Fields: partner_id
204- - Message: (leave blank; html provided by Message Value Code)
205- - Message Value Code (multi-line with result):
206+ - Model: sale.order
207+ - Trigger Fields: partner_id
208+ - Message: (leave blank; html provided by Message Value Code)
209+ - Message Value Code (multi-line with result):
206210
207211.. code :: python
208212
@@ -249,15 +253,15 @@ may render distorted.
249253Limitations of draft eval context variable
250254------------------------------------------
251255
252- - draft is always available in the eval context, but for new records
253- (record_id = False) it only contains the trigger fields from the
254- banner rules.
255- - For existing records, draft overlays the trigger field values on top
256- of the persisted record; all other fields come from Model.new
257- defaults rather than the database.
258- - Only simple field types are included: char, text, html, selection,
259- boolean, integer, float, monetary, date, datetime, many2one, and
260- many2many. **one2many/reference/other types are omitted. **
256+ - draft is always available in the eval context, but for new records
257+ (record_id = False) it only contains the trigger fields from the
258+ banner rules.
259+ - For existing records, draft overlays the trigger field values on top
260+ of the persisted record; all other fields come from Model.new defaults
261+ rather than the database.
262+ - Only simple field types are included: char, text, html, selection,
263+ boolean, integer, float, monetary, date, datetime, many2one, and
264+ many2many. **one2many/reference/other types are omitted. **
261265
262266Bug Tracker
263267===========
@@ -280,10 +284,10 @@ Authors
280284Contributors
281285------------
282286
283- - `Quartile <https://www.quartile.co >`__:
287+ - `Quartile <https://www.quartile.co >`__:
284288
285- - Yoshi Tashiro
286- - Aung Ko Ko Lin
289+ - Yoshi Tashiro
290+ - Aung Ko Ko Lin
287291
288292Maintainers
289293-----------
0 commit comments