Commit Graph
509 Commits
Author SHA1 Message Date
Adrien Widart 5a499ecf11 [FIX] website_form: cancel records creation if error
When running an automated action on record creation, if the action
raises a UserError/ValidationError, the record will still be created.

To reproduce the error:
(Need website_crm,base_automation. Enable debug mode)
1. Create an Automated Action
    - Model: Lead/Opportunity
    - Trigger: On Creation & Update
    - Trigger Fields: Phone (crm.lead)
    - Action To Do: Execute Python Code
    - Python Code:
    ```python
    if record.phone:
        raise UserError("Lorem ipsum")
    ```
2. On website, add a website form WF
    - Action: "Create an Opportunity"
3. Complete and submit WF including a phone number

Error: An error message is displayed ("Lorem ispum"). However, the lead
has been created and is present in CRM Pipeline.

An on-creation automated action is executed once the record is executed,
but nothing will cancel this records creation if the action raises a
UserError/ValidationError.

OPW-2423948

closes odoo/odoo#69911

X-original-commit: 8d452ae16b7e6c3077d9eae135852bada43cec93
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-04-27 11:32:26 +00:00
shreya thakrar e4cace7115 [IMP] mail, test_mail, website_(form,sale): rename no_auto_thread field
PURPOSE

Rename fields on mail_thread and wizard: ``no_auto_thread`` should be replaced
to ``reply_to_force_new`` to ease understanding and be prefixed by reply_to.

SPECIFICATIONS

For better understanding, this commit renames ``no_auto_thread`` field of
``mail.message`` model to ``reply_to_force_new``, to indicate that if the
field is checked (☑) replies should check gateway alias rules instead of
updating mailed threads.

It is also more coherent with reply_to namespacing used in various mail models
(notably new composer fields and ``reply_to_mode`` of mass mailing and mail
composer models)

LINKS

Task ID-2117639
COM PR odoo/odoo#40931
ENT PR odoo/enterprise#17941
UPG PR odoo/upgrade#2419
2021-04-26 13:53:42 +00:00
fja-odoo 04138cc3ad [FIX] website_form: remove dynamic values on save
This fix was not forward ported when introduced: #50745

closes odoo/odoo#68980

X-original-commit: 3e5130d90127d9634c48e5301e96ddcad9b66e17
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-04-08 14:38:25 +00:00
Julien Mougenot 3e3dce0eb8 [REF] *: rename assets 'glob' to 'path'
Rationale:
The majority of cases where an ir.asset is manually declared
outside of manifest files is to specifically add a single asset file.
This means developers are specifying a single asset *path*, and not a
glob expression. In this context, it seems better to name the filepath
field `path`, and document that it can be specified with a glob
expression when (seldom) needed, rather than making the exception appear
to be the norm - possibly puzzling many developers (What's a glob and
why do I need one?)

The doc is updated as well, and some spell-checking and wording
improvements were done too.

This required some adaptations to the existing `ir.asset` declarations:
- odoo/enterprise#17465
- odoo/design-themes#459

closes odoo/odoo#68695

Related: odoo/upgrade#2348
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-04-07 20:39:10 +00:00
740168ce8d [REF] web_editor, website_*, mass_mailing: adapt to Odoo Editor
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Emilien Durieu <edu@odoo.com>
2021-04-01 16:01:06 +00:00
Romain Derie 8fcf930a6b [IMP] web_editor, website, *: introduce popover as edit system for links
*: website_form

This commit introduces a simple & light popover/tooltip (as in Google Doc) when
editing a link.

It will be used:
1. (web_editor) On every page links.
2. (website) In the website navbar, when clicking on a menu, it will replace the
popup shown to ask the user what he wants to do (edit the menu or go to the link
or do nothing). That popup was a bit invasive and old-fashioned.

Part of https://github.com/odoo/odoo/pull/64756
task-2439860

closes odoo/odoo#64756

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-04-01 09:49:45 +00:00
Julien MougenotandSimon Genin 03641610c2 [REF] *: convert all modules to new asset system
Conversion of all modules to the new manifest assets declaration.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:18 +02:00
Samuel Degueldre be05ac7e2b [IMP] web_editor, website_form: introduce m2m UserValueWidget
This commit introduces a many2many as a standalone, reusable
UserValueWidget. This widget is built on top of the ListUserValueWidget
which was until now only used in website form that had to be updated to
allow more generic use of the widget.

