-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] web_editor, website: handle date edition in all lang and format
Before d00c0e3, `Datetime` fields would be editable in frontend but would have unexpected results, especially in non-English languages, for when the english lang format had been changed. It would also crash when saving non-English strings, such as `Lundi`. For more details, see odoo#44484 (comment) Since d00c0e3, only date displayed in lang format would be editable, which case is Event page in Odoo 12.0. Everywhere else, the format is changed for a nicer layout, either with `widget=XXX` or `t-options=YYY`, such as: `<time t-field="record.date" t-options='{"format": "MMM d, yyyy"}'/>` `<time t-field="record.date" t-options="{'time_only': 'true', 'format': 'short'}"/>` When a date parsing crashes during editor save, the problem is not only that the date can be saved, but the whole changes of the page are lost, as they won't be saved either. This commit attempts to fix every languages cases, regardless of the website lang or user lang. To do so, we store the date in the user lang format in a data attribute of every date field in the DOM. Once the field is clicked (to edit probably), that value will replace the one displayed according to the widget/options. That way, dates will always be sent to the server in the user lang format, avoiding any possible mismatch. This whole fix apply to `Datetime` and `Date` fields. opw-2183055 Closes odoo#44484 Closes odoo#45555 Fixes odoo#44047 Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com> Co-authored-by: Romain Derie <rde@odoo.com> Co-authored-by: Jeremy Kersten <jke@odoo.com>
- Loading branch information
Showing
3 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters