Commit Graph
161364 Commits
Author SHA1 Message Date
Florent de Labarre 4382e003fd [FIX] sale: paylink does'nt work
if partner_id is diff than partner_invoice_id on sale.order.

https://github.com/odoo/odoo/blob/16.0/addons/sale/controllers/portal.py#L346

- go to runbot
- create a sale.order
- set partner_invoice_id != partner_id
- create a link
go to the link --> error

closes odoo/odoo#121905

X-original-commit: 811ed2fb763155abbaba29e8c9193166a9cc34cc
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-05-22 13:54:13 +02:00
Xavier Luyckx (xlu) 4f37525de4 [FIX] mail: CategoryItem buttons, adapt for milk
With redesign of web client style, buttons by default are now rounded
, this commit removes the border-radius for the members list buttons in
discuss sidebar.

task-3329620
part of task-3326263

closes odoo/odoo#121904

X-original-commit: 3d2953e4129ac3267dc08eeebda5cdc3569e4b62
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-05-22 13:54:10 +02:00
Brieuc-brd 6fcb435c08 [IMP] account: update l10n icon
Since the introduction of Milk, the new l10n icon needs to be updated to
match the new app icons.

This commit fixes this issue.

task-3326633
Part of task-3326263

closes odoo/odoo#121886

X-original-commit: 6b5738674fa64b54d31f18e0e5451b458dbc8f7c
Related: odoo/enterprise#41279
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-05-22 13:54:08 +02:00
Brieuc-brd fa60bac197 [IMP] *: app icons : add viewBox attribute
Prior to this commit, the SVG's viewBox attribute was missing, which
prevented svgs from being scaled.

This commit fixes this issue.

task-3326633
Part of task-3326263

X-original-commit: 30300c373ad1c63a6cf8b035cae0785a09c6933f
Part-of: odoo/odoo#121886
2023-05-22 13:54:08 +02:00
Brieuc-brd ee75969979 [IMP] *: app icons: replace svg to png
The introduction of Milk has brought new app icons.
Using the svg format creates a lack of anti-aliasing on the edges of the
shapes, which makes the icons look bad.
Since the png size has been reduced, we can afford to use the png format
to have the best possible quality without having a lack of performance.

task-3326633
Part of task-3326263

X-original-commit: e07cb722f2b11407a3ad093bd688b7d37afd5a88
Part-of: odoo/odoo#121886
2023-05-22 13:54:07 +02:00
Brieuc-brd 88250e3714 [FIX] base: replace missing app icons
Since the introduction of Milk, the app icons have been updated.
But before this commit, some of these icons were not replaced in the
list of apps in Community.

This commit fixes this issue.

task-3326633
Part of task-3326263

X-original-commit: 1f6294526675a49acc9c610f59749c82e5a47bef
Part-of: odoo/odoo#121886
2023-05-22 13:54:07 +02:00
Denis Ledoux 108f85f9be [IMP] base_import_module: deprecate module import from addons path
We no longer want to support importing data modules from within
the addons path.
Only modules imported with an archive and extracted in a temporary
folder are supported.

closes odoo/odoo#121881
2023-05-22 13:53:59 +02:00
Thomas Lefebvre (thle) 61ba5037dc [FIX] google_calendar: edit schedule of recurring event
Steps to reproduce:
-------------------
We google calendar, create a recurring event with
three occurrences.
We obtain 3 events in chronological order:
- A
- B
- C
Change the title of the event B and apply the changes
to the following events.
We get:
- A: First title
- B: Second title
- C: Second title
Modify the schedule of event C and apply the changes
only to this event.
We get:
- A: First title + First schedule
- B: Second title + First schedule
- C: Second title + Second schedule
Synchronize Google calendar with Odoo.

Issue:
------
Event C is "duplicated".
Event C will exist with the first schedule
and the second schedule.

Cause:
------
A recurrent event with `google_id` is equal to
`ID_RANGE_TIMESTAMP` can be rescheduled.
If this is the case, its `google_id`
will be equal to `ID_TIMESTAMP`.

We do not manage the deletion of the event
that belongs to the old `google id`.

Solution:
---------
When we detect a recurring event with
a modified schedule, we have to delete the event
from the old `google_id`
(which is the event with the old schedule).

For this, it is necessary to find
the old `google_id` based on the elements contained
in the `id` and the `recurringEventId` of the event.

opw-3143680

closes odoo/odoo#121825

