Commit Graph
163206 Commits
Author SHA1 Message Date
Sébastien Theys ba5cbd21e7 [REF] mail: move discuss.channel.member/fetched to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:39 +02:00
Sébastien Theys d4399cef37 [REF] mail: move discuss.channel.member/seen to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:39 +02:00
Sébastien Theys 91c331c185 [REF] mail: move discuss.channel/transient_message to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:39 +02:00
Sébastien Theys 95592d7fa5 [REF] mail: move discuss.channel/legacy_insert to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:38 +02:00
Sébastien Theys 485379ad60 [REF] mail: move discuss.channel/joined to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:38 +02:00
Sébastien Theys 91872440b1 [REF] mail: move discuss.channel/leave to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:38 +02:00
Sébastien Theys adae210696 [REF] mail: move discuss.channel/new_message to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:38 +02:00
Sébastien Theys bcc420e5d4 [REF] mail: move command palette to discuss folder
Part of task-3265211

Part-of: odoo/odoo#128593
2023-07-17 18:13:37 +02:00
Matheus Leal Viana (malv) 1e842901a0 [FIX] purchase_requisition_stock: calculate on-time rate when percentage is zero
Versions:
---------
- 16.0

Steps to reproduce:
-------------------
- Create a new Purchase Order.
- Set the Vendor to a brand new contact.
- Add a product that would be delivered.
- Confirm the PO, set the Expected delivery date in the past.
- Notice that on_time_rate and on_time_rate_perc are both -1.
- Process the delivery.
- Now on_time_rate is 0 but on_time_rate_perc is -1 still!

Issue:
------
The field OTD is -1 even when On-time delivery is 0

Cause:
------
The issue is happening because if po.on_time_rate == 0 the value
Is set to -1.

Solution:
---------
Modify the condition to ‘po.on_time_rate >= 0’ to handle this case

OPW-3413668

closes odoo/odoo#128584

X-original-commit: 4e3bf2242808435fd13be323af535cc6cc816da3
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Signed-off-by: Matheus Leal Viana (malv) <malv@odoo.com>
2023-07-17 18:13:30 +02:00
Gabriel de Paula Felix (gdpf) 9b5070576e [IMP] microsoft_calendar: test checking single recurrent event deletion
Added a test asserting the correct functionality of single events deletion.

closes odoo/odoo#127980

X-original-commit: d93d564022bcdafece33f11f578013420b106b64
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
2023-07-17 18:13:16 +02:00
Gabriel de Paula Felix (gdpf) fa23a1d118 [IMP] google_calendar: test checking single recurrent event deletion
Added a test asserting the correct functionality of single events deletion.

X-original-commit: 2676c0e1b9988e862d2c21479d34372b1a5c9cea
Part-of: odoo/odoo#127980
2023-07-17 18:13:15 +02:00
Gabriel de Paula Felix (gdpf) 5ed8417e72 [FIX] calendar: can't delete single event
In the 'calendar' module, the deletion of a single event wasn't being handled during archive. Now, the option 'self_only' is considered in the function 'action_mass_archive'.

X-original-commit: b8feb452c3311ce0ec526ed7304a0ce80af77c22
Part-of: odoo/odoo#127980
2023-07-17 18:13:15 +02:00
Alexandre Kühn 8dc9d12905 [FIX] mail: fetch followers 100 at a time
Before this commit, the data of all followers of a chatter were
fetched whenever `mail/thread/data` was called. This route is
called when loading the chatter for the first time, and whenever
the chatter must be reloaded.

When there are at most dozens of followers, it's not a big deal.
However, with thousand of followers, the route `mail/thread/data`
may become quite long, which made chatter barely usable with a
long loading.

This commit fixes the issue by showing only 100 followers at once
when opening the follower menu. When scrolling down the list,
it loads data of more followers.

Task-3293718

closes odoo/odoo#127966

Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-07-17 18:13:11 +02:00
uso-odoo 07f04e09f3 [FIX] base: prevent traceback while deleting Portal or Default User Template
When the user deletes the 'Portal User Template'  and when any new portal user
will do signup, then traceback will be generated.

