[MIG] web_widget_datepicker_fulloptions: Migration to 16.0

pull/2738/head
Quentin Dupont 2024-02-02 13:46:16 +01:00
parent c4c9d5dfcd
commit ab82cd7402
9 changed files with 41 additions and 57 deletions

View File

@ -7,7 +7,7 @@ Web Widget DatePicker Full Options
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3c167f165dee6be58d095c8341832721bc688418cb356dfbb644665fd8ed6a90
!! source digest: sha256:5cc5388c1796a804d92121313d4d48a9080f3173acf9dbafe6b2da73f9ae2241
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@ -17,22 +17,25 @@ Web Widget DatePicker Full Options
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/14.0/web_widget_datepicker_fulloptions
:target: https://github.com/OCA/web/tree/16.0/web_widget_datepicker_fulloptions
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_datepicker_fulloptions
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_datepicker_fulloptions
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module enables full options in datepicker used in date fields :
- Choose today's date in one click
- Three buttons enabled : show today, clear field, close datepicker
- Two buttons enabled : choosing today and closing datepicker with selected date
.. figure:: https://raw.githubusercontent.com/OCA/web/14.0/web_widget_datepicker_fulloptions/static/description/change.png
.. figure:: https://raw.githubusercontent.com/OCA/web/16.0/web_widget_datepicker_fulloptions/static/description/change.png
Clearing field doesn't work because there is a left 'todo' in Odoo core code
here : https://github.com/odoo/odoo/blob/16.0/addons/web/static/lib/tempusdominus/tempusdominus.js#L1341
**Table of contents**
@ -45,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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 <https://github.com/OCA/web/issues/new?body=module:%20web_widget_datepicker_fulloptions%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_datepicker_fulloptions%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -77,6 +80,6 @@ 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.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/web_widget_datepicker_fulloptions>`_ project on GitHub.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_widget_datepicker_fulloptions>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Web Widget DatePicker Full Options",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"author": "GRAP, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Web",
@ -11,7 +11,10 @@
"depends": [
"web",
],
"data": [
"views/web_widget_datepicker_fulloptions_assets.xml",
],
"assets": {
"web.assets_backend": [
"web_widget_datepicker_fulloptions/static/src/js/"
"web_widget_datepicker_fulloptions.esm.js"
],
},
}

View File

@ -1,5 +1,8 @@
This module enables full options in datepicker used in date fields :
- Choose today's date in one click
- Three buttons enabled : show today, clear field, close datepicker
- Two buttons enabled : choosing today and closing datepicker with selected date
.. figure:: ../static/description/change.png
Clearing field doesn't work because there is a left 'todo' in Odoo core code
here : https://github.com/odoo/odoo/blob/16.0/addons/web/static/lib/tempusdominus/tempusdominus.js#L1341

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -367,15 +367,17 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3c167f165dee6be58d095c8341832721bc688418cb356dfbb644665fd8ed6a90
!! source digest: sha256:5cc5388c1796a804d92121313d4d48a9080f3173acf9dbafe6b2da73f9ae2241
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/14.0/web_widget_datepicker_fulloptions"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_datepicker_fulloptions"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_widget_datepicker_fulloptions"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_datepicker_fulloptions"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module enables full options in datepicker used in date fields :
- Choose todays date in one click
- Three buttons enabled : show today, clear field, close datepicker</p>
- Two buttons enabled : choosing today and closing datepicker with selected date</p>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/web/14.0/web_widget_datepicker_fulloptions/static/description/change.png" src="https://raw.githubusercontent.com/OCA/web/14.0/web_widget_datepicker_fulloptions/static/description/change.png" />
<img alt="https://raw.githubusercontent.com/OCA/web/16.0/web_widget_datepicker_fulloptions/static/description/change.png" src="https://raw.githubusercontent.com/OCA/web/16.0/web_widget_datepicker_fulloptions/static/description/change.png" />
</div>
<p>Clearing field doesnt work because there is a left todo in Odoo core code
here : <a class="reference external" href="https://github.com/odoo/odoo/blob/16.0/addons/web/static/lib/tempusdominus/tempusdominus.js#L1341">https://github.com/odoo/odoo/blob/16.0/addons/web/static/lib/tempusdominus/tempusdominus.js#L1341</a></p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@ -393,7 +395,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_datepicker_fulloptions%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_datepicker_fulloptions%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -420,7 +422,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_widget_datepicker_fulloptions">OCA/web</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_widget_datepicker_fulloptions">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -0,0 +1,11 @@
/* @odoo-module */
import {DatePicker} from "@web/core/datepicker/datepicker";
Object.assign(DatePicker.defaultProps, {
buttons: {
showClear: true,
showClose: true,
showToday: true,
},
});

View File

@ -1,23 +0,0 @@
/* Copyright 2021 Quentin DUPONT
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
odoo.define(
"web_widget_datepicker_fulloptions.datepicker_fulloptions",
function (require) {
"use strict";
var DatePicker = require("web.datepicker");
DatePicker.DateWidget.include({
/**
* @override
*/
init: function (parent, options) {
this._super(parent, options);
this.options.useCurrent = true;
this.options.buttons.showToday = true;
this.options.buttons.showClear = true;
this.options.buttons.showClose = true;
},
});
}
);

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="web_widget_datepicker_fulloptions_assets_backend"
name="web_widget_datepicker_fulloptions_assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/web_widget_datepicker_fulloptions/static/src/js/web_widget_datepicker_fulloptions.js"
/>
</xpath>
</template>
</odoo>