Part of https://github.com/odoo/odoo/pull/67832
task-2274732
2021-03-25 09:26:53 +00:00
xO-Tx a06282903d [FIX] website_form: add support for redirection to anchors on submit
Part of https://github.com/odoo/odoo/pull/62206
task-2381305

X-original-commit: 49943014b0d16e2fed31d4601f76c471252e24c6
2021-03-04 16:25:12 +00:00
xO-Tx 6c8fea3c1e [FIX] website_form, *: allow to update buttons using link dialog
*: web_editor, website_mass_mailing

When we double click a link/button, a link dialog appears
to update the target properties, and since the current link dialog
can only handle anchor targets, using it on buttons leads to some
inconsistencies :

- visible href options for button & url required to save changes.
- missing preview when button style changed.
...

The goal of this commit is to add a fix (with minimum of code) on
summernote linkdialog to handle button elements using the same logic as
anchor nodes.

Also, update website form test tour to test those new changes.

Part of https://github.com/odoo/odoo/pull/62206
task-2381305

X-original-commit: 19fbbdc0327482b5d70bdbcf17c2a5a950327d63
2021-03-04 16:22:08 +00:00
qsm-odoo 0c24a46f9e [IMP] website_form: allow to choose default number with arrow keys
Part of https://github.com/odoo/odoo/pull/47949
task-2011583

closes odoo/odoo#47949

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-26 14:40:49 +00:00
qsm-odoo 25173a4c29 [FIX] website_form, *: remove "Shown on mobile" opt for hidden fields
*: website

Part of https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
qsm-odoo 0461714b95 [IMP] website_form: reorganize editor panel options
Part of https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
qsm-odoo 8f4c51df24 [IMP] website_form: allow to format form field descriptions
Part of https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
fja-odoo 0447f177ad [IMP] website_form: allow to add description to field
It is now possible to add a description to any field.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
fja-odoo 9ea276ae2f [IMP] website_form, *: allow form default input value
* = web_editor

Add support for default values on website form

Compatible fields are: textarea, text, number, date, datetime, unique
checkox, multiple checkboxes, radio buttons, select.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 14:40:49 +00:00
fja-odooandqsm-odoo 9304f8fa7b [REF] web_editor, *: make form list a UserValueWidget
* = website_form

The form we-list is now a generic UserValueWidget.

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583

Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-02-26 13:51:13 +00:00
fja-odoo 3a972e6a0e [REF] website_form: make placeholder use selectAttribute
Have the placeholder of website_form use the new selectAttribute method

Part of: https://github.com/odoo/odoo/pull/47949
task-2011583
2021-02-26 13:51:13 +00:00
Adrien Widart d2c9629a40 [FIX] website_form: display attachment on form web page
When submitting a ticket, if the user adds an attachement, he will not
be able to see it on the ticket web page.

To reproduce the error:
(Need helpdesk,contacts)
1. Go to the settings of a Helpdesk Team (e.g., "Customer Care")
2. Enable "Website Form", Refresh
3. Go on Helpdesk web page and Publish the form
4. Create a partner P and grant him the portal access
5. Sign in with P
6. Submit a ticket with one attachment
7. Consult the ticket's web page

Error: in "Message and communication history", OdooBot's message with
the attachment is not displayed. However, when consulting the
same page with the admin account, this message is considered as
"Published". Thus, P should see the message and the attachment.

When getting the messages, if the user is not an employee, the domain is
restricted:
https://github.com/odoo/odoo/blob/e92ac60a75462dfd830254a3d0dd5d7effe1528e/addons/portal/controllers/mail.py#L128-L130
with
https://github.com/odoo/odoo/blob/cc32b7d1b396a42dd4575c681ceb422f99b6015a/addons/portal/models/mail_message.py#L30-L32
Problem is that, when creating the message with the attachement,
`subtype_id` is not defined.

OPW-2440069

closes odoo/odoo#66906

X-original-commit: b05a72d3cc181c601807b5e633766d504e06bb3a
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-02-26 10:21:29 +00:00
qsm-odoo 4b2f5975fa [FIX] website_form: fix norecaptcha behavior
Adapt [1] to be a bit more robust.

