Browse Source

[IMP] reviews

pull/173/head
Holger Brunn 9 years ago
parent
commit
e2409f48a2
  1. 10
      web_search_datetime_completion/README.rst
  2. 3
      web_search_datetime_completion/static/src/js/web_search_datetime_completion.js

10
web_search_datetime_completion/README.rst

@ -3,18 +3,18 @@
More completion options for datetime fields More completion options for datetime fields
=========================================== ===========================================
This module was written to extend the offers shown to the user when starting to fill in a date. In standard odoo, the only offer is the date at 00:00:00 hours, while it can be convenient for the user to have other options, too. When searching for the end of a period, `23:59:59` would come to mind, and there also might be domain specific times that make sense.
This module was written to extend the offers shown to the user when starting to fill in a date. In standard odoo, the only offer is the date at 00:00:00 hours, while it can be convenient for the user to have other options, too. When searching for the end of a period, ``23:59:59`` would come to mind, and there also might be domain specific times that make sense.
Configuration Configuration
============= =============
If you do nothing, only the time `23:59:59` is added to the completion dropdown.
If you do nothing, only the time ``23:59:59`` is added to the completion dropdown.
In your code, you can add an options dictionary with a key `completion_options` which contains a list if dictionaries detailing the offsets that should be added to the parsed date, like::
In your code, you can add an options dictionary with a key ``completion_options`` which contains a list if dictionaries detailing the offsets that should be added to the parsed date, like::
<field name="my_datetime_field" options="{'completion_options': [{'hours': 12, 'minutes': 30, 'seconds': 0}]}" /> <field name="my_datetime_field" options="{'completion_options': [{'hours': 12, 'minutes': 30, 'seconds': 0}]}" />
which would offer to search for the date at half past twelve. Note that when you set `completion_options`, you have to list all options you want to see, as the standard options will be replaced with your list.
which would offer to search for the date at half past twelve. Note that when you set ``completion_options``, you have to list all options you want to see, as the standard options will be replaced with your list.
Usage Usage
===== =====
@ -54,4 +54,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

3
web_search_datetime_completion/static/src/js/web_search_datetime_completion.js

@ -57,7 +57,8 @@ openerp.web_search_datetime_completion = function(instance)
date, self.attrs); date, self.attrs);
options.push({ options.push({
label: _.str.sprintf(_.str.escapeHTML( label: _.str.sprintf(_.str.escapeHTML(
_t("Search %(field)s at: %(value)s")), {
instance.web._t("Search %(field)s at: %(value)s")),
{
field: _.str.sprintf( field: _.str.sprintf(
'<em>%s</em>', '<em>%s</em>',
_.escape(self.attrs.string)), _.escape(self.attrs.string)),

Loading…
Cancel
Save