X-original-commit: 3f145af00307383e2d0a0891d05b8db59b13662a
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-05-22 13:53:56 +02:00
Xavier-Do 35e2ea33c7 [FIX] base: fix js unique (missing template)
This error was intoduced in #121159
The javascript unique should also be based on templates.

closes odoo/odoo#121842

X-original-commit: 2a7c6640357b4d6fc0c539b5d8d5e6dd80882d5b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-05-22 12:48:39 +02:00
Kartik Chavda f71a9cc8dc [FIX] hr_timesheet: add formatters for uom timer widget
Before this commit timesheet uom timer not displaying proper
aggregated value because it was not added in formatters registry.

This commit add timesheet uom timer widget in formatter registry to
display right value when timesheets are encoding in days and views
are displaying aggregated value(e.g. total in list view).

task-3251672

closes odoo/odoo#121788

X-original-commit: ef20722b9d4513519ef78ab6e973edda4fa4d7fc
Related: odoo/enterprise#41252
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-05-22 12:48:36 +02:00
Stanislas Gueniffey 0cf2437f67 [IMP] web_editor: remove dead '_onInput' code
The 'insertLineBreak' case in `onInput` is dead code because any event
that might cause it (pressing Shift+Enter) first triggers `onKeydown`,
which calls `ev.preventDefault()` and thus prevents it from reaching
`onInput`.

Task-3301232

closes odoo/odoo#121850

X-original-commit: c63cd2f0140959a7ac6e05ef15ac5c2ac552453d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-05-22 11:43:11 +02:00
Carlos Carral a39f9fcf11 [IMP] sql.py: Take into account materialized views when dropping them
The function `drop_view_if_exists` only works when the view in question is a
regular view. Here we allow for materialized views to be dropped without any
extra logic added from the caller side.

closes odoo/odoo#121814

X-original-commit: f0db3454bde6759af9aa1b3c2751845a3b2949e7
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-05-22 11:43:09 +02:00
Denis Ledoux 58ea5e7b43 [IMP] http.py: do not inject context by default in JSON routes
Before this revision, when you pass `context` in the arguments
of a JSON routes, this one gets automatically injected
in the environment context.

This is not the case for regular HTTP routes.

It makes sense to propagate the context for the JSONRPC protocol,
JSON routes used by the backend, such as `call_kw`,
but it doesn't make sense to pass this context automatically
for any other kind of routes, such as front-end routes
or routes used by custom Javascript widgets.

This change brings a more unified behavior for routes
of types HTTP and JSON.
In addition, most developers were not aware of this "feautre",
that passing `context` in the arguments of a JSON route leaded
to the injection of this context in the environment context.
This is actually reflected by the diff size this changes required,
only a dozens of routes needed to be adapted, to manually
add the context in their route arguments and to inject it
in their environment context.

closes odoo/odoo#121726

X-original-commit: a7a5655631e6d5b05fd2ba3d0c80617aae6d9cfe
Related: odoo/enterprise#41229
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2023-05-22 11:43:04 +02:00
tsm-odoo ea3008cc49 [IMP] mail, im_livechat: use ui service instead of store.isSmall
Since [1], the ui service is reactive which removes the needs for
the `mail.store` service to maintain a reactive version of `isSmall`.

This PR replaces the use of `store.isSmall` as well as `env.isSmall`
by the ui service.

1: https://github.com/odoo/odoo/pull/121343

closes odoo/odoo#121590

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-05-22 11:42:58 +02:00
pedrambiria fc002590db [FIX] google_calendar: use the event user token to send the request
Before this commit: it was possible to create an event for another user as
its organizer. But even if that user has a synchronized Google calendar, it
will be sent by the current user token, and it causes several issues.

The solution is to use the event's organizer token if it exists.

opw-3076595

closes odoo/odoo#120368

X-original-commit: 966943168dc9da0622485a46b0786ed5765eaf77
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2023-05-22 11:42:55 +02:00
Arnaud Baes 18f89fadfc [FIX] base_import_module: extract only used files and thread-safe
For performance reasons, instead of extracting the whole
zip, extract only the files which are actually used
during in the `_import_module`, in case people
put additional crap in the archive which are ignored
during the import. That way, we avoid useless I/O.

Also, adding the temporary directory in the addons
path wasn't thread-safe.
This revision changes this to make the module
import feature thread-safe.

closes odoo/odoo#80120

Signed-off-by: Pierre Masereel <pim@odoo.com>
2023-05-02 13:48:57 +02:00
uso-odoo 57ef86e462 [FIX] base: prevent traceback of XMLSyntaxError
when the user did a mistake in any view from UI, like missing the closing tag or
did any syntactical mistake in any view (standard or custom view) during that
time  XMLSyntaxError is generated. Instead of traceback we can show
ValidationError to User.