[1]: https://github.com/odoo/odoo/commit/eb9373522628fa01c3503fa802ded23adc1cbe1f

closes odoo/odoo#66508

X-original-commit: 028ae76f3b53132ae5c1510a4285cc21fc120c76
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-18 20:29:14 +00:00
Nasreddin (bon) 3f1a31c498 [FIX] website_sale, *: display error message in "Extra Info" step
*: google_recaptcha, website_form

Issue

        - Install 'Ecommerce' module
        - In settings, fill the "reCAPTCHA: Easy on Humans, Hard
          on Bots" option with random wrong site key and secret key
        - Open your ecommerce (go to /shop )
        - Add any product to cart and and open cart
        - Activate "Customize -> Extra Step Option"
        - Process to "Extra Info" step
        - Click on next

        Stuck at this step since next button does not react.

Cause

        There is an error due to re-captcha feature that
        does not allowed to go to next step.

        The second issue is that the error is not displayed
        because missing message area in form.

Solution

        Do not check recaptcha if 's_website_form_no_recaptcha' class
        present in form.
        Add span 's_website_form_result' to display error messages.
        Replace 'public' by 'site' in error message to fit google
        'field' name.

opw-2456098

closes odoo/odoo#66493

X-original-commit: eb9373522628fa01c3503fa802ded23adc1cbe1f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-02-18 16:09:24 +00:00
nie 1db8e17ef7 [FIX] website_form: user dynamic fields without readonly attribute
Steps:
- Install studio, website_form
- Go to Settings > Users & Companies > Users
- Click the Studio icon
- On the top bar, click Website
- Click New Form
- In edition mode, click the first label
- Select Customize > Add an Existing Field

Bug:
Traceback here:
https://github.com/odoo/odoo/blob/3ff00944fe6a439bd5d7bddb846206d3d6cac3a0/addons/website_form/models/models.py#L73
KeyError: 'readonly'

Explanation:
Dynamic selection fields don't declare a 'readonly' attribute:
https://github.com/odoo/odoo/blob/3ff00944fe6a439bd5d7bddb846206d3d6cac3a0/odoo/addons/base/models/res_users.py#L1275-L1282

opw:2449356

closes odoo/odoo#65894

X-original-commit: 5a74dc2ca8aadb7d91d9cf7c047065fee3263ece
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-10 15:00:48 +00:00
qsm-odoo 5ab2771d30 [FIX] website_form: adapt editor list widget design
The design was not properly adapted to the last changes before the 14.0
release and still contained some invalid properties. Now the list inputs
match the design of the normal inputs.

closes odoo/odoo#64400

X-original-commit: fe102c04c0526cb7aa547f146974cdfb80629723
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-12 12:03:30 +00:00
Ivan Yelizariev 0a082d5574 [FIX] website_form: prevent adding lang prefix to form action url
STEPS:
* create fresh db with default lang fr_CH
* install website
* activate additional language, e.g. en_GB
* set for website only one available language: fr_CH
* for admin user set lang en_GB
* open website and add form

BEFORE: the form doesn't work, because action url is "/en_GB/website_form/"

AFTER: action url is not changed

WHY:

1.

``is_multilang_url`` returns ``True``, because there is no route ``/website_form/``

https://github.com/odoo/odoo/blob/0adcb9a09fe5714fe8479df9450ddcefa7ba0688/addons/http_routing/models/ir_http.py#L233-L244

2.

Model name in action is added after rendering only, this is why ``is_multilang_url`` is
called with ``/website_form/`` and not real url

https://github.com/odoo/odoo/blob/0adcb9a09fe5714fe8479df9450ddcefa7ba0688/addons/website_form/static/src/js/website_form.js#L144

3.

As result we get error on trying to make request ``/en_GB/website_form/mail.mail``

---

opw-2413960

closes odoo/odoo#64016

X-original-commit: e9e86e251b7e262c4fe9c71722c27cc69cc3b712
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-04 13:45:15 +00:00
qsm-odoo e5572c317a [REV] web_editor, *: remove Jabberwock
*: barcodes, mail, mass_mailing, note, test_website, web, web_tour,
   website, website_blog, website_event, website_form, website_forum,
   website_mail_channel, website_mass_mailing, website_profile,
   website_sale, website_twitter, doc