If User deletes the 'Portal User Template', then no new portal user will be
created. Also, new portal user will see the traceback as it is generated in
UI.

Steps To Produce for Portal User Template:-

1) Install the 'auth_signup' module
2) Go to Settings > Users
3) Filter only 'Inactive Users'
4) Delete the 'Portal User Template'
5) Open the Incognito tab and click on 'Don't have an account?'
6) Fill required values and click on the 'Sign Up' button

Traceback will be generated on the portal user side as well as in the
backend (Terminal)

Steps To Produce for Default User Template:-

1) Go to Settings > Users
2) Filter only 'Inactive Users'
3) Delete the 'Default User Template'
4) Try to install 'website' or 'hr_timesheet' module

Traceback will be generated

Applying these changes will resolve this issue.

sentry-4184429514,4274176666,4147914005

closes odoo/odoo#127516

X-original-commit: c3e5bed9307498b435857f7736c20cefde3ed6a7
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Signed-off-by: Urvi Soni (uso) <uso@odoo.com>
2023-07-17 18:13:08 +02:00
Thanh Dodeur 000bf53251 [FIX] mail: add a missing mock of the browser media api in tests
Before this commit, a test of call was using the real web media API
and would request micrphone access to the brower. This commit fixes
this issue by using the mocked version for this test.

closes odoo/odoo#128722

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-17 16:46:02 +02:00
Victor Piryns (pivi) ebfcdc95d2 [FIX] project: disable recurrence for all tasks linked to a recurrence
Current behaviour:
If you disable the recurrence for 1 task in a suite of recurrence,
if you had other tasks belonging to the same recurrence suite, they
would still be with recurrence activated.

Expected behaviour:
It doesn't make sense for some of the tasks in a suite of tasks in a
recurrence to enabled and others disabled. If we disable the
recurrence on 1 such tasks, all tasks should linked to that
recurrence should be set as non-recurrent, regardless if the
edit-mode is set on "This task".

Steps to reproduce:
- For 14.0 -> saas-16.1:
  - Install Project, Studio
  - Turn on in Settings the "Recurrent Tasks"
  - Create a new project and a task in it
  - With studio, in debug mode, add a related field to the task form
    that relates to `next_recurrence_date`. Make sure it's not "read
    only"
  - On the task, turn on the recurrence, set the frequency to each
    day, set the `next_recurrence_date` as a day in the past
  - Run the Scheduled Action "Project : Create Recurring Tasks"
  - On one of the task, disable the recurrence
  - Go to the other task, see that their recurrence is still active,
    and the frequency changed to the defaults values of once a week.
- For saas-16.2 -> master:
  - Install Project
  - Turn on in Settings the "Recurrent Tasks"
  - Create a new project and a task in it
  - Activate the recurrence on the task, set a planned date in the past
  - Set the task as "Done", this should create an new instance of the
    recurrence.
  - Disable the recurrence option in one of the task, observe that
    is doesn't change for the other task, and the recurrence
    frequency is reset to default values.

Reason for the problem:
When disabling the recurrence on 1 task, with the edit-mode set as
"This task", the recurrence is being deleted, but we don't disable
the recurrence of the other tasks linked to that recurrence.

Fix:
When we are writing `False` on `recurring_task` on a task, we
explicitely write `False` on `recurring_task` on all tasks that belong
to the recurrence after the deletion of the recurrence itself.

Affected versions:
- 14.0
- 15.0
- saas-15.2
- 16.0
- saas-16.1
- saas-16.2
- saas-16.3
- master

opw-3265212

closes odoo/odoo#128703

X-original-commit: 0a83f4030b07aba25b054aa453d81c0e27b98cc8
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-17 16:45:59 +02:00
Om Rabara c01f7cdac8 [FIX] partner_autocomplete: change logger type to warning
An error occurs while attempting to connect the IAP server,
The problem seems like the IAP server was down, This error is generated and
subsequently caught by a sentry.

Error: Autocomplete API error: The url that this service requested returned an
error. Please contact the author of the app. The url it tried to contact
was `https://partner-autocomplete.odoo.com/iap/partner_autocomplete/enrich`