Steps To Produce:- (This is only for example)

1) install 'industry_fsm' and make debug mode on
2) Go to 'Project', Open any Project
3) Go to debug mode > Edit View: Kanban
4) remove the 'closing tag' of the 'attribute tag' and try to save.

The error will be generated.

Applying these changes will resolve this issue.

sentry - 4157344102

closes odoo/odoo#121855

X-original-commit: ff6bfbdfd6eaf994e4ceca2cf8770301602c5650
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-05-22 09:27:26 +02:00
Guillaume (gdi) 1b77b3c214 [FIX] website: compute company id for new users
When a new user is created from the website, the company id was always
set to the first company of the database even if the website was the one
of another company. This flow has been already fixed if there is the
"Specific User Account" setting activated (see [this other commit]).
This commit fixes the same issue but for every case.

Steps to reproduce the issue:
- Create 2 companies A & B
- For each company, create a website linked to a different URL
- Activate 'Free sign up' for company B
- As a public user, go to website of company B
- Go to 'Sign in > Don't have an account?' and create an account

=> If as an admin you check the company of the created user, it is
company A instead of company B.

[this other commit]: https://github.com/odoo/odoo/commit/77c708c516beb322df37220634e178ba82e894c9

task-3277317

closes odoo/odoo#121834

X-original-commit: 3fbfb5301c7583583e4f46c9b4ef16e048e5800c
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Dieleman Guillaume (gdi) <gdi@odoo.com>
2023-05-22 09:27:23 +02:00
MerlinGuillaume 7fba2423c6 [FIX] web: open a notification when fields are invalid in a dialog
There is no notification telling which field are invalid when we try to
save a form in a dialog

Steps to reproduce:
1. Install Survey
2. Go to Survey and open any survey
3. Add a question in the survey and try to save it (without entering a
   title)
4. There is no notification. Although the invalid field is highlighted
   in red, it could be tricky to see it if the field is in a tab

Solution:
Create a method in Record that sends the notification and call it when
the record is not valid in X2ManyFieldDialog

opw-3196166

closes odoo/odoo#121705

X-original-commit: 58f89915c0ad447f0c5896739219f0812cfd4a6a
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-05-22 08:21:19 +02:00
smna-odoo 9109d3ce2a [FIX] base: ignore custom view issue in sentry traceback
Currently when a QWebException raise Exception which will be caught by sentry
and causes unnecessary traffic.

So, we stop catching QWebException which are supposed to be generated by User's
Mistakes.

sentry-4137969310

closes odoo/odoo#121841

X-original-commit: 2859143c9b2950578385b66126178f27db750863
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
Signed-off-by: Smit Nagar (smna) <smna@odoo.com>
2023-05-20 15:39:15 +02:00
hupo-odooandNshimiyimana Serge Séna b01bfb0ab9 [FIX] account: cash rounding
Fix the cash rounding displayed on accounting documents such as customer invoices, credit notes, vendor bills and vendor refunds. The amount that was computed was incorrect in most case. The only case that was working was the customer invoice when using the company currency. The PR address the issue of cash rounding for all account move type and when using foreign currencies as well.

Steps to Reproduce
 - Activate Cash Roundings.
 - Create a half-up cash rounding with a precision of 1.
 - Create a new bill with a pre-tax amount of 378 and a tax rate of 15%
 - Apply the cash rounding to the bill and save.
 - Review the "Total Rounded" value.

Expected Results:
The 'Total Rounded' value should be 435.00

Actual Results:
The displayed 'Total Rounded' value is 434.40

opw-3235723
opw-3236011
opw-3277942
opw-3271713

task-3257577

closes odoo/odoo#121828

X-original-commit: 80d0dae161f9147d6675e2464310c491a5bd3727
Signed-off-by: hupo-odoo <hupo@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: Nshimiyimana Serge Séna <sesn@odoo.com>
2023-05-19 16:42:13 +02:00
yhu-odoo 317798107a [FIX] mrp: can't provide bom when _get_lead_deys
In _get_lead_days, it always try to use the first bom of the product.
After 6825c44, days_to_prepare_mo is moved from product to bom. To
correctly calculet the lead days, we sometimes need to provide the bom.
Make this possible in this commit.

Task-3078049

closes odoo/odoo#121813

