Skip to main content

Allows to define a default time on datetime picker

Project description

Odoo Community Association

Web Datetime Picker Default Time

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

This module customizes the datetime picker widget and allows to define a default time to be applied in case the user selects only a Date.

For example, if a user wants to define a commitment date without having to specify the time on that date, setting the default time value on the field in the Form view allows to ensure the commitment date will be set to this time instead of the time when the page was loaded by the browser.

Table of contents

Usage

Static Default Time You can define the default time as follows for a static value For widget="datetime":

<field name="your_datetime_field" widget="datetime" options="{'defaultTime': {'hour': 8, 'minute': 30, 'second': 15 }}"/>

For widget="daterange":

<field name="your_start_datetime_field" widget="datetime" options="{'end_date_field': 'your_end_datetime_field', 'defaultStartTime': {'hour': 2, 'minute': 22, 'second': 22,}, 'defaultEndTime': {'hour': 3, 'minute': 33, 'second': 33,}}"/>

Dynamic Default Time Otherwise you can also use a JSON field to make it dynamic through a compute function, and reference this field in the view:

start_time = field.Json(compute="_compute_start_time")

def _compute_start_time(self):
    for rec in self:
        rec.start_time = {'hour': 8, 'minute': 30, 'second': 15 }
<field name="start_time" invisible="1" />
<field name="your_datetime_field" options="{'defaultTime': 'start_time'}"/>

Known issues / Roadmap

  • Handle Timezone related to the default time

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Camptocamp

Contributors

Other credits

The migration of this module from 16.0 to 18.0 was financially supported by Camptocamp.

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

grindtildeath

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_web_datetime_picker_default_time-18.0.1.0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_web_datetime_picker_default_time-18.0.1.0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2661624781bd90de9cb54e624290eec862655ae04ecb1b6be479d866a985d4e
MD5 c833302234f45a26ad45188054d978fa
BLAKE2b-256 8688d846da849efdb3aa62fdb530e2134c6bc7ad42a3d3e8c6ecb93b5e204191

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page