Commit Graph
165044 Commits
Author SHA1 Message Date
Yannick Tivisse c2ebe70ed4 [IMP] *: Remove todos we won't do
closes odoo/odoo#134836

Related: odoo/enterprise#47144
Related: odoo/upgrade#5129
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-09-12 17:16:23 +00:00
Yannick Tivisse fb29d7623c [IMP] hr_work_entry: Remove deprecated method
Part-of: odoo/odoo#134836
2023-09-12 17:16:23 +00:00
Yannick Tivisse 681a09a749 [IMP] ir_http: Remove company_id from session_info
Part-of: odoo/odoo#134836
2023-09-12 17:16:23 +00:00
Yannick Tivisse 0a88ae45d6 [IMP] l10n_be_hr_payroll: Move departure reason to hr
Part-of: odoo/odoo#134836
2023-09-12 17:16:23 +00:00
Patrick Hoste a2ba702a3d [FIX] survey: fix duplicate timer
This commit fix a bug introduced by 910897fc97
which displayed two timers when starting a survey.

Task-3497526

closes odoo/odoo#134686

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-12 17:16:22 +00:00
Samuel Degueldre 5b61256976 [IMP] web: datetime picker support for custom invalidity/class per day
This commit allows users of the datetime picker service to pass
functions that will be called to check the validity of specific days or
that generate a class for a given day. This can be useful in some
contexts for example when you want to prevent the user from selecting
days on the weekend for certain operations, or to highlight some days
where a given product is not in stock.

closes odoo/odoo#134647

Related: odoo/enterprise#47061
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-12 17:16:20 +00:00
Adrien Guilliams (adgu) e19cc8eac8 [FIX] pos_self_order: fix combo price when changing combo quantity
When changing the quantity of a combo, the price was not correctly
updated due to a miscomputation in the backend.

closes odoo/odoo#134622

Signed-off-by: David Monnom (moda) <moda@odoo.com>
2023-09-12 17:16:19 +00:00
Samuel Degueldre 239d8c0a06 [FIX] website: fix editor unable to open with filled date field
In odoo/odoo#133349 some code in website was adapted to use the new
datetime picker and luxon instead of tempusdominus and moment, but some
conversions were improperly performed causing a crash that would prevent
the website editor from opening. This commit fixes this issue and also
formats the chosen default date/datetime correctly while within the
editor.

This commit also fixes a minor issue with props validation of the
datetime picker, where we would give it an empty string instead of null
or false, causing props validation to fail in debug mode.

closes odoo/odoo#134493

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-12 17:16:18 +00:00
niyasraphy 654948ea63 [FIX] base: missing upgrade and uninstall button in apps kanban
before this commit, the uninstall and upgrade option is not
shown in the kanban.

introduced in: https://github.com/odoo/odoo/commit/5b68871097df5e7a13966dee4c650d1f34f9e7c1

* open apps kanban
* click on kanban menu(3 dots) of installed app
* upgrade and uninstall button is not shown

after this commit, the upgrade and uninstall button will be
shown in the apps kanban menu depending on the state of
the app

closes odoo/odoo#135132

X-original-commit: 90184ff280b4225522797528af51a32591eb5347
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-09-12 14:41:26 +00:00
luvi 44d9b70b8e [IMP] mail: add a pager to Activity view
This commit adds a pager to add a limit to the number of activities
displayed by the view. This reduces the risk of performance issues
when many activities have to be fetched and displayed in the view.

There is no need to display an infinite amount of activities, so a limit
had to be set.

The 'get_activity_data' method from the model now takes the limit and
offset parameters, to only fetch activity data from maximum of 100
records.

Activity tests have been adapted to reflect this change, and that the
parameters are correctly used.

task-3487762

closes odoo/odoo#134510

Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-09-12 10:51:08 +00:00
Laurent Smet d3707cf954 [IMP] account: allow to remove placeholders attachments in send & print wizard
In 16.1 and before, when you used the Send & Print, you could manually remove the attachments when using
the Send by Email. Even though the use case is weird (sending an invoice by email without attaching the document),
we have feedback of user actively using that option before.

Also, prevent the deletion of the PDF report from the wizard:
- Create and invoice and send it by mail
- Open again the send & print, remove the PDF and send by mail
=> The PDF is deleted from the invoice

closes odoo/odoo#135101

Task: 3476700
Opw: 3378840
X-original-commit: 00dc68955c8e4c35fab29617eed7f03e45fc6643
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-09-12 08:31:42 +00:00
Aaron Bohy 57da33a9ff [FIX] web: form: no "oh snap" dialog after view button clicked
Have a form view with a view button. Make some changes in the form
s.t. the create/write rpc will return an error. Before this commit,
the "oh snap" dialog was displayed, providing 2 choices to the
user: stay here (basically, close the error dialog and do nothing
else) or discard (discard changes, and continue the flow). In this
case, the flow is to do the "call_button" as we clicked on a view
button. It means that if the user clicked on discard, we still
call the method/action, even though the record was invalid (and
maybe not even existing if it was a new record). This can cause
other issues afterwards.

The "oh snap" dialog was designed for navigation flows (e.g. menu,
breadcrumbs...), when the user tries to leave the form view. It
doesn't fit very well with flows involving the current record that
couldn't been saved.

This commit thus prevents the "oh snap" dialog from being displayed
if the save preceeding a call_button fails. The error returned by
the save is simply displayed in a basic dialog that can only be
closed.

opw~3395109

closes odoo/odoo#135050

X-original-commit: 50b2a24f22cb470bcc1a9befe677cf794211d7b2
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-12 08:31:40 +00:00
Dylan Kiss (dyki) c81e89adf7 [FIX] account: fix drag and drop on journals
When trying to drop an invoice on a journal on the journal dashboard,
it fails with a message "Could not upload files". The issue is that
commit 6f95be6884 changed a CSS class
where the upload functionality depended on, making it fail.

This commit fixes this issue by adapting the CSS selector of the upload
field.

task-3496997

closes odoo/odoo#134965

Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-09-12 08:31:39 +00:00
Ali Alfie (alal) 04be1dff54 [IMP] account: add printed report name for invoices
Before: when attempting to print an invoice, the downloaded file had the generic name "Invoice".

Now: downloaded files have the correct invoice number as names.

task-3477659

closes odoo/odoo#135093

X-original-commit: 6b3555d93221ef6db9e3265a95b127a2bb743469
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Ali Alfie (alal) <alal@odoo.com>
2023-09-12 07:12:40 +00:00
hupo-odoo 8b35a2b54a [IMP] l10n_es_edi_facturae: include edi documents when mass export
in the following commit https://github.com/odoo/odoo/commit/f8654b3501aca6e5d77ced5f73cb351c61684cd2 , we fixed the feature to mass export edi documents from the journal entries list view. However, we forgot to include the Spain localization edi documents to be included in the export.

task-3477482

closes odoo/odoo#135072