X-original-commit: cbbd370eb653e0023d1173039787055590ba680b
Related: odoo/enterprise#41256
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
2023-05-19 16:42:08 +02:00
yhu-odoo 0171f4a1e4 [FIX] {,purchase_}mrp: add missing days when calculate DTPMO
When calculate Days to Prepare Manufacturing Order, we didn't take into
account Days to Purchase and Security Lead times for Purchaseing of the
company. In this commmit, if the (sub-)bom has company_id set, these two
days will added to the calculation.

Task-3078049

X-original-commit: bf59aedad649dec350f091bb074d3ef1e51d5fcb
Part-of: odoo/odoo#121813
2023-05-19 16:42:07 +02:00
Ricardo Gomes Rodrigues (rigr) baefb74b04 [IMP] account: deferred management
This commit refactors completely how deferred revenues and expenses are managed:
- they are now completely unrelated to the model of Assets:
    - the link is directly done between the original move and its deferred moves
    - no need to create an deferred models in advance
- a new option to group deferred entries together is available
    - this is specially useful for big DBs with lots of subscriptions for instance
- two new reports are available to have an overview of all deferred revenues and expenses for each account
    - where the user can also generate the grouped deferred entries manually

task-id 3225099

closes odoo/odoo#121812

X-original-commit: e3d5c06a59fae862add2f36373882f696c225310
Related: odoo/enterprise#41255
Signed-off-by: William André (wan) <wan@odoo.com>
2023-05-19 16:42:02 +02:00
dhba-odoo 28b54dfa39 [FIX] web_editor: entering a hax color triggers traceback
Before this commit:

In mass_mailing entering a hax color for text triggers traceback.

After this commit:

Now, the traceback will not be triggered and color will be applied to the text

Task-3271517

closes odoo/odoo#121800

X-original-commit: b526bc1e56fd486cad422bca3a7b0e837376cd17
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-05-19 15:40:52 +02:00
Samuel Degueldre acbf806030 [FIX] point_of_sale: fix indeterministic order of payment methods
Previously, pos payment methods were ordered by sequence only, this can
cause issues because the default cash payment method is considered to be
the "first", ie the one with the lowest sequence, but because they are
created with a sequence of 0 by default, if there is more than one cash
payment method, their order is indeterminate.

This can cause issues if the order of payment methods given to the pos
application during load_pos_data doesn't match the order of the payment
methods obtained in get_closing_data, as tests will use the first cash
payment method when paying, and then compute the cash difference with
the default cash payment method which is supposed to be the first
received in load_pos_data. If the order is different then the cash
difference will not match what's expected and the test will randomly
fail.

This commit adds the id to the _order of the pos payment method model,
causing the ordering to be deterministic. It also removes the order from
the search params used for this model in load_pos_data, as it was
already the default ordering but was now masking the correct order newly
defined on the model.

closes odoo/odoo#121797

X-original-commit: b78c93a697baed3a01cac9319ccdc479d3bfd840
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-05-19 14:34:51 +02:00
Romain Derie 96a1a5e69a [FIX] website: prevent race condition on snippet_editor_panel_options
Before this commit this tour was often failing. It seems to be because
there were some requests still being executed / received after the test
was marked as successful and browser getting killed.

According to the logs, even when the tour is actually not failing, there
is still some unexpected requests going on.

With this commit, saving and waiting the edit mode to be exited will
prevent all those requests issues, as it seems like the requests done
after exiting edit mode are all awaited before marking the test as
successfull.

== Before the fix success case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_default.svg HTTP/1.1" 200 - 0 0.000 0.003
- [Same GET for 10 other header templates]
- test successful
- Session expired
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 3 0.001 0.003
- [2 lines above x10]
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'A538603CC37A4E9EBA99B8624C1CD34E', 'loaderId': '9187051DD3D9477FA4EDEB1A544D584E'}
- Waiting for frame 'A538603CC37A4E9EBA99B8624C1CD34E' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139669352166976, started 139669352166976)>]

== Before the fix error case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_sidebar.svg HTTP/1.1" 200 - 0 0.000 0.004
- [Same GET for 10 other header templates]
- test successful
- GET /web/static/img/smile.svg HTTP/1.1" 200 - 0 0.000 0.001
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.001
- Failed to fetch
- Asking for screenshot
- Trying to set result to failed (TypeError: Failed to fetch) but found the future settled (<Future at 0x7f8fa1a25120 state=finished returned bool>)
- Deleting cookies and clearing local storage
- Screenshot in: /data/build/tests/36222061-master-all_no_autotag/screenshots/sc_20230513_220042_739175_TestUi.png
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'E1A779132E972A440E5FE892BBBC9FEC', 'loaderId': '822ACED443DB0C84F57DD4A1FF451D5B'}
- Waiting for frame 'E1A779132E972A440E5FE892BBBC9FEC' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.140254747010624, started 140254747010624)>]