New solutions are being investigated in master. For the moment, it seems
better to remove Jabberwock to unlock difficult forward-port between
14.0 and 14.1/master, until we decide what to do once and for all in
a later master. We may un-revert this later but that would be way easier
than reverting Jabberwock in a few months.

This was done as safely as possible by removing any commit related to
Jabberwock, then resolving conflicts, then reforcing commits from 14.0
that were hugely adapted for 14.1/master, then forcing the whole diff
over a rebased 14.1/master. The only possible miss (other than me making
a mistake) would be commits that were not forward-ported to 14.1 thanks
to Jabberwock handling the issue on its own (I know we had such commits
in website, which I manually included in this revert, see below).

For reference:

Commits which were reforced to their 14.0 version:
- https://github.com/odoo/odoo/commit/1a916fc2362c0b006460d94a219366ade1cce058
- https://github.com/odoo/odoo/commit/fd9e58a675bb7ec1bf97cb77b21b3c65369d51fe
- https://github.com/odoo/odoo/commit/bdfddace29b16404c06a7ebfc0cc242463a0e768
- https://github.com/odoo/odoo/commit/42b3ad10e0b32b7fc72f801e2c67d6baf938c566
- https://github.com/odoo/odoo/commit/710784da1f02d45cbe898da426ba7e2ac63dc711
- https://github.com/odoo/odoo/commit/597585c9b8b1350bcfd84e8433ea6c82060bcc3d
- https://github.com/odoo/odoo/commit/333a9124608ff655bd9ad5e63044a5cb7ef9c636

Commits that were not forward-ported to 14.1/master and now are:
- https://github.com/odoo/odoo/commit/55ff2d971b672dec5f103215be39101c88856b6c
- https://github.com/odoo/odoo/commit/ebbb3de1e5f363689a5ba1647bb4c26416e42d5b

+ Adapt this forward-port: https://github.com/odoo/odoo/pull/60976 (as
  it was simplified for non-stable master version relying to the
  Jabberwock implementation and now needed to be adapted to the
  summernote implementation).
  See `!$el.data('oe-expression') && $el.data('oe-xpath')`

+ Revert https://github.com/odoo/odoo/pull/60477 and reforce original
  14.0 fix https://github.com/odoo/odoo/commit/746bf53b4aecfc601f0581a948d7cb7153812c82

Note: this also means that any good refactoring that was done by the
Jabberwock-related commits is lost for now. Once the revert reaches
master, I'll try and restore what we want from those commits. Here
are their references (but obviously they have the opposite conflicts
than those resolved during this revert):