To handle this issue, we have changed the logger error to warning.

sentry-3930839889

closes odoo/odoo#128706

X-original-commit: a5cc90262ea36c332ce5aaa78c003f63d444565b
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
2023-07-17 13:30:46 +02:00
Adrien Guilliams (adgu) be67de9aa6 [FIX] point_of_sale: pay button too small
A previous PR made the Pay button smaller than it should.
This old PR was created to correct a bug in the mobile view by removing
the "More" button if it was not needed and thus making the validation
button bigger when there was no "More" button. It led to a problem
where, in desktop view, the "More" button is not present but the page
act like it was present and thus make the validation button smaller than
it should have. This commit add the condition that the screen must be in
mobile mode to shrink the validation button size.

closes odoo/odoo#128677

Signed-off-by: David Monnom (moda) <moda@odoo.com>
2023-07-17 13:30:44 +02:00
Nasreddin Boulif (bon) 189017d10c [FIX] web: allow exporting record with properties when grouped
Steps to reproduce:

  - Install `CRM` for test purpose
  - Go to `CRM > Pipeline` and open any lead
  - Add a new property and set a value
  - Go back and open list view
  - Group by `Salesperson`
  - Select all records and click on `Export` in action menu
  - Add 'Properties' field
  - Export

Issue:

  Traceback raised. No issue if not grouped.

Cause:

  The properties value is a list of dict. When grouped, the properties
  value is not converted to string (like it is done for list and tuples
  in the non-grouped flow).

Solution:

  Move the code that convert list and tuples to string in the
  non-grouped flow directly to the `write_cell` method so that it is
  applied in both cases.

opw-3338564

closes odoo/odoo#128682

X-original-commit: f380c56bb13773eee0e19462ba7283b04d54183b
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-07-17 12:06:33 +02:00
althaf shaik 44edf9c9ac [FIX] mrp: create workorder without workcenter
When user not seleted 'work center' and only selecting 'Scheduled Start
Date' and 'Scheduled End Date' while creating  'work_order' in
'mrp_production', this traceback raises.

To reproduce the issue:
1. Install 'mrp'
2. Activate 'Work Orders' in configuration/settings
3. Go to menuitem/operation and create 'Manufacturing Orders'
4. Select any product and add a line in Work Orders
5. Give values to 'Scheduled Start Date' and 'Scheduled End Date' only.

Error: A traceback appears:"ValueError: Expected singleton:
resource.calendar()"

On '_calculate_duration_expected' method resource_calendar_id value is
getting from 'workcenter_id'.
https://github.com/odoo/odoo/blob/36459d26f1adb92f92d52ce05329e8ad3e95dd91/addons/mrp/models/mrp_workorder.py#L399-L404
Therefore in the above use case, when triggering the onchnage method,
because of resource_calender is dependend on 'workcenter' and when
workcenter is not selected it will lead to the above traceback.

Sentry-4244804815

closes odoo/odoo#128643

X-original-commit: 102ba9a848162db0029ca639ea84a9319b80d278
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-07-17 12:06:27 +02:00
Michele 28180b070a [FIX] stock: add default company_id on stock lot
The field company id on stock lot is required but there is not a default
value. The default value should be the current company id

closes odoo/odoo#128640

X-original-commit: 9b21686616f51db1246ae51c29dab4af2c341323
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-07-17 12:06:24 +02:00
Atul Patel b61a148648 [FIX] stock_account: fixed unique constraint for journal
During configure journals and to set property stock journal
from stock account ,  will try to create
xmlid to existing records to avoid duplicate journal codes.
but there are some existing code journal for inventory valuation
already exists. so if already journal with `STJ` and with same
company exist then will avoid to create new journal of same code.

```
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "account_journal_code_company_uniq"
DETAIL:  Key (company_id, code)=(1, STJ) already exists.
```

closes odoo/odoo#128639

X-original-commit: 6d6a6530bc43f289f8a811347e0ddd7053b5651c
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-07-17 12:06:21 +02:00
Jeremy Kersten 0a9bd4a82a [FIX] website, google_recaptcha, website_cf_turnstile: fix wrong deps
Since commit [1], as soon as you have website installed, the result of
google_recaptcha was ignored. It is because website depends of
google_recaptcha and not the opposite.