== After the fix case ==
- Tour snippet_editor_panel_options on step: 'iframe body:not(.editor_enable)'
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.003
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 8 0.002 0.035
- [Many other POST/GET requests]
- test successful
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': '4B87BC8A50A3FEBD7D508394DD5BDB19', 'loaderId': '7CCB3B6434B52B456A1AA470C3CFA1BF'}
- Waiting for frame '4B87BC8A50A3FEBD7D508394DD5BDB19' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139744500471360, started 139744500471360)>]

runbot-15312

closes odoo/odoo#121795

X-original-commit: 936cc061ab20dc1fe4587b24f59dc322d0e7ad9b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-05-19 14:34:48 +02:00
Andrea Grazioso (agr-odoo) 05e4abf522 [FIX] account: epd causes tax line duplication
Set "Cash Discount Tax Reduction" to "Always"
Create an invoice with a tax line
Set Payment term to "2/7 Net 30" [1]
Go to "journal items" tab
Early payment discount lines are set correctly
Set payment term to "30 Days", Save
Set Payment term to "2/7 Net 30", Save

Issue:
An extra tax line appear in journal items because an old tax line was
not deleted and a new one is created

[1] Payment terms: 30 Days, 2% Early Payment Discount under 7 days

opw-3285534

closes odoo/odoo#121785

X-original-commit: f4a10ca67802f8d6f5acc0d992d5eea8c878bb24
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-05-19 13:33:21 +02:00
Xavier-Do 40367e3683 [FIX] website: increase timeout on website switch step
The generation of the assets may make this step fail randomly.
The pregenerate is not enough because this is generating assets for
website2.

This issue will be partially solved in master with this PR [1] by not
generating an asset if a close one is found in the database.

For now just increase the timeout for this test.

[1]: https://github.com/odoo/odoo/pull/121376

closes odoo/odoo#121777

X-original-commit: c3209aec9741cda8597525add88b0a932fb7532a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-05-19 13:33:18 +02:00
Mahdi Cheikh Rouhou (macr) 9358a7f550 [FIX] loyalty : unarchive archived rules and rewards
When archive a loyalty program which have somes rules and rewards and the unarchinving it will not have the rules and
rewards that it had before.

Steps to reproduce the error :
1- install sales
2- activate Discounts, Loyalty & Gift Card in sales settings
3- go to sales/products/Discount&loaylty
4- select one of the default programs and try to archive it and unarchive it after
5- you will not get the rules that it had before

The problem was in the toggle_active function of the loyalty program we try to unarchive already unarchived items because
we do ```program.rule_ids``` so it will get only active items.

opw-3299295

closes odoo/odoo#121710

X-original-commit: 1d9fbda1c5ec69ba83968668ddecec6a7e1421bb
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
2023-05-19 13:33:16 +02:00
Benjamin Vray 0f9e4babf4 [FIX] website, website_form: fix anchor link redirects
Before this commit, links scrolling to an anchor with a special
character did not work and displayed a traceback. The issue was that to
check that the anchor is valid, we don't need to check that the anchor
is a valid url as we have been doing since these commits [1], [2]. But
we only need to check if the jQuery selector is valid to correctly
target the element to which the page must scroll.

Indeed, the anchor widget returns stuff like 'ok%C3%A9%25' when typing
'oké%' wich is not valid jQuery selector. It has to be encoded to
'#ok\\%C3\\%A9\\%25' to be valid and that's what this commit does.

We also changed the way to display a new anchor to the user in this
commit. Before, we showed the anchor unencoded in a notification and now
we show it encoded. That way, if the user copies the anchor from the
notification, it's the real anchor.

Also, this commit detect if the success URL of the redirect of a from is
the current page to perform a scroll to the anchor instead of a
redirect. To make this comparison, we needed to add the url code of the
language of the current page to the session info.

Also, before this commit, the page froze when we clicked on the "submit"
button of a form that redirected to an anchor that did not exist.

[1]: https://github.com/odoo/odoo/commit/0abfaeda96c2eaa868cc7fc5fa1926dfa90fc420
[2]: https://github.com/odoo/odoo/commit/b492bde6a121be1c15ed90ce0827fcfd72a12f5c

task-2172312

closes odoo/odoo#121656