e766842a92b6 [REM] web_editor,website: empty summernote files
08c94c986e09 [REF] web_editor,web: adapt to new jabberwock editor
1546c1b74713 [REF] mass_mailing: adapt to new jabberwock editor
fd0b963c6028 [REF] website: adapt to new jabberwock editor
0113d05c6c94 [ADD] web_editor: add new Jabberwock editor lib
d0c88a396493 [FIX] web_editor: don't change background color out of the website editor
d52d3d67d4e1 [FIX] web_editor : better icon in text style dropdown
61cb2f0d21da [FIX] web_editor: should not ask if want to leave the page twice
c42012b863b5 [FIX] web_editor: trigger a resize when use the mobile preview
d934d05d6e39 [FIX] web_editor: need to build the snippet before commit it into vDom
495bea924745 [FIX] web_editor: remove box shadow on the #wrap container
bffb5612e689 [ADD] field_html: add resizer in most field_html
f3c94e40cccf [IMP] web_editor: update Jabberwock library to commit 41e4063
cc87dea3ef32 [FIX] web_editor: update header change position to work with JW
5d9b25f66704 [FIX] web_editor: do not insert chars around step icon on click
70d3f0e4630c [IMP] web_editor: update Jabberwock library to commit 0bd94881
a57f13891f82 [FIX] web_editor: open media modal in appropriate tab on dblclick media
5b7537397e08 [IMP] web_editor: update Jabberwock library to commit a7ba7c34
a8d7ec235eeb [FIX] web_editor: adapt iframe Qunit test to new editor
5f794eac7209 [FIX] mass_mailing: hide all panels on show themes
551d45641d19 [IMP] website: remove unused reference
10580e1c102f [IMP] wesbite: add comment in tour
c17049f6b764 [FIX] web_editor: Fix description toggle in pricelist snippet
18a428e854b1 [IMP] web_editor: update Jabberwock library to commit 43a10003
58a161c645a5 [REF] web_editor, website: use editor helper setClass
62dd0bd3bc66 [FIX] web_editor: properly deactivate snippets and reactivate the last
99eebcaa34cb [FIX] web_editor: disable snippet in preview mode on mouse leave options
a84216932958 [FIX] web_editor: fix the image gallery snippet
f8dd4ea3e7d5 [FIX] web_editor: fix shadow selector for Safari
e50a4f3a16de [IMP] web_editor: update Jabberwock library to commit de13ed7e
4a2718f7a5ba [FIX] web_editor: ensure dom is properly cleaned at end of save test
03684c004a4e [FIX] website: ensure reset of bg-image on add bg-video
d63397159708 [FIX] web_editor: fix image remove from images wall
82fa5142f1a5 [IMP] note: restyle note without sheet or resizer
8b9f1ce603d5 [FIX] web_editor: properly mock createWysiwygIntance (sic) in tests
fc2183b66305 [FIX] web_editor: image overlay did not update with changes
cd0d2f5791cd [FIX] web_editor: add color preview to color picker
28a168172454 [FIX] web_editor: restore removal of spinner
67c90dd3b946 [FIX] website_forum: properly initialize editor
920dfe2a430a [FIX] website_forum: better css in the JW toolbar
43f33fd651af [IMP] web_editor: update Jabberwock library to commit 6853b60
71246c92f8de [FIX] Web_editor: table options button should be inside the toolbar
12b9e5916692 [FIX] web_editor: properly update the image options on replace image
e889cf8583da [FIX] website, website_sale: properly save filter id of dynamic snippets
e0fd11e36e45 [IMP] web_editor: update Jabberwock library to commit 4b2c903b
8f2b7ba35614 [FIX] web_editor: properly stop snippet option changed event propagation
a30c2c4105c7 [FIX] website: fix megamenu snippet editor behavior
312091cf822b [FIX] web_editor: fix overlay that is not reappearing
9f1d03dda613 [FIX] web_editor: table picker not fully displayed
814ddada6124 [IMP] web_editor: remove message before leaving page if editor is destro
4f38e26af7da [FIX] web: allow saving copyright footer
01e947b6123b [FIX] web_editor: only save translations that changed
103676072c50 [FIX] web_editor: prevent traceback on open crop dialog
5844ff66d4a0 [FIX] web_editor: apply image crop in jw on save dialog
1b435652e4a0 [FIX] website_forum: ensure media modal opens on click button
4f4a6ca0b8ac [FIX] web_editor: ensure valid default html value
51e22026ac7b [IMP] web_editor: update Jabberwock library to commit ab1184f8
2413fa19be0e [FIX] web_editor: Qunit test properly wait for editor stop
aa89e1ea3e97 [FIX] web_editor: properly save view blocks with an id
e2e90b53992e [FIX] web_editor: ensure language selector is non editable
0efd72089d5c [IMP] web_editor: clean useless lines
f54dfc7631f9 [IMP] web_editor: remove useless comment
3995ab1b84f2 [IMP] web_editor: update Jabberwock library to commit b8d73691
0834b1e5740a [IMP] web_editor: withDomMutations
f1459fb7b45c [FIX] web_editor: fix non-deterministic error in QUnit wysiwyg tests
6e8acc6c8cc7 [IMP] web_editor: update Jabberwock library to commit 3bbb175c
18a0c95d51cb [FIX] website, web_editor: #wrapwrap in body
4686a92e742c [FIX] website_form: allow edition of success message
78cc4da075cc [FIX] web_editor: allow edition of branded nodes only
bcffa7353448 [FIX] web: dialog should not use field value footer items
67ff56e14746 [FIX] web_editor,website_mass_mailing: display the popup preview
3cb9bea50c20 [IMP] web_editor: update Jabberwock library to commit a20492ea
518f03e6f1c9 [FIX] web_editor: use withIntangibles to find ZoneNode
d0ad6a568f49 [FIX] website: move sidebar out of theme
d690f5da13ea [FIX] website: properly save popup id
43b3433df3e6 [FIX] web_editor: fix non-deterministic error in QUnit wysiwyg tests
4ee8f4dedc30 [FIX] web_editor: prevent deadlock when removing child snippet of popup
850be198ef6d [FIX] web_editor: prevent traceback on reposition background image
4c3eaba41f5d [FIX] mass_mailing: adapt tour to the new editor design.
496d3ea272ed [FIX] web_editor: properly position sidebar scrollbar
5be4de703074 [FIX] web_editor: Show the toolbar when select the text in forum edition