Now we don't override the result of google recaptcha in website. And if
you have recaptcha + turnstile, Turnstile will check the result of
google_recatpcha first, and if result is valid, add his own test.

[1]: https://github.com/odoo/odoo/commit/4aca39a533e9d41f5f452f36a1ffc001f586b4f4

opw-3380702
opw-3392206

closes odoo/odoo#128634

X-original-commit: c8cc447f70f2a132d49b57c3c61c181a63876d26
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-07-17 12:06:18 +02:00
Haris (MHCH) a5d4966212 [FIX] stock_account: fix svl label
Fixes the formatted string to add the correct reference
in case of no picking. e.g. mrp correction

To Fix:
without parenthesis around the expression, the first value is
considered as the value instead of evaluating the complete expression.
**Results in:**
`Correction of False (modification of past move)`

closes odoo/odoo#128619

X-original-commit: 81fd11fe70357f638434bab44705c91008efb25f
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-07-17 12:06:15 +02:00
tsm-odoo 630690ca1a [FIX] im_livechat: fix crash when user changes after starting livechat
Before this commit, a crash occurred when the user changed after
starting a livechat conversation.

Steps to reproduce (login => logout)
- Login on admin
- Go to the website
- Start a livechat conversation
- Logout
- Start typing on the chat window composer
- Crash due to `NotFound` raised after `notify_typing`

The same error could occur the other way around (logout => login).
This error is due to the user not being a channel member after it
changed.

In order to fix this issue, livechat session is cleared when the
user changes. Indeed, it the "new" user is not linked to the livechat
conversation so it makes no sense to display it.

fixes https://github.com/odoo/odoo/issues/128206
opw-3421386

closes odoo/odoo#128595

X-original-commit: 3cea3878911831eee5abee9272c7b81145ee7128
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-17 12:06:09 +02:00
tsm-odoo 12152279a5 [IMP] mail: add a registry for partner suggestion sort
Before this PR there was no way to add a sort criteria to the
partner suggestions. This commit introduce a registry of compare
functions that can be arranged thanks to a sequence key. This way,
it will be very easy to add custom sort criteria.

part of task-3332872

closes odoo/odoo#128570

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-17 12:06:04 +02:00
Arthur Detroux (ard) 4da1e0e0f0 [REF] website: update the dashboard widget to OWL
This commit converts the Website Dashboard to OWL.
The main goal of the Website Dashboard is to display the Plausible
Dashboard inside an iframe. Most of the code from the legacy widget was
actually used by website_sale and not website. Since Website Sale
dashboard is to be re-done in the dashboard app (by task-3222991), a lot
of the logic could be removed and simplified.

task-3164163

closes odoo/odoo#112819

Related: odoo/enterprise#44087
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-07-17 12:05:58 +02:00
Arthur Detroux (ard) 1434382ece [REM] website_sale: remove website sale community dashboard
This dashboard depends on the website dashboard which is to be re-done
in OWL. Instead of keeping this dashboard as a separate component, it
will be re-done in the Dashboard App (see task-3222991).

task-3164163

Part-of: odoo/odoo#112819
2023-07-17 12:05:58 +02:00
Arthur Detroux (ard) caa5ee0e0b [MOV] website: move the dashboard template for future OWL conversion
Prepare for OWL conversion while keeping the template's history, as
some of its code can be re-used in the new OWL Component.

task-3164163

Part-of: odoo/odoo#112819
2023-07-17 12:05:57 +02:00
Odoo's Mergebot 6212afc402 [IMP] mass_mailing: improve A/B testing usability
PURPOSE

Provide various fixes and UX improvements to ease usage of Emails and
SMS marketing applications.

SPECIFICATIONS

- Add a compute field ab_testing_sms_count to compute the counts related to A/B
  testing SMS.

- Add an alert message for A/B testing when no mail is sent in the form view with the
  chatter.

-  Add "(final)" to the source name of the final and winner A/B test mail.

-  The buttons are now correctly display based on the mailing_type
(the auto mode can now send a winner manually)