X-original-commit: f09a3fc47b5fd088c3aa5112a0fac5f442d9c915
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-05-19 13:33:13 +02:00
Xavier-Do 69d68296d8 [IMP] core: introduce OrderedWeakSet
The Weakset Used for envs can lead to unpredictible behaviour when
calling flush on the transaction because we iterate on the `envs`.

Since WeakSet.data is a set, the iteration will depends on the python
hash seed.

This commit proposes to replace Transaction.envs.data by an OrderedSet
to solve this issue.

Some test demonstrates that it does not affect the garbage collection
and that the order is now deterministic.

The question to now if we should reverse the envs to find the most
suitable envs remains.

closes odoo/odoo#121604

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-05-19 13:33:11 +02:00
vlst 13e37bda7c [IMP] pos_self_order: Allow ordering from web app
Currently from the pos_self_order app a customer can only view the menu.
This PR adds the option to order items.
A customer of the restaurant will now be able to scan a qr code on their table, and navigate to a website where they will be able to order items from the pos.
The customer can select product variants and add a specific notes for each of the ordered products.

This version does not support online payment. This means that the customer will still have to pay by the usual methods.

The pos can be configured such that a customer can add items to an existing order. For example, ordering a second coffee will result in an update of the existing pos order containing the first coffee. Alternatively, the pos can be configured such that each order made from the web app results in a new pos order. Orders made from the self order app will be placed in the same pos session as regular orders. Once a customer orders from the self order app, a new order will appear in the pos app. Thus, a waiter will be able to quickly see all the orders placed by customers from the self order app. He/She will then be able to send the order to the preparation display. This step has to be done manually.

In the interest of security, each table now has an associated access token. It is included in url that the customer gets from the qr code. When sending the order, the self order app also sends back to the server this access token. The server will only process the order if it receives a valid access token. When placing an order, the server will respond with the pos_reference and access_token of the created order. The web app will keep this data and will send it back to the
 server as a proof of ownership in the event that it intends to get the latest state of the order or to update it. The server will only reveal information about an existing order when the request contains a valid pair of pos_reference and access_token.

closes odoo/odoo#121029

Task: 3058586
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-19 13:33:08 +02:00
jorv 8563592e36 [FIX] microsoft_outlook,google_gmail: require username for OAuth2
Current behavior:

Connections for outgoing email servers using Outlook/Office365 or
Gmail accounts will establish an OAuth2 authentication for the smtp server.
Through the `ir_mail_server` form view, one can fetch the necessary
tokens by logging in into their Microsoft/Gmail account.
Not specifying an username (`smtp_user`) on the `ir_mail_server` record
will not produce an error while fetching those tokens.
But when trying to test the connection or use that server to send an email,
even if the FROM header is correctly set (i.e. the account email address
authorized to sent emails), the smtp connection will fail. This is due
to the fact that when `smtp_user == False`, the respective method
`_generate_outlook_oauth2_string` or respectively `_generate_oauth2_string`
will not be called and send the necessary OAuth2 string when sending
an email through the smtp connection.
This will lead to a `5.7.57 Client not authenticated to send mail.` error.

After this change:

Add specific UserErrors that get called if `smpt_user == False` before
the actions in `open_google_gmail_uri` and `open_microsoft_outlook_uri`
get called. This forces the user to input a `smpt_user` (field Username)
before the login page for OAuth2 gets called to fetch the tokens.
Note: there is no check if the user inputs the right username, only
that the field is not empty. So it is still possible to input an
invalid username.

opw-3268246
Conflict resolved for 16.0 forward port
Conflict resolved for 16.3 forward port

closes odoo/odoo#121764

X-original-commit: 65b0b876d98dad2aeda5f6ef965f6b7bb68e9424
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
Signed-off-by: jorv-odoo <jorv@odoo.com>
2023-05-19 11:22:03 +02:00
David Monjoieanddhba-odoo 6dd38640ce [FIX] web_editor: fix select all in empty paragraph
The previous code with `parentsUntil` would not return any result
in an empty paragraph because the only valid element would be the
anchorNode itself but `parentsUntil` would only return parents and
never the base node itself. It makes sense, but is not suitable for
the case at hand.

Before this commit:
CTRL+A does nothing from inside an empty paragraph.

After this commit:
CTRL+A correctly triggers a select all from inside an empty paragraph.

Task-3150956

closes odoo/odoo#121727