closes odoo/odoo#63768

Related: odoo/enterprise#15458
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-24 13:36:49 +00:00
Antoine Guenet 364d412fe5 [FIX] website_form: allow edition of success message
closes odoo/odoo#63269

X-original-commit: 89f417cf81aa3cb0b025c2e7560858b885707da2
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2020-12-11 17:57:25 +00:00
Nicolas Bayet 3fa7894106 [IMP] web_editor: withDomMutations
1) Replace editor function that change the editor internal structure
   with a new mechansim that does it automatically by observing dom
   mutations. Welcome wysiwyg.withDomMutations.

2) Add a mechanism to reuse the active editor execution context
   when a wysiwyg.execCommand or wysiwyg.withDomMutations is called
   inside itself.

   Example:

   await wysiwyg.execCommand(async ()=> {
      ...
      await wysiwyg.execCommand(()=>{...})
      await wysiwyg.withDomMutations(()=>{...})
   })

closes odoo/odoo#63237

X-original-commit: fe7056ccb450c9767693671e8d980a6aebacd6ab
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2020-12-11 15:32:36 +00:00
Achraf (abz) 61ae6a6ca1 [FIX] survey, web, web_editor, website, website_form: Prevent invalid date stock.picking
What are the steps to reproduce your issue?

1. Install "stock"
2. Go to Inventory/Inventory Overview/Internal Transfer
3. Create new record and set manually a date with year < 1000 like "0008-10-10 18:35:00"
4. Save
What is currently happening?

An error arises when saving the record, and it is then no longer
possible to reopen the records or any view containing it.
This also prevents us from correcting the date to no longer have the error
Why is this happening?

The root cause is an inconsistency in `strftime` for years < 1000 [1, 2]. To take it into
account, a zero-padding is needed in the DateTime parser.
How to fix the bug?

The missing padding is added.

However, such dates lead to problematic behaviors in Python:

```
DT_FORMAT = "%Y-%m-%d %H:%M:%S"
new_date = "0008-02-05 18:10:10"
datetime.strptime(
    datetime.strptime(
        new_date, DT_FORMAT
    ).strftime(DT_FORMAT),
    DT_FORMAT
)
```

This raises:
```
ValueError: time data '8-02-05 18:10:10' does not match format '%Y-%m-%d %H:%M:%S'
```

As of today there was no reported business cases where dates with year < 1000 would be
necessary. Therefore, we limit the range to years >= 1000.
[1] https://bugs.python.org/issue13305
[2] https://docs.python.org/dev/library/datetime.html#strftime-strptime-behavior

opw-2408260

closes odoo/odoo#62889