- Change the copy override of `utm.source.mixin` to consider the name param of
  default arg. when getting a unique name for the record.

Task-2713198

closes odoo/odoo#88997

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-07-17 12:05:49 +02:00
Pratik Raval (PRRA) f64ca1c73c [FIX] utm: consider default argument's name in copy method
Before this commit, in the copy method override of `utm.source.mixin`, the name
of the default, argument was not considered while `_get_unique_names`  to get a
unique name for the record.

After this commit, the name parameter of the default argument will be considered
for the same.

taskID-2713198

Part-of: odoo/odoo#88997
2023-07-17 12:05:48 +02:00
Pratik Raval ee31690988 [FIX] mass_mailing{_sms}: fix A/B testing description
Before this commit
- When we were creating an alternative version in the SMS app for A/B
  testing, we were not able to see different options like select
  winner, compare version, etc in it because of ab_testing_mailings_count
  was counting only records with type equal to mail, in method
  _compute_mailing_mail_count. So, count will never increase
  and those buttons will never be visible.
- We were not able to sent the mail manually in auto mode.
- We were able to see the 'Send winner Now' and 'Send this as Winner'
  buttons even if no a/b test mail were send.

So, with this commit
- We have added the ab_testing_sms_count compute field in utm.campaign
  and ab_testing_sms_count related field in mailing.mailing to deal
  with the above problem.
- The auto mode can now send a winner manually.
- We introduce a new compute field is_ab_test_sent for computing
  whether the any sibling mails of a/b testing are sent or not,
  depending on that we hide / show buttons.

TaskId-2713198

Part-of: odoo/odoo#88997
2023-07-17 12:05:48 +02:00
Pratik Raval 06c70b5913 [IMP] mass_mailing: improved recipients warning
Part-of: odoo/odoo#88997
2023-07-17 12:05:47 +02:00
Jérémy Hennecart (jeh) 84316403ac [IMP] mass_mailing: a/b testing wording improvements
- Add an alert message for A/B testing when no mail is sent in the
form view with the chatter.
- Add the final suffix in the name of the final mailing send for an
A/B testing campaign source.

task-2713198

Part-of: odoo/odoo#88997
2023-07-17 12:05:47 +02:00
niyasraphy 711024339f [FIX] web: field check/uncheck on clicking on neutralize label
before this commit, in the database manager page, on
clicking the Neutralize label in the db duplicate
and restore page is not check/uncheck the neutralize
checkbox.

after this commit, on clicking the label Neutralize
the field can be checked and unchecked as other field
in the same form.

closes odoo/odoo#128671

X-original-commit: 64e3d52591db49a4a441f170e216f0e3aca4fa23
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-07-17 10:40:44 +02:00
David Monnom (moda) a7fc2a0606 [IMP] point_of_sale: improve product product_list
In mobile, the product list can now be displayed as a grid or a list.

Items in the list and grid views will now always have the same author,
to maintain consistency.

closes odoo/odoo#126861

Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
2023-07-17 10:40:38 +02:00
Benoit Socias 8a20ae9b4a [IMP] web_editor: make all headings color only inherit from main heading
Colors of headings are inherited between levels. (E.g. if no color is
defined for `<h4>`, it uses the color of `<h3>`)

This commit changes it so that all levels only inherit from `<h1>`.

task-3140991

closes odoo/odoo#111621

Related: odoo/design-themes#633
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-07-17 10:40:33 +02:00
Benoit Socias f984d478e5 [IMP] *: make the shape option available only on custom buttons
*: web_editor, website_mass_mailing

Because the shape is now also part of the theme options for primary and
secondary button, it does not make sense to select it when the button
is either primary or secondary.

This commit makes the Shape option shown only for Custom buttons, and
therefore also nests it under the Style option.

task-3140991

Part-of: odoo/odoo#111621
2023-07-17 10:40:32 +02:00
Benoit Socias c2a7e58585 [IMP] website: add a way to revert to the default font
Before this commit, when a heading font was selected, it was not
possible to deselect it (so that the H1 font gets applied again).

After this commit, the font selector has an extra "Reset" button to
restore the default state if it has a specified value.