X-original-commit: 4bcba1d785afeaa8287adc48076f208d04fc72c3
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: dhba-odoo <dhba@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2023-05-19 10:18:57 +02:00
Preksha Chouhan feff1fc79f [FIX] web_editor: convert color opacity to be compatible with PIL Image color
ValueError 'unknown colour specifier' occurs when we access
export_icon_to_png(). This error occurs when we change the colour of an
icon in the mailing template, because the value of alpha (opacity) in 'rgba'
is in the range of 0 to 1, but PIL Image support colour opacity range 0 to 255.

This commit converts the opacity value range (0 to 1) to a range (0 to 255)
compatible with the PIL image library when the colour specifier is 'rgba'.

sentry - 3933353285

closes odoo/odoo#121696

X-original-commit: 7e4be89f6c0b2f8b82a207030e8a8cb20d72664f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-05-19 10:18:53 +02:00
Xavier Morel ce77b9f673 [IMP] core: avoid searching chrome binary once per browse_js
Delegate the property's resolution to a top-level function,
cached (with a single slot). This is slightly less efficient than
using some sort of global set once, but it's much easier.

Unlikely to be a huge issue in the face of *starting an entire
browser*, but may as well skip it.

closes odoo/odoo#111422

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-05-19 10:18:48 +02:00
Xavier Morel e6fd0ad5ee [IMP] core: cleanup browser API
It doesn't need to store so much crap as attributes, and the data flow
of the init can be made more explicit.

- have setup functions return stuff, which can be set on `self` by the
  `__init__`, making the dataflow more explicit
- maintain a high-level `Popen` object instead of moving a `pid` around
- pass items like browser size as parameters instead of attributes
- remove redundant attributes like `screencasts_frame_dir` (/ convert
  to properties)