X-original-commit: b873bda1e560bc49ab707aa238fdc962f23bc1e4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-12-04 13:35:47 +00:00
Martin Trigaux 1658473bf2 [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#62564

X-original-commit: 9b3b2e8d711e3be75b1faffaf6f4f8f4ec90186e
Related: odoo/enterprise#15038
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-30 07:07:58 +00:00
IEL 1051b28970 [FIX] web_editor, website_form: speed up and robustify form editing
STEPS:
* open website page with a form (e.g. /contactus)
* click edit
* slow down connection speed
* click fast between form input lines or change order of the lines

BEFORE:
* 7 svg files are requested every click
* get_authorized_fields is called every click
* random error "'classList' of undefined" in SelectUserValueWidget::close
* random similar errors when a method is called before initialization

AFTER:
* svg and get_authorized_fields are requested once
* random errors are no reproduced or it's hard to do it
* performance of switching between inputs doesn't depend on connection
speed (though, still not instant)

WHY:
* about changing in SelectUserValueWidget::close: posible reason why
this.menuTogglerEl may be undefined is because method start is async
* the other updates just implement caching

---

opw-2368928

closes odoo/odoo#62115

X-original-commit: 710784da1f02d45cbe898da426ba7e2ac63dc711
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-22 13:58:44 +00:00
Martin Trigaux 5fdc764fb1 [I18N] *: extract owl and snippet translations
Were missing the translations of the javascript code that was outside
of the static/src/js folders

closes odoo/odoo#61977

X-original-commit: 3fd53ad297ae84cddaafc6214f6de7060ebd48e9
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-11-19 07:43:32 +00:00
qsm-odoo b453663500 [FIX] website_form: allow to add form snippet inside columns
closes odoo/odoo#61799

X-original-commit: bcb22aca37aa6f7301bc92fa3ae52f53d1044d97
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-16 16:02:06 +00:00
Benoit Socias 91419a811a [IMP] web_editor, website_form: put add action in front of other options
Before this commit the add field actions are in the middle of the editor
top options

After this commit the add field actions are in front of the editor top
options

task-2367124

closes odoo/odoo#60996

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-03 07:24:46 +00:00
qsm-odoo 265d8ce9d2 [FIX] website_form: fix form values reset on Firefox
Reseting the field should just be done through the form element's reset
method to let the browser do it properly, otherwise the browser may
validate the applied values (and for example mark the required field
as wrong (making them red)).

task-2312878

closes odoo/odoo#61200

X-original-commit: 7676fc069d8b6458d0fc1f8eafe087ce553743f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-11-02 16:37:27 +00:00
Nicolas Galler a14a8e47fe [FIX] website_form: prevent double clicking send
Behavior prior to the commit:

A user can double click the "Send" button when submitting a form on the
website.  Because the event handler is removed on the first click, the
second submission uses the browser default behavior and posts the form
to an incorrect URL, resulting in a 404 error for the user.

Behavior after the commit:

The button is disabled after the first click.

Note:

Using `.attr('disabled')` is sufficient both to disable the button and
to give the disabled visual on all browsers since IE9, but we keep
`.addClass('disabled')` and `.off()` for cases where the clickable is not a
`button` but a link.

opw-2356402

closes odoo/odoo#61111

X-original-commit: 0eed92da709dba843a7f2f82aee772313e3d4630
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-31 21:47:16 +00:00
Nasreddin (bon) 9a42f49b70 [FIX] website_form: Required hidden field is not saved
Issue

	- Install "Website" app
	- Go to "Contact us" page on website
	- Edit Page, then click on submit button to
	  edit form style
	- Alter 'Recipient Email' then save
	- Edit Page and click on submit button

	'Recipient Email' have default value.

Cause

	If a field is required, the default value is set without
	checking if a value is already set.

Solution

	Set current value if available, else default value.

opw-2361169

closes odoo/odoo#60457

X-original-commit: e29d2818abf0e7902feb26c9e0b4809c9a3351c6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-10-21 13:50:28 +00:00
Gorash 5418f93903 [FIX] web_editor: need to build the snippet before commit it into vDom
Issue: Add dynamic carousel in the page, then change the footer template,
then reply "Yes, I want to save & reload", then the page is broken because
the new class and data attributes are not saved.

closes odoo/odoo#60077

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2020-10-16 14:09:49 +00:00
6d6f42f489 [REF] website: adapt to new jabberwock editor
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2020-10-14 10:29:11 +00:00
qsm-odoo cfd63a2b35 [FIX] web_editor: reduce clickable area of checkboxes in editor panel
Before this commit the clickable zone of a checkbox in the editor was
all the width of the panel.

After this commit, the clickable zone is only the label width + the
checkbox width. Also, the active and hover states of the label have been
removed to not confuse the user.

task-2312878

closes odoo/odoo#59406

X-original-commit: 61ffe97d03deae0aee72568311c453d1cd3470c8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-10-07 12:10:31 +00:00
Benjamin Vray 1b2ac52969 [FIX] website_form: layout issue on multi checkboxes options
Before this commit, buttons to remove checkboxes and buttons to
re-order checkboxes were styled like button.

After this commit, buttons are just icons. We also improve a little
bit the design of the checkbox list (add space between elements and a
light border between items in the checkbox list).

task-2312878

closes odoo/odoo#58181

X-original-commit: 0253b01632a30adfe071aa090a875fb3915e1962
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-22 09:19:05 +00:00
Laurent Stukkens (LTU) b192d8d23f [FIX] website_form: allow to submit form without csrf if not logged
Chrome recently changed their SameSite policy default value from None to Lax,
the session is no more shared between the webpage and the iframe.
As a result, the csrf check systematically fails.

After this commit, the csrf_token check is only made when you have a session.

In case you are using your form in an iframe on another site, with the new
cookies policy, your cookies with the session_id (linked to the csrf token)
is not sent to the server and the check csrf always fails.

Since the purpose of the csrf is to prevent another website to submit a form
with your 'authenticated account', we can consider that if you are not logged
and so have no session_id, it is no critical and we can ignore the csrf check.

opw-2330286

closes odoo/odoo#58050

X-original-commit: 9a0c9f3192bc7043add89446cbe6c2650499a654
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-18 15:09:51 +00:00
Nicolas Lempereur 512a13f94c [FIX] website_form: lang arabic for date/datetime
When we send dates with website_form, if the language of the website is
eg. in arabic we will send moment.js arabic dates that can't be parsed
by the server.

This also happens with norwegian and any language which doesn't use
ascii numbers or textual format of month or days (and possibly RTL
language).

With this changeset, if we detect we are in a use case where this matter
(an existing field and a date format that will fail) the date will be sent
as odoo server format.

Expected change:

- what worked still work with or without server restart

- what didn't work works after server restart

- special case such as "english" with custom format in res.language
  containing textual month might now not work with code update without
  server restart (probability of this is low).

opw-2326882
closes #57042

closes odoo/odoo#57217

Note: the saas-13.5 version always force isoformat for existing fields
X-original-commit: f50f32ea656df62d16f0aeba1247fc3b2d394e5d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-09-08 07:26:36 +00:00
Nicolas Lempereur bd125e0b72 [FIX] website_form: have several date picker
When multiple date (or datetime) pickers are added to a website form,
the uniqueId value is used to differenciate them thanks to 694af9a19a.

It works well in a lot of case (eg. when adding several field at the
same time, or by change because other code consume uniqueId) but in this
scenario:

- add a date field on a form
- save
- add a date field on a form

it is possible have the second field targetting the first one because
they have the same `'datepicket'+uniqueId()` ID. This happens because
uniqueId is reset at each page opening.

found when working on opw-2326882
closes #57092

closes odoo/odoo#57110

X-original-commit: 75ad994a628ef0d994b44cf6e25fd5340c3ecafd
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-09-04 15:35:03 +00:00
Martin Trigaux 90d85eb9c5 [I18N] export saas-13.5 source terms
Without demo data

closes odoo/odoo#56869

X-original-commit: 33f251b6489455cd7221f2c62dee0400a69784b8
Related: odoo/enterprise#12836
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-01 11:18:00 +00:00
stefanorigano (SRI) 374ce7759e [IMP] web_editor, website, *: adjust general ui spacing/alignment
*: website_form

Part of https://github.com/odoo/odoo/pull/55959
task-2157252
2020-08-14 19:19:48 +00:00
Benjamin Vray 798fa36471 [IMP] website, *: add missing options previews
*: web_editor, website_blog, website_form

task-2280397

closes odoo/odoo#53516

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-08-10 14:51:30 +00:00
stefanorigano (SRI) 167e70347b [IMP] website, website_form: add position options ui icons
Part of https://github.com/odoo/odoo/pull/54913
task-2157252

closes odoo/odoo#54913

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-07-30 11:12:03 +00:00
stefanorigano (SRI) 26e146644b [IMP] website, *: review snippet names
*: website_event, website_form, website_sale

Part of https://github.com/odoo/odoo/pull/55089
task-2157252

closes odoo/odoo#55089

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-07-30 10:19:06 +00:00
stefanorigano (SRI) b7fe2bdae2 [IMP] website, *: review snippets thumbs
*: website_blog, website_event, website_form, website_mail_channel,
   website_mass_mailing, website_sale, website_twitter

Part of https://github.com/odoo/odoo/pull/55089
task-2157252
2020-07-30 10:13:07 +00:00
6aa6c321a6 [IMP] web: remove min date limitation of year 1900
Before this commit, user could not selecta a date before year 1900.
This was an historical limitation due to python < 3.2 that didn't
support dates before 1900.

After this commit, user can select any date, user can select any
date from 01/01/0001.

taskID: 2166761
Fixes #41788
Closes #43055

closes odoo/odoo#51406

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-07-28 14:02:10 +00:00