task-3140991

Part-of: odoo/odoo#111621
2023-07-17 10:40:32 +02:00
Benoit Socias e55c126770 [REF] website: customize several website variables in one rpc
Before this commit, customizing the theme option's background image or a
theme option's button style required several RPCs and refreshes of the
assets bundle.

After this commit those options are updated through a single RPC call
and a single refresh of the assets bundle.

task-3140991

Part-of: odoo/odoo#111621
2023-07-17 10:40:32 +02:00
Benoit Socias 388e4bb2bf [IMP] website, web_editor: relayout theme options
This commit reorganizes the theme options to make them easier to find.
It also adds the following options:
- 'Font size' for each of the six headings
- 'Font (family)' for each of the six headings
- 'Margins' (top & bottom) for paragraph & the 6 headings
- 'Line Height' for paragraph & the 6 headings
- Harmonize buttons options with the custom button ones

task-3140991

Part-of: odoo/odoo#111621
2023-07-17 10:40:31 +02:00
Alexandre Kühn 1b72b93a9a [FIX] mail: do not show (edited) label on messages
When a message is posted, sometimes the label tells the message
is edited when it definitely shouldn't.

This happens because implementation of detecting whether a message
is edited relies on difference between `create_date` and
`write_date`. This implementation is flawed, especially when the
message being newly posted has its fields being updated in another
ransaction, which is unfortunately what happens when the message
should be sent by email.

No good solution to preserve this label in a working state was
found, so the showing of this label is being disabled.
Messages can still be edited: only the label is no longer shown
after this commit. This makes feature of message edition matches how
it was in prior versions of Odoo, where the label was also missing.

closes odoo/odoo#128656

X-original-commit: f5d108eff2276ba577a52d9d10a82f9ea769c701
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-17 09:21:21 +02:00
Aaron Bohy e13f3103e2 [FIX] web: view compiler: honnor class attribute on widget
Commit [1] inadvertently broke the handling of the "class"
attribute on a <widget> node, in the view compilers. When set,
the value of the "class" attribute was given in props to the
Widget component as "name", instead of "className".

[1] https://github.com/odoo/odoo/commit/0b574df2599da3dae66b9785198420d707a280a3

closes odoo/odoo#128646

X-original-commit: 3024f2121848ec414d596ef9c3eb0a1bd7e6cfd2
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-17 09:21:18 +02:00
abd-msyukyu-odoo ffa36f5b20 [FIX] web_editor: prevent error with arrow keys whithout selection
Protect left/right arrow key handling against an empty selection (no
previous/next character to find without a selection).

Example of steps to reproduce the issue (= lose the selection while keeping the
focus):
- create such a configuration in the editable:
```html
<p [p1]><br></p>
<table>...</table>
<p [p2]><br></p>
```

- Place the cursor inside [p2] and delete the node with `CTRL + BACKSPACE`
- The cursor should have moved in the last cell of the table
- Place the cursor inside [p1]
- Start the table deletion process with `CTRL + DELETE`
- The table should be selected, as well as [p1]
- Type `DELETE` (this time without CTRL) a second time.
- The table and the paragraph are replaced by a single `<br>` node and the
  selection is lost.
- Type `LEFT/RIGHT ARROW KEY`
=> Traceback
- A paragraph is inserted again when clicking in the editable afterwards
- The isolated `<br>` node stays until it is deleted by pressing on `DELETE` in
  the last (reinserted) paragraph.

Typically, any other case where the selection is manipulated programatically and
not put back in the editable (be it through a bug, or because a target
selection has become obsolete and can not be found) would produce such a
taceback.

task-3425395

closes odoo/odoo#128631

X-original-commit: 2ee6e08f42f913e3102ca7340bb40b0203432b67
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-07-17 09:21:10 +02:00
abd-msyukyu-odoo 70b0731154 [FIX] web_editor: handle deletion process around nested editable
Fix `deleteBackward` and `deleteForward` processes around nested editable
zones, i.e.:
```html
<div class="odoo-editor-editable" contenteditable="true">
  <div class="nesting" contenteditable="false">
    <div "nested" contenteditable="true">
      <p>content</p>
    </div>
  </div>
</div>
```