X-original-commit: e62e1a647991fdd1ed38486b1a00f8de2812768c
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Hugo Poncelet (hupo) <hupo@odoo.com>
2023-09-12 07:12:39 +00:00
Maximilien (malb) 1fa963d55f [FIX] l10n_de: din5008
During this pr (https://github.com/odoo/odoo/pull/121413), we have made a few
css changes on the din5008 format, some of them needed to be revert because they
 broke the layout.

closes odoo/odoo#135000

Task: 3495712
X-original-commit: 650606708ae863fbc7f7c04903891047776fc903
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
2023-09-12 07:12:37 +00:00
Sohail Jaidi (soja) 01761f8471 [FIX] account: fix unwanted reconciliation on draft reversed move
The aim of this commit is to prevent reconciliation with credit note  to be triggered when a reversed move is reset to draft

Context: reconciliation between credit note and invoice (same for vendor bill)

Previous to this commit:
Post invoice
Create and post credit note
Reset to draft both the invoice and the credit note
Post (confirm) again the credit note
-> User error due to attempt of reconciliation between credit note and draft invoice

After this commit:
The credit note is posted but not reconcilied

task-3492197

closes odoo/odoo#134526

X-original-commit: b61395337ca139b6a663628c70c52f8cce87d76f
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-09-12 07:12:33 +00:00
Yolann Sabaux 547a48f77b [FIX] account: display the move to check
Steps to reproduce:
- Set "To Check" for a bill in the Bill list view
- go back to the dashboard

Issue:
There won't be the "To Check" shortcut as it was the case in 15.0

opw-3455414

closes odoo/odoo#134432

X-original-commit: d8498091bc6e2cd441f5e4387e3833d1a2a1abc0
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2023-09-12 07:12:32 +00:00
Gaetan Vanden Bergh (gavb) bb3d665079 [FIX] auth_signup: False is different than NULL in SQL
Step:
- Setup one app free trial
- Create user on a trial database
- Go to the signup generated (token valid)
- Signup/Reset password

Actual result:
Token is "false"

Expected result:
Token is False/Null/None

Cause by #113753
opw-3482042
opw-3484705

closes odoo/odoo#134137

X-original-commit: e668e15f7ebc4e82cd08270733fa9c68e9944149
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Signed-off-by: Gaetan Vanden Bergh (gavb) <gavb@odoo.com>
2023-09-12 06:02:36 +00:00
Chong Wang (cwg) ddfdba9424 [FIX] core: update model terms for en_US and other
For model_terms translated fields if a translation for a lang(fr_FR) has never
been defined

before this commit
when update translations for both en_US and fr_FR, the new translation for fr_FR
cannot be saved.

after this commit
new translations can be correctly saved when en_US and fr_FR are updated at the
same time.

closes odoo/odoo#135103

X-original-commit: ef4b195eeac178a14eb47f4e6cc61ddc97f78866
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2023-09-11 23:59:51 +00:00
william dacbe1d496 [FIX] web: company selector usability
Since 0eff29409d, the behavior was
unpredictable when clicking on multiple companies before a reload.

This simplifies the implementation and the behavior:
* the behavior is always the same even if there were already multiple
  companies selected: if one wants to add new companies they should use
  the check box instead.
* there is no more confusion due to the storage of the symetrical
  difference when toggling multiple companies and their children before
  the reload.

closes odoo/odoo#135086

X-original-commit: b07b30cd4b2a3e821a24761075ae0aecee332b14
Related: odoo/enterprise#47265
Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-09-11 23:59:51 +00:00
Soukéina Bojabza 68d89150b1 [FIX] website: fix traceback when customizing Google Map API key
Since commit [1], which converted the wysiwyg to Owl, trying to
customize the Google Map API key causes a traceback.

Steps to reproduce:
- In edit mode, go to the "Theme" tab.
- Click on the Google Map "Custom Key" button.
=> A traceback appears.

It happens because when getting the parent with the `this.getParent()`
call, the parent is now a `WysiwygAdapterComponent` component and so,
calling the `trigger_up` function on it does not work anymore.

This commit triggers the `gmap_api_key_request` event in a way that is
compatible with the Owl component.

[1]: https://github.com/odoo/odoo/commit/76d4f9811b756f0e57b0a33dbba534c900c7fe15

opw-3489976

closes odoo/odoo#135069

X-original-commit: 355a593fe2dea05a96d0491d684722770533ab7d
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-11 23:59:48 +00:00
padh-odoo 619e5e0dad [FIX] sale: fix the sale order portal view
issue-:
   Broken the portal view because of totals.

Why the problem occurred:
    The col and margin both class are removed in below commit-
 https://github.com/odoo/odoo/commit/22c47fb003c7cfaccb732de5b8ea7277b9dade54

 fix:
  we re-induced col and margin class

task-3442343

closes odoo/odoo#135068

X-original-commit: a2fbda054a75e8dafcfa7d6f2c5897dda8846e4c
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-09-11 23:59:47 +00:00
Odoo's Mergebot 0304ede923 [MERGE] (test_)mail, various: prepare MC environment for mail tests
Purpose of this merge is to further cleanup and prepare tests for
multi-company enabled aliases, notably

  * activate multi-company environment by default in all mail tests;
  * avoid multiple init of gateway parameters;
  * fix leftover of bad alias management;

Followup of odoo/odoo# 130768 and odoo/enterprise# 45204

Followup of Task-3453577 (TestMail: Update Alias/Gateway tests for MC)
Followup of Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

closes odoo/odoo#135055

Related: odoo/enterprise#47243
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-11 22:41:16 +00:00
Thibault Delavallée 3ea89e4d57 [FIX] test_mail, various: remove extra gateway initialize
When inheriting from the mail test class gateway initialization is done
automatically. No need to call it again.

Task-3453577 (TestMail: Update Alias/Gateway tests for MC)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#135055
2023-09-11 22:41:16 +00:00
Thibault Delavallée 3cbd037d02 [IMP] (test_)mail: activate multi-company by default
Have all mail tests be in a controlled multi-company environment by default.
Remove extra calls to '_activate_multi_company' as it is now part of the
base 'MailCommon' test class.

Task-3453577 (TestMail: Update Alias/Gateway tests for MC)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#135055
2023-09-11 22:41:16 +00:00
aliya d914e60b2c [FIX] account: fill the journal code for general journal type
Currently, when a journal is created during import, we just use the journal name as the code.
However, that gets truncated to 5 characters on create, which can conflict with existing journals.
The import should be as flexible as possible, as it's better to let users import and fix things
after the import rather than debug the import file.
- If there is a journal with a shortcode that matches the truncated name of the new journal,
  just use the existing journal (enterprise PR)
- If the shortcode conflict arises within the imported file
  (so the journals don't exist before the import), keep track of the codes in `vals_list`.
  The `get_next_bank_cash_default_code` is modified to avoid duplicating code.

See also odoo/enterprise#46101

closes odoo/odoo#135051

X-original-commit: 1161307dc59d0c98eb1352fd80d95da7dc98e700
Related: odoo/enterprise#47242
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
2023-09-11 22:41:13 +00:00
Aaron Bohy 3faa9ab0a5 [FIX] web: resequence x2many ordered by id but id not in view
Have a form view with an x2many list with handle field and a
default_order containing id (e.g. sequence,id), but id not being
defined in the list view. Before this commit, on an existing
record, it was impossible to resequence records of the x2many.

The reason is that after resequencing (drag&drop), the model tried
to sort the records, and since the "id" field wasn't in the view,
but was in the default_order, records were reloaded and the changes
(the new sequences) were lost.

The "id" case is special because the field doesn't need to be set
in the view, it is always known by the model. However, it is only
available in record.data if it is defined in the view. This commit
treats the "id" field individually in the sort algorithm.

Bug reported in the new relational model feedback pad.

closes odoo/odoo#135045

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-09-11 22:41:11 +00:00
Touati Djamel (otd) 237748a980 [FIX] mrp: clear component when the BoM Changes
Steps to Reproduce the Bug:

- Create a storable product "P1" with 2 Bills of Materials:
   - BoM 1:
     - Component: C1
   - BoM 2:
     - Component: C2

- Create a MO:
   - Select BoM 1.
   - Save.
   - Select BoM 2 without saving. Result: The component C1 is deleted
   and replaced by the component of BoM 2.
   - Select BoM 1.

Problem:
The component of BoM 2 is not cleared. Because we check if the new BoM
is different from the original one, but since we didn't save the change
when selecting BoM 2, the `move_raw_ids` are not cleared.

Solution:
Clear the `move_raw_ids` if any move with `bom_line` is not linked to
the current BoM.

OPW-3473387

closes odoo/odoo#135044

X-original-commit: f874fd46fcf8c2668c6d2ab42224196868ec0f0a
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-09-11 22:41:11 +00:00
Mathieu Walravens 6a0952a5b1 [FIX] stock: clean-up sequences at uninstall
When stock is uninstalled, the sequences used in the warehouses for the
picking types are kept. However, since [1], picking types cannot be
duplicated anymore. When the module is re-installed, the picking types
are created with the same name, which is not allowed by [1].

[1]: https://github.com/odoo/odoo/commit/9034602a028fb22fbd139cf41a2f5c71d9d8d032

opw-3484352

closes odoo/odoo#135036

X-original-commit: 7b0f38fea8bc9a541972d29f289e6175ee15919b
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com>
2023-09-11 22:41:10 +00:00
Aaron Bohy 2582c488b3 [IMP] web: mark field as invalid if onchange returns error
Before this commit, if an onchange returned an error, the faulty
value was kept in the UI and there was no feedback given to the
user besides the error being displayed in a dialog. However, the
former value was still the one stored in the model, which produced
a discrepancy between model and UI.

This commit tackles the issue by marking the field as invalid in
this case (like when you input letters inside a numeric field).
That way, the value in the model is still different from the one
in the UI, but the field is stored in the list of invalid fields,
it is displayed in red, and the view can't be saved (it can be
discarded though).

Task~3498849 (master version, which differs from 16.0, see [1])

[1] odoo/odoo#134792

closes odoo/odoo#135017

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-09-11 22:41:09 +00:00
David Monnom (moda) b9391de7a4 [IMP] pos_self_order: improve QR code page
Following AVW's review, the following changes have been made to the QR
code page:
- Generic QR codes are only added when in QR menu mode.
- Generic QR codes now fit on a single page.
- There is now a sample URL in the description.
- UI change.
- Description change.

Other fix:
Before, fields in res_config_settings.py were not `related` to fields in
pos_config. These have now been changed to `related` fields.

The compute function managing these old fields has also been removed.

closes odoo/odoo#133137

Taskid: 3478173
Related: odoo/upgrade#5112
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
2023-09-11 22:41:06 +00:00
Odoo's Mergebot b43da4dc8a Master forum pimp and pump promenade loma
website_*

* = forum, profile, slides, slides_forum, slides_survey

Purpose
=======
Make it possible for users to have an overview and search in all forums. This includes searching for posts of other users, and their own upvoted posts, much like /slides/all.

Give users a better experience when browsing website profiles looking for courses, certifications, forum questions, ...

Specifications
=============
Add route for `/forum/all`

change templates in `website_forum` to show posts even if `forum` is not specified to shows results and search in all forums

Add search bars for Questions, Answers and Upvotes, small UI changes here and there.

Task-2676848
Co-authored by: Fabio Barbero <faba@odoo.com>

closes odoo/odoo#129123

Related: odoo/enterprise#47207
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-11 22:41:03 +00:00
Lopes Marc (loma) a23b9089ac [IMP] website_*: improve profile view
*= forum, profile, slides, slides_survey

Purpose
=======
Give users a better experience when browsing website profiles
looking for courses, certifications, forum questions, ...

Specifications
=============
Add search bars for Questions, Answers and Upvotes, small UI changes
here and there.

Task-2676848
Based on #79372

Co-authored by: Fabio Barbero <faba@odoo.com>

Part-of: odoo/odoo#129123
2023-09-11 22:41:03 +00:00
Lopes Marc (loma) 4bb00c2e83 [IMP] website_forum:enable searching across all forums
Purpose
=======
Make it possible for users to have an overview and search in all forums.
This includes searching for posts of other users, much like /slides/all.

Specifications
=============
- add routes for `/forum/all`
- change templates in `website_forum` to show posts even if `forum` is
not specified to shows results and search in all forums

Task-2676848
Based on #79372

Co-authored by: Fabio Barbero <faba@odoo.com>

Part-of: odoo/odoo#129123
2023-09-11 22:41:03 +00:00
mehjabinfarsana 0e992e3a3e [IMP] base: allowed format for import translation
before this commit, in the import translation
wizard, if user try to import a file
currently it will show any file types to
upload even though supported formats are
csv and po

after this commit, if user try to import a
file only csv and po files will be shown

closes odoo/odoo#128807

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-09-11 22:41:02 +00:00
vlst 0ffd04e7de [IMP] point_of_sale,pos_self_order: handling product attributes
When selecting an attribute value in POS, what we store is the `description`,
which is a string that represents the selected attribute values.
Ex: selecting `Size: M` and `Material: Leather` will result in the description:
`(L, Leather)`.

This choice does not lead to a logical API for dealing with product attibutes.

In this pr, we add a new field that stores the selected `ids` of
`"product.template.attribute.value"` and remove the
`selected_attributes` `Json` field from the `pos_self_order`
override of the `pos.order.line` model.

The `attributeHelper` function from the `tour_utils.js` file
from `pos_self_order` is improved such that it can now handle
both checking if a certain attribute is selected and actually
selecting an attribute.

closes odoo/odoo#126398

Task: 3378533
Related: odoo/upgrade#4992
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-09-11 22:41:01 +00:00
Dominik ZiansandLouis Baudoux 95d453e11e [FIX] crm_iap_mine: combined search of countries with and without states
Previously, when searching for leads from Belgium and from the state of
California, in the US, only companies from California would be returned.

This was due to the way the query was built, it looked like this:

`country IN ('Belgium', 'United States') AND state = 'California'`

instead of :

`(country = 'United States' AND state = 'California') OR country =
'Belgium'`

closes odoo/odoo#71617

Task: 2543169
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
Co-authored-by: Louis Baudoux <lba@odoo.com>
2023-09-11 22:41:00 +00:00
Robin Lejeune (role) 03bea918ba [FIX] web_editor: remove regex look-behind for browser support
Commit [1] used a regex with positive and negative look-behind
assertions, which is not supported before Safari 16.4 [2].
This commit rewrites the regex with a more widely supported syntax.

[1]: https://www.github.com/odoo/odoo/commit/73317cb
[2]: https://caniuse.com/js-regexp-lookbehind

task-3497427

closes odoo/odoo#134658

Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-09-11 21:12:43 +00:00
Aaron Bohy 0d7acf60b4 [REF] *: remove legacy Markup
Use owl.markup instead.

Part of task~3439226

closes odoo/odoo#134793

Related: odoo/enterprise#47124
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 19:13:59 +00:00
Xavier-Do 7b6704413f [IMP] mail: avoid getting field description
When calling track_prepare, an important part of the logic is getting
description in fields_get. We actually don't need the description,
fields_get is mainly use here to check for groups, but the dictionnary
is immediately transformed to a set making values irrelevant.

The same optimisation is done in _message_track, usefull to avoid an
additionnal query in test_recurring_order_creation_perf, because of a
value not in cache.

closes odoo/odoo#134689

X-original-commit: a7e7f90531a21af99a4c95abb829f8f6de94f68a
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-09-11 19:13:58 +00:00
0903ef7bb2 [MOV] *: move all PWA to community
In this commit, we moved all features related to the PWA and the PWA
itself to the community.

This includes:
* PWA
* Web Push Notification
* VCARD

Note from original commits:
===========================

PWA (part 1)
------------
This commit adds a ServiceWorker to complement the WebManifest to
complete the setup of the backend as a Progressive Web App.

More precisely, it adds the route, registration and the most basic
ServiceWorker to allow the backend to be recognized as an installable
PWA.

References:
- https://web.dev/install-criteria/
- https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs
- https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers

Task ID: 3063485

PWA (part 2)
------------
This commit adds a WebManifest as a first step toward setuping the
backend as a Progressive Web App.

In a nutshell:
- the web app's name is configurable through a config parameter
  (available in the Settings, in debug); defaulting to "Odoo".
- the web app's icon has been revamped to accommodate the required sizes;
  also its design matches the one from the Android app.
- "theme-color" is used to color part of the browser/system UI to match
  Enterprise brand color; also supports the dark mode.

References:
- https://web.dev/learn/pwa/web-app-manifest/
- https://web.dev/install-criteria/
- https://developer.mozilla.org/en-US/docs/Web/Manifest

Task ID: 3063485

PWA shortcuts
-------------
The main goal of this commit is like we did inside the `Android Odoo
Mobile App`, allowing users to have some Odoo application shortcuts.
We added the following apps in the key `shortcuts` on `web.manifest` in
these orders: `Discuss`, `CRM`, `Project`, `To-Do` (old `Notes`).

Links:
- https://w3c.github.io/manifest/#shortcuts-member
- https://developer.mozilla.org/en-US/docs/Web/Manifest/shortcuts

Task ID: 3123607

Offline mode
------------
This commit introduces a way to notify the user that he's "offline"
(aka. cannot reach its Odoo server) and that Odoo doesn't work in a
graceful way in this circumstance.

To do so, the Service-Worker will return the response of the
´web/offline´ route, which is cached at its setup.

Note: this screen is only show when launched while "offline" and fails
to load the requested page. It does not "interrupt" the WebClient to
show this screen when the connection drops off (cf. not a replacement
for the existing notification).

Task ID: 3203639

WebPush
-------

WebPush allows sending data to the user browser/app(PWA) even when
tab/app is closed. Web push is a "constant" link between the
ServiceWorker of browser/app and a WebPush server.

Note that each browser has its own custom WebPush server.
e.g.:
Chrome: https://fcm.googleapis.com/
Firefox: https://updates.push.services.mozilla.com/
Safari: https://web.push.apple.com/
Edge: https://wns2-ln2p.notify.windows.com/
WebPush introduces some cryptographic notion to ensure some the
reliability of the data sent:

VAPID: "Voluntary Application Server Identification" is the standard
used to generate the public and the private to sign the message
between the browser and the WebPush server
JWT: "JSON Web Token" is the standard used to sign the payload to the
WebPush server
ECE: "Encrypted Content-Encoding" is the standard used by WebPush to
encrypt the data of the payload to avoid sending RAW data
outside trusted network.
Simplified steps how to WebPush works:

The Javascript code of a web page subscribes to the WebPush server
(using the VAPID key generated at mail_entreprise install).
The WebPush server replay with a subscription (and some other info
like the unique URL endpoint per subscription where to send a
notification)
The application (odoo-bin in our case) sends a post request to the
WebPush server using the specific URL endpoint of the user (using JWT
and ECE).
The WebPush server sends back to the browser the encrypted payload.
The browser decrypts the payload and sends it to the ServiceWorker
linked to the subscription.
Here is a Sequence diagram of all interactions to process a web push
notification.
In Odoo, we use WebPush to send Notification to the user.

This commit aims to have a parity with the Android/iOS Mobile App at
the notification level.

Notes:

There are some ways to encrypt (ECE) the message for WebPush:

AESGCM128: this is a draft
AESGCM: very well documented
AES128GCM: RFC8188 Standard encoding
We implement only the RFC one as it is the only one implemented in all
major updated browsers (Chrome, Firefox, Safari, Edge, ...)
You need to allow the desktop "Notification" and "Push" inside your
browser. For iOS Devices, it only works on iOS 16.4+ and it's requiring
Odoo to first be added to the Home Screen. It's delivered silently,
meaning no sound, vibration, haptics or screen wake.

Note:
Notifications are sent directly if there are less than five
notifications, otherwise we use a cron triggered immediately.
Also, we have changed the value of the "QueryCount" as mail_enterprise
executes a new query to search the devices associated with the partner.

We have added a "try/except" for any Exception before the
push_to_end_point method as we want to avoid blocking a normal flow
just for a not mandatory push notification if something happens during
the push to the endpoint.
See: odoo/enterprise@d0ae70103d

Links:
https://www.rfc-editor.org/rfc/rfc8030
https://www.rfc-editor.org/rfc/rfc8188
https://www.rfc-editor.org/rfc/rfc8291
https://www.rfc-editor.org/rfc/rfc8292
https://w3c.github.io/push-api/index.html
https://autopush.readthedocs.io/en/latest/http.html
https://web.dev/push-notifications-web-push-protocol/
https://github.com/web-push-libs/encrypted-content-encoding
https://github.com/web-push-libs/pywebpush
https://github.com/web-push-libs/vapid
https://caniuse.com/push-api
Task ID: 3123678

VCARD
-----
In the process of replacing the native methods exposed in the mobile
apps, this commit implements the download of a vCard containing a
partner's information.

By using this standard format, both regular web users and mobile ones
are now able to save the partner's details to use them with their usual
address book software.

On a mobile device, the actual import of those informations is delegated
to the operating system.

References:
- https://datatracker.ietf.org/doc/html/rfc6350
- https://en.wikipedia.org/wiki/VCard
- https://github.com/eventable/vobject#vcards

Task ID: 2583916

===========
End of note
===========

Task ID: 3478014

closes odoo/odoo#133560

Related: odoo/enterprise#46530
Related: odoo/upgrade#5086
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: Romeo Fragomeli <rfr@odoo.com>
Co-authored-by: Romain Estievenart <res@odoo.com>
Co-authored-by: Pierre Paridans <app@odoo.com>
2023-09-11 16:32:30 +00:00
Thomas Becquevort (thbe) 9d5bc32036 [IMP] base: currency symbol editing without debug mode
Description of the issue/feature this PR addresses:

Prior to this, when multiple currencies with the same symbol where to appear
in a same document or be sent from a country to another with the same currency
symbol, the only information the recipient had was
the currency symbol leading to lack of clarity.

Desired behavior after PR is merged:

This set of two PR has for objective to give the user the possibility to edit
the symbol curency that is displayed everywhere so that if he feels like the
documents and views are lacking clarity, he can improve it.

This was already an option before but only when the debug mode was active.

This commit has the purpose of moving the currency symbol option out of the debug mode section and put it in the right column of the currency form view.

Adding this, the "Symbol" option is moved out of the debug mode.

task-3484335

closes odoo/odoo#133554

Related: odoo/enterprise#46527
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-09-11 16:32:28 +00:00
kir-odoo dd00ad07fe [IMP] stock: improve the pivot view for better visualization of stock variation
- Menu stock move renamed into 'moves analysis'
- the `moves analysis` menu presents an open default pivot view with
predefined filters and group by that facilitate the visualization of
stock variations based on quantity
- Add some default filters too in the moves history pivot view

closes odoo/odoo#126981

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-09-11 16:32:26 +00:00
std-odoo 3ec29a8e42 [FIX] mail_plugin: fix access error when enriching some partners
Bug
===
When we enrich a partner we don't have access to, it will try to read
it, but because of the ACL if will crash. To fix that issue, we don't
return the partner if we can't access it and we show an error message
in the UI instead of letting it crash.

Task-3344536

closes odoo/odoo#135025

X-original-commit: a3dcae1eebe7920ae788d5ff6d12c45e19a9628d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-09-11 15:22:15 +00:00
tsm-odoo be35b9f519 [FIX] im_livechat: actions on frontend messages
This commit prevent the livechat visitor from executing actions
on frontend messages (that are not known by the server).

Steps to reproduce the issue:
- Open a livechat with an operator
- A welcome message is displayed ("How can I help you?")
- Add a reaction to this message
- A crash occurs

closes odoo/odoo#134987

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-11 15:22:13 +00:00
tsm-odoo 39a4d85de3 [FIX] mail: fix push to talk key detection
Before this commit, the push to talk key combination was wrongly
detected. Indeed, it was dependent on which key was pressed first.

Steps to reproduce:
- Register "ctrl + alt" as the push to talk key
- Press control then alt, push to talk does not work
- Press alt then control, push to talk works
- If you unpress the alt key, the push to talk will stop as expected
- If you unpress the control key, the push to talk will keep going

This commit fixes the issue.

closes odoo/odoo#134981

X-original-commit: 3e4ed2a43ad23116c095af67cb7e5736a9854820
Signed-off-by: Thanh Son Dodeur (tso) <tso@odoo.com>
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-11 15:22:12 +00:00
Odoo's Mergebot d1c5c4718f [FW][MERGE] base, (test_)mail, various: be defensive in email formatting
PURPOSE

Be defensive when dealing with email fields, notably when having multi-emails
or email field containing an already-formatted email.

RATIONALE

Two main use case of corner case usage of 'email' fields are tested in this PR
and their support is improved

  * formatted emails: `"Full Name" <email@domain.com>` stored into the 'email'
    field;
  * multi emails: `email1@domain.com, email2@domain.com` stored into a single
    'email' field;

IMPLICATION

Email field is generally managed as "containing a valid email". This means
it is sometimes used as it in 'formataddr' as well as to perform searches or
identification checks. Example of issue: partner 'Raoul' has a formatted email
like "Raoul" <raoul@raoul.fr>. Using 'formataddr' in email_from leads to

  from: "Raoul" <"Raoul" <raoul@raoul.fr>>
  -> which is incorrect (but often dynamically corrected by email servers);

Email field holding multi-emails are not normalized, as current normalize
is done only if the field holds a single email. It means

  * no easy finding based on 'email_normalized', e.g. various tools like
    '_mail_find_partner_from_emails' or 'find_or_create' do not find partners
    based on this email;
  * no exclusion list management;
  * issue with formatting, like

  to: "Raoul" <raoul@raoul.fr,raoul.other@raoul.fr>
  -> which is incorrect (but often dynamically corrected by email servers);

USAGE: OUTGOING EMAILS

Those use cases currently generate faulty outgoing emails. This is valid for
recipients ('email_cc', 'email_to') as well as author ('email_from').

For formatted emails: `email_to` is formatted again based on name and email
which leads to sending emails to `"Full Name" <"Other"<email@domain.com>>`.

Note that multi emails without formatting may work as it leads to email_to
`"Full name" <email1@domain.com,email2@domain.com>`. Some outgoing email
servers correctly send multiple emails. It depends on their fault
tolerance.

USAGE: FIND BASED ON EMAIL (NORMALIZED)

When searching for partners (e.g. using '_mail_find_partner_from_emails' or
'find_or_create') normalized version of input is used.

In case of multi emails sanitize is 'False', as normalization expects a single
email in the field. Therefore no partner is found. In processes that do a
"search or create" (e.g. using a template on a record) this leads to creating
a new partner (or several partners in case of multi emails) each time.

USAGE: OTHER FLOWS

Other flows are build on top of '_mail_find_partner_from_emails' / 'create'
of outgoing emails and are impacted by formatted email / multi email usage.
Those include notably

  * mass_mailing: '_message_get_default_recipients' should be defensive to
    give correct values when creating mailing emails;
  * mass_mailing: faulty emails is based on normalize and multi-emails are
    considered as faulty and ignored;
  * after post hook: '_message_post_after_hook' tries to link messages without
    author (but email_from) with newly-created partners, when partners are
    created from chatter. It is therefore impacted by those corner cases;
  * marketing_automation: built on top of mass_mailing and suffers from the
    same issues;

USAGE: UNICODE

Unicode in emails should be supported. 'formataddr' and IrMailServer notably
received fixes to support unicode. Some check performed on email addresses
fail when unicode is involved, which leads to some emails not being sent
while they could.

USAGE: WRONG EMAIL FORMATTING

With input 'name email@domain.com' (missing chevrons allowing to clearly spot
the email part) 'getaddresses' returns ('', 'name email@domain.com) i.e. the
whole input is considered as being the email.

To improve the heuristic we can add a fallback by recalling 'getadresses'
on the input with spaces replaced by commas when it found only an email and
no name. The new email will be split into sub pairs allowing to find the real
email and various name parts, allowing to make a new name / email pair.

Emails should not contain spaces thus this is coherent with email formation.
This fallback actually comes from a specific code done in '_parse_partner_name'
of Partner model. Supporting it directly at tools level make the behavior
coherent for all models.

SPECIFICATIONS

This PR contains first tests to cover current support of those use cases. Then
we gradually improve support of multi-emails and formatted emails in various
layers of mail code, from mail.mail to mass_mailing or email formatting.

See individual commit for more explanation, each of them solving a specific
issue / use case.

Task-2612945 (Mail: Defensive email formatting)

closes odoo/odoo#134934

Forward-port-of: odoo/odoo#134888
Forward-port-of: odoo/odoo#74474
Related: odoo/enterprise#47183
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-11 15:22:09 +00:00
Thibault Delavallée 6ee4cc1317 [FIX] mail: correctly parse formatted email in JS
Formatted emails using our own formataddr contains quotes to correctly
separate name from emails, like'"Name" <email@domain.com'. However
JS parse function does not correctly handle quotes, assuming everything
being left of opening chevron is the name.

Task-2612945 (Mail: Defensive email formatting)

X-original-commit: odoo/odoo@c5b39cfb64
Part-of: odoo/odoo#134934
2023-09-11 15:22:09 +00:00
Thibault Delavallée 64aae8bce1 [FIX] tools, base, mail: add a fallback when parsing wrongly-formatted emails
With input 'name email@domain.com' (missing chevrons allowing to clearly spot
the email part) 'getaddresses' returns ('', 'name email@domain.com) i.e. the
whole input is considered as being the email.

To improve the heuristic we can add a fallback by recalling 'getadresses'
on the input with spaces replaced by commas when it found only an email and
no name. The new email will be split into sub pairs allowing to find the real
email and various name parts, allowing to make a new name / email pair.

Emails should not contain spaces thus this is coherent with email formation.
This fallback actually comes from a specific code done in '_parse_partner_name'
of Partner model. Supporting it directly at tools level make the behavior
coherent for all models.

Task-2612945 (Mail: Defensive email formatting)

X-original-commit: odoo/odoo@18c71edf59
Part-of: odoo/odoo#134934
2023-09-11 15:22:09 +00:00