Part-of: odoo/odoo#111422
2023-05-19 10:18:48 +02:00
Xavier Morel 2b0d9fa6a9 [ADD] core: ability to run tours in a regular (headful) browser
Chrome's screencast / remote view (in the remote devtools) is
apparently *designed* for touch emulation /
simulation (https://crbug.com/1410433), which is not convenient when
trying to debug mouse-bound issues in a tour (e.g. drag&drop
problems).

However we can "simply" run the thing in a normal browser, on a watch
basis, and shut down the entire thing after each tour-call. This also
obviates the need for complicated cleanup steps to try and isolate
tours (as we can just delete the profile the browser created),
although it is somewhat less efficient as we keep starting and
stopping the browser.

It does simplify the result of merging `clear` and `stop` (into stop).

The switches setup does have a few foibles:

- `--no-first-run` causes tours to not run at all on my machine, in a
  non-headless browser, so it's left just for headless
- also moved a bunch of other flags which seem to be mostly for
  automated annoyances to headless only
- left extensions for now, not entirely sure which is the right one,
  since we're running with fresh profiles I would assume there's no
  extensions anyway

Part-of: odoo/odoo#111422
2023-05-19 10:18:47 +02:00
Michele 78991b1c80 [IMP] stock: unreserve only quantity required if available quantity is less than quantity required when action_done on stock move.
Example:
Now there is this behaviour
Inventory quantity 4
Reserved quantity 3
Available quantity 1
If i do a stock move of 2 pieces, it will unreserve ALL the stock move of the product.

With this PR it will unreserve only the pieces that are required minus the available quantity not reserved , in this case 2 (new stock move) - 1 (available quantity) = 1

closes odoo/odoo#121724

X-original-commit: 999c2045236161cc8d8a76ab6a33c17d1b124f25
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-05-19 09:14:52 +02:00
Mylyna Hy 00f963ebed [IMP] point_of_sale: no CoA error visible for pos
Problem: The error "There is no chart of accounts installed for this company..." appears for POS shop configurations
if they don't have a chart template configured for the company. It doesn't take into account if the company has its
own set of accounts so it will always show the error unless the chart template is set.

Solution: Include an additional condition to check if the company has accounting entries which is used to check
if the company has used its own set of chart of accounts for accounting.

Purpose: The error will only appear if the company has no chart template set or no accounting entries.

opw-3291399

closes odoo/odoo#121474

X-original-commit: 6b866cea2f60dc91f37f06393159db01dedc6db2
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Mylyna Hy (myhy) <myhy@odoo.com>
2023-05-18 21:34:53 +02:00
Julien Van Roy 806a4f895e [FIX] account_edi_ubl_cii: unit prices should not be rounded
When unit prices have more than 2 digits, it is currently not reflected
in the UBL formats. Consequently, the line amounts are not equal to the
unit price * quantity (assume there is no discount, charges or
allowance) and it raises validation errors: "Invoice line net amount
MUST equal (Invoiced quantity * (Item net price/item price base
quantity) + Sum of invoice line charge amount - sum of invoice line
allowance amount".

To fix this, we no longer round the unit prices.

NB: the decimal accuracy should be set in the settings (otherwise, the
default is 2 digits for unit prices).

See https://docs.peppol.eu/poacc/billing/3.0/bis/#_rounding

opw-3290035
task-3302904

closes odoo/odoo#121649

X-original-commit: 3c8e143bd86174f07350431f290b893711ad32bf
Signed-off-by: Julien Van Roy <juvr@odoo.com>
2023-05-17 18:17:52 +02:00
nni-odoo 212f431462 [IMP] l10n_th: Taxes updates
- Adding PND53 and PND3 tax report
- Including the PND53 and PND3 tax tags to tax data
- Translations for accounting terms related to

2879718

Part-of: #121587
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-05-17 16:48:30 +02:00
nni-odoo 870f9d5c3d [IMP] base: adding Thailand states
Adding Thailand states that is an essential part of contact address in Thailand.
Data is based on wikipedia: https://en.wikipedia.org/wiki/Provinces_of_Thailand

2879718

Part-of: #121587
2023-05-17 16:48:29 +02:00
Christophe Monniez 8915ff5f83 [IMP] core: bump master release to 16.4 alpha 2023-05-17 16:01:14 +02:00
Simon Goffaux (sigo) 70daa15342 [FIX] website: cast website_id to int in pagenew
Cast website_id so that if it contains more than 1 digit, we do not
browse() a tuple with each digit. For example, if we pass pagenew() the
website_id '123', this is the current behavior:
 - browse('1', '2', '3')
After this fix:
 - browse(123)

To reproduce the erroneous behavior:
 - Create at least 10 websites so that the id of this website is at
least in the double digits.
 - Create a new page within this website with a double digit id.
 - It will throw an expected singleton error.

Issue was introduced in this commit: https://github.com/odoo/odoo/commit/d6014c60acc4231a5e56d492d2a39deaf789cbe8

opw-3290571

closes odoo/odoo#121586

X-original-commit: 3855829a0daf4321ab54cce3a71a92eb68c216b3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-05-17 14:47:22 +02:00
Maximilien (malb) aafb5523eb [FIX] account: list view tax definitions
With the recent changes "Odoo Milk", the tax definition view was a bit broken,
the list view was taking half the space she needed.

closes odoo/odoo#121439

Task-id: 3326941
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-05-17 14:47:18 +02:00
Touati Djamel (otd) fe508b0548 [FIX] mrp_subcontracting: compute bom price into company currency
Steps to reproduce the bug:
- Enable “subcontracting” in the mrp settings
- Create a storable product “P1”:
    - Add a vendor:
    - supplier: “Azure interior”
    - currency: euro
    - price: 20
    - Add a BoM:
        - Type: subcontracting
        - add any product as component
        - Save
- Check that the currency of the company is in dollars
- Click on Compute Price from BoM button in the product form

Problem:
The seller's price is not converted into dollars

opw-3321346

closes odoo/odoo#121327

X-original-commit: f60fac0afa9b87baa68328c5755a7fe84494cb10
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-05-17 14:47:15 +02:00
Xavier-Do 5594d8f191 [IMP] base, *: speedup assets unique computation
One of the most costly part of a page loading when the ormcache is cold
is computing the assets node, the unique identifier of an attachment to
validate whether the existing attachment is still valid with the current
version of the static files.

This operation needs to glob assets path in the filesystem,
get the modification date, check attachments, ...

Right now this task is not really optimized and can take some time
because of an excessive number of glob on the filesystem, unnecessary
exists to define absolute path, double computation of file list and
modified times when getting js and css bundle separately, ...

A list of modifications mainly discussed in the pr message are made
with this commit to speedup things.

- split css and js unique
- prepare api for an in memory glob
- change api to propagate absolute path and meta information through
`ir.asset._get_paths`-> _get_asset_paths -> `_get_asset_content` ->
`AssetsBundle`

closes odoo/odoo#121159

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-05-17 14:47:12 +02:00
Kartik Chavda f8e30be57d [IMP] hr_timesheet: add default filter for project/task
Before this commit searching on project and task display all
records in search more dialog without distinction and because
of that sometimes it is difficult for user to find a proper
record.

This commit add default filter on search more dialog to
display user related record.

task-3251672

closes odoo/odoo#118911

Related: odoo/enterprise#39936
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-05-17 14:47:06 +02:00