- `deleteBackward`, when used:
  - just after the nesting element; should remove the nesting element
  - at the start of the nested element; should do nothing

- `deleteForward`, when used:
  - just before the nesting element; should remove the nesting element
  - at the end of the nested element; should do nothing

This commit also move some existing tests that were related to the handling of
non-editable elements in their correct `describe` section.

task-3425395

X-original-commit: a52deabecef8a5d489743b0ae07d4d32302fd76e
Part-of: odoo/odoo#128631
2023-07-17 09:21:10 +02:00
abd-msyukyu-odoo 2c84ff74f7 [FIX] web_editor: scope getFurthestUneditableParent in editable
This commit fixes the method so that it is not allowed to probe outside the
boundaries of the `root` editable element, no matter the value of `parentLimit`.
This also allows to not specify `parentLimit` (becomes the editable element by
default).

task-3425395

X-original-commit: ffeb1abcc675dd05fb9546e39aac4498e510bbbc
Part-of: odoo/odoo#128631
2023-07-17 09:21:10 +02:00
Robin Lejeune (role) 8de6fcb959 [FIX] web_editor: use placeholder constant on a forgotten line
The commit [b7b05a2] added a `PLACEHOLDER_TEXT` constant to consistently
change the text in `we-toggler` when no element is selected from "/" to
"None", but forgot to update one comparison.

Steps to reproduce the issue:
- Drag and drop an "Add to cart" button
=> The "Product" toggler menu shows "None" when nothing is selected.
With the updated code, it says "Choose a record...".

- Type a partial name (e.g. "desk") in the search box and press enter
=> It still shows "None".
It should select the first item available in the list. In this case with
demo data, "desk" would be "[FURN_118] Corner Desk Left Sit".

[b7b05a2]: https://github.com/odoo/odoo/commit/b7b05a2d1c1d5

task-3266751

closes odoo/odoo#128617

X-original-commit: f0f9094334e5a09b89c1fc50865c9da339d0605d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-07-17 09:21:06 +02:00
Saurabh Mishra dabb602ad6 [FIX] l10n_es_edi_facturae: check for valid password for certificates
When the user is creating the certificate for EDI Inoices and saves it without
providing the password then, the user will face error.

Steps to produce:
- Install l10n_es_edi_facturae.
- Change the company to ES Company.
- Create a certificate without giving password through,
 (Invoicing > Configuration > Spain Facturae EDI > Certificates)

Error: 'AttributeError: 'bool' object has no attribute 'encode''

sentry-4257267006

closes odoo/odoo#128605

X-original-commit: 1422ebe86a4697b6ed706d82ce176434c2345c24
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Saurabh Mishra (sami) <sami@odoo.com>
2023-07-17 09:20:56 +02:00
Vincent Larcin 4b819e83ad [FIX] project: make tests demo data independent
The test `test_search_project_root_id` fails when demo data are not installed.
This commit makes it demo data independent.

Task-3410352

closes odoo/odoo#128514

X-original-commit: cf63d549c8592400af6d96bd145169bd3ac636fe
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-07-17 09:20:53 +02:00
Mehdi Bendali Hacine a275503087 [FIX] l10n_sa_edi: Fix CSR generation
A few months ago, the onboarding process for the journals according to ZATCA's Saudi eInvoicing
standards required arabic strings to be encoded in a specific format. The format in question
was not mentioned by ZATCA on any official document, however by reverse engineering some of
the sample CSRs shared by ZATCA through their SDK, we were able to figure out that the strings
were encoded using CP1252. Back then doing that allowed us to generate a CSR successfully.
A few days ago, just after the Saudi Localization was merged with master, we received a
complaint where trying to onboard a journal for a company for which the information was
encoded in arabic sometimes raised an exception. Upon investigating we found out that
the CP1252 encoder was the culprit. We tried removing it and now everything is working
fine, including the onboarding.

closes odoo/odoo#128312

X-original-commit: 31a3c25739bb6c0806da887a1f65e670c1b2f7ad
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-07-17 09:20:48 +02:00