Commit Graph
168264 Commits
Author SHA1 Message Date
Romain Derie b42e9cc686 [FIX] website: restore default checked value for form checkboxes
Before this commit and since PR [1], the default "checked" value set on
checkboxes field on the form snippet were lost once the page is saved.

This is because [1] changed the rendering engine of qweb templates from
our own qweb js rendering code to owl templates rendering.
By doing so, `t-att-checked="'checked'"` would toggle the "internal"
checkbox checked value but would not add the checked attribute on the
element.

It's a deliberate choice made in owl. As the checked attributed does not
mean the same as the internal checked value, it makes sense.
Indeed, the checked attribute is about the default value of the checkbox
while the checked internal value is about the current checked state of
the checkbox.

In React, for instance, the same behavior can be seen. And if one wants
to really set the checked attribute, they got to go with
`defaultChecked`.
Same apply with `value`.

Maybe owl will implement the same `defaultXXX` behavior in the future as
it's something that was already discussed on their side.

Step to reproduce:
- Drag & drop a form in the website builder
- Add a new custom field and select "Multiple Checkboxes" type
- Set one of the checkbox checked by default
- It is visually checked, but the attribute is not set
- Save the page

-> The checkbox is back to unset state since the attribute was not set

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

opw-3607795

closes odoo/odoo#146328

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-15 11:40:44 +00:00
Maximilien (malb) e5097a183a [IMP] account: payment term - Days end of month
This commit add a new delay_type that will add to the date the nb_days then go
the end of the month and finally add a new field called days_next_month.

This field is a Char because we want the field to be of size 2. Also, we added a
constraint that this field must be numeric and between 0 and 31.

Ex of use with Invoice date the 25/11/2023, if we have a payment term with 90
for the nb_days and 10 for the days_next_month:

+90 days = 23/02/2024
End of month = 29/02/2024
+10 days = 10/03/2024

(Also, there is a special case handling when the day of the month is 29, 30 or
31 to avoid exceeding the next month's end. For instance, with a payment term of
30 days end of month and using the 31st of a month, prevent calculation from
moving beyond the end of the next month (e.g., early March instead of end
February)

closes odoo/odoo#143758

Task: 3609320
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-12-15 11:40:43 +00:00
Romain Derie 924006f33c [FIX] web_editor: make fa icons work with gradient on apple devices
Step to reproduce:
- Go to Website Editor
- Add a block like Text-Image
- Change the Font Color for the title to a "Gradient"
- Add an icon in the title
-> The icon is not displayed on iphone

Note that it was probably working with commit [1] but not anymore with
commit [2].

Note also that it only seems to impact Iphone (Chrome/Safari) and MAC
(Safari only).

[1]: https://github.com/odoo/odoo/commit/187acb938f70a2130d25fa76079221339c742f1e
[2]: https://github.com/odoo/odoo/commit/372eeebb47b93890d567185879981e817cdc1326

opw-3614325

closes odoo/odoo#146420

X-original-commit: 1eda1c494a5c4accd1aadf1466bd60cca45bcaa7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-15 10:09:38 +00:00
Julien (jula) b200b708ea [FIX] calendar: optimize _compute_meeting
__Current behavior before commit:__
`_compute_meeting` computes the meetings linked to the children of the
partners in `self`. To do so, it first retrieves all children partners
of `self`, then it loops through all of them to apply the meetings to
the parents.

This way of doing is inefficient because it is useless to iterate over
the children that don't have any meetings.

__Description of the fix:__
Loop only through the partners that have a meetings instead of all
children partners.

Improve `test_meeting_count` to test the case where only the child
partner has a meeting but the parent has initially none. This test
improvement is a forward port of [#144575][1].

__Benchmark:__

| len(all_partners) | w/o fix | with fix |
| ----------------- | ------- | -------- |
| 1k                | 32 ms   | 14 ms    |
| 100k              | 1500 ms | 800 ms   |

opw-3511371

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

closes odoo/odoo#146381

X-original-commit: e35949cdd09b4312a60383b79290008e78768b64
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Julien Launois (jula) <jula@odoo.com>
2023-12-15 10:09:36 +00:00
Gurupreet Singh 904b158723 [FIX] hr_timesheet: fix the alignment isssue for the label
Description of the issue/feature this PR addresses:
Within the project task form view, in the timesheet notebook, the "Remaining
Hours on SO" label becomes misaligned when the planned hours are set to 0.

Fix:
To ensure proper alignment, add a condition for the label.

task:3468392

closes odoo/odoo#146334

X-original-commit: 3f35ccf7bdd9c0cb988f0207427ec8d3acccecd6
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-12-15 10:09:33 +00:00
Louis (loco) ba7901822a [FIX] web_editor: make loadImageInfo() robust to protocol relative URLs
Steps to reproduce:
- Add a "Text-Image" on the website.
- Replace the image by one of your own.
- Save.
- With the html editor, remove the `mimetype` attribute, the
`data-original-src` attribute and change the `src` of the picture into
the corresponding protocol-relative one. The `src` then looks like
"//domain/web/image/...".
- Save the modifications of the html editor.
- Enter in edit mode.
- Click on the image.

-> It is now impossible to change options such as `Filter`, `Width` and
`Quality`.
Because the `data-original-src` attribute was removed from the image,
the system tries to add it back thanks to the `loadImageInfo()` logic.
Because the `src` attribute of the image is now a protocol relative url,
`new URL(src)` will raise an error and the logic will use this url as
argument for the `/web_editor/get_image_info` route. Because the url
given in argument of the rpc call is not the relative one, the system
fails to find the original attachment. The `mimetype` attribute is
therefore not added back on the image, leading to the impossibility to
change some options.

To solve the problem, this commit modifies a bit [this commit]. In order
to be robust to absolute, relative and protocol relative URLs, an URL
object is first created from the image src. The relative URL
(`.pathname`) of the URL object is then used to retrieve the original
attachment linked to the image.
Let's synthesize the different `relativeSrc` obtained with different
image src. In the following examples, "https://test.com/blog/travel-1"
will be used as `img.ownerDocument.defaultView.location.href`.
(the complete URL of the document in which the image is located).
- `src` is an absolute URL (e.g.
"https://test.com/web/image/697-d0f2aaf8/shoes.jpg"). In this case,
`relativeSrc` = "/web/image/697-d0f2aaf8/shoes.jpg".
- `src` is a relative URL that begins with a slash (e.g.
"/web/image/697-d0f2aaf8/shoes.jpg"). This URL represents an absolute
path starting from the root of the domain. In this case, `relativeSrc` =
"/web/image/697-d0f2aaf8/shoes.jpg".
- `src` is a relative URL that does not begin with a slash (e.g.
"web/image/697-d0f2aaf8/shoes.jpg"). The interpretation of this URL
depends on the current location. In this case, `relativeSrc` =
"/blog/web/image/697-d0f2aaf8/shoes.jpg".
- `src` is a protocol relative URL (e.g.
"//test.com/web/image/697-d0f2aaf8/shoes.jpg"); there is only the
protocol missing. In this case, `relativeSrc` =
"/web/image/697-d0f2aaf8/shoes.jpg".

This solution takes the advantage of the second argument of the `URL()`
constructor which is used if the first parameter is a relative or
protocol relative URL and which is ignored if the first parameter is an
absolute URL.

This commit does not only modify [this commit] to handle more types of
URLs but also:
- To avoid having to use `.split()`. Indeed, `.pathname` does not
include query parameters.
- To avoid having to consider an error raised by `new URL()` as a normal
flow. Indeed, in [this commit], an error would be intercepted by the
`catch` if `src` was a relative URL. This was a legitimate flow. The
problem was that other unwanted types of src (for example protocol
relative URL) were also raising errors but were silently ignored (as
intercepted in the `catch`).

[this commit]: https://github.com/odoo/odoo/commit/89c14783846288a2de53f6258a93440e02550b13

task-3623731

closes odoo/odoo#146238

X-original-commit: 96324fe8443647a078756c98f9629af274ff38a5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-12-15 10:09:32 +00:00
Josse Colpaert a897880a1d [FIX] l10n_es_edi_sii: ImporteTotal and intra-community + tests
When a line with a factor_percent of -100 is applied in the tax,
it should be subtracted from the ImporteTotal.

This way, we might think that the total of the invoice should do,
but we need the amount before application of the withholdings.
And in the case of DUA it should be the sum of base and tax.

Doing this, we realized that we do not have any tests for
vendor bills and their refunds for the intra-community case, so
we added one for vendor bill and one for vendor refund.  (there
is no -100 line for sale)

In the meantime, we added docstrings on the existing tests
and realized that the sale of intra-community services, it should
be no sujeto por reglas de localizacion instead of sujeto.
(because as well with the fiscal position, the delivery address counts)

We also saw that for intra-community, the clave regimen depended
on the tags on the amls but the refund repartition lines  were not mapped on the
tax report line with Intra-community but in a separate refunds section
(mod303), so we fixed by checking all tags on the tax from all the
repartition lines.

task 3603788

closes odoo/odoo#143204

Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-12-15 10:09:30 +00:00
Abdelouahab (abla) 8be8230512 [FIX] calendar: event of done activity must not be deleted
To reproduce
============
- Create a meeting activity from any document (for example CRM opportunity) with a calendar.
- It will create a meeting in the calendar.
- Now, mark as done the activity created and it will delete the meeting from the calendar too.

revert of https://github.com/odoo/odoo/pull/144526

opw-3626773

closes odoo/odoo#146421

X-original-commit: 0b183299a8ef7361d28d9d2b49cc56b74bfb2b46
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
2023-12-15 08:44:23 +00:00
Anh Thao Pham (pta) 44a628ba35 [FIX] l10n_sa_edi: fix tax retention on invoice lines
Steps to reproduce:
- Install Accounting and l10n_sa_edi
- Create a retention tax: (e.g. "Retention Tax 10%")
  * Amount: [a negative amount] (e.g. -10.00%)
  * Is Retention: [checked] (in "Advanced Options" tab)
- Create an invoice with the following invoice line:
  * Product: [any]
  * Price: 1000
  * Taxes: "Sales Tax 15%" and "Retention Tax 10%"
- Confirm the invoice
- Print the invoice
=> On the invoice, there is a "VAT Amount" field that should show
the amount coming from the taxes that are not Retention taxes as it
is done in the EDI invoice (XML).
However, the Retention tax is subtracted.

In our example:
- Tax amount for "Sales Tax 15%" is 150.00
- Tax amount for "Retention Tax 10%" is -100.00
=> The "VAT Amount" field of the invoice line is 50.00.
It should be 150.00 instead.

Solution:
Compute the "VAT Amount" field as it is done in the EDI invoice.

opw-3568831

closes odoo/odoo#146394

X-original-commit: b50d20e9fc631d7aa2e64cf6749be1630354fd69
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
2023-12-15 08:44:22 +00:00
Anh Thao Pham (pta) 3e3ac68013 [FIX] purchase,sale: fix taxes proposition in child company
Steps to reproduce:
- Install Accounting, Sales & Purchase
- Go to "Settings / Users & Companies / Companies"
- Create a branch company (e.g. Branch Company) for a company (e.g. YourCompany)
- Switch to Branch Company
- Go to Sales (or Purchase)
- Create a SO (or PO)
- Add a SO line (or PO line) and try to select a tax
=> Taxes from the parent company are not available in Sales and Purchase
as they are in Accounting

opw-3604981
opw-3636972

closes odoo/odoo#146384

X-original-commit: ddc653758c2dd6af74e21f5fbd07ab679ffb3e73
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
2023-12-15 08:44:21 +00:00
sesn-odoo 81bca97694 [FIX] base,l10n_gcc_invoice: apply the 'Total amount in letters' setting
Summary
-------
Currently, the 'Total amount of invoice in letters' setting doesn't do
anything on GCC invoices.

Steps to reproduce
------------------
* install `l10n_sa`
* enable the Arabic language
* in the settings, enable 'Total amount of invoice in letters'
* create and print an invoice

You should see that the amount in words in not displayed.

Note:
Currently, currency labels are not translatable. Since this isn't
something that can be changed in stable version, it was decided to not
include them in the Arabic amount in words.

opw-3501112
opw-3485691

closes odoo/odoo#146364

X-original-commit: 1fb28f229c701ae1261dc502ef345ffda162f994
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2023-12-15 08:44:20 +00:00
Lucas Perais 3e4d889749 [FIX] base_automation: webhooks send and receive work together
Before this commit, the sending webhook did not work well naturally
with the receiving end.

After this commit, it does since default values on base_automation have been adapted.

closes odoo/odoo#142710

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-12-15 08:44:19 +00:00
Lucas Perais 51077cc514 [FIX] base_automation: webhooks: put the request payload in eval_context
Set a webhook that executes a ir.actions.server of type python code.

Before this commit, the code had no access to any request's parameters. This was a limitation
in the basic flows that the feature is supposed to support.

After this commit, we pass in the context a key "payload" that contains a copy of the request parameters.

task-id-3599629

Part-of: odoo/odoo#142710
2023-12-15 08:44:19 +00:00
Saiyed Irmi 865496391e [FIX] sale_project: fix missing space in milestone name and SOL
Steps to reproduce:
- Open Project
- Go to project for which sale order item is created
- By clicking on three dots, go to Project Updates
- In right side panel, milestone section, there is no space between milestone
  name and the SOL

Issue:
- This lack of spacing between milestone name and SOL makes it difficult for
  users to read and understand milestone information.

Cause:
- The project.update right-side panel was displaying milestone names and SOL
  without a space, causing readability issues for users.

Solution:
- added a space between the milestone name and SOL.

task-3545942

closes odoo/odoo#146360

X-original-commit: 6341fabafd225e2ecf8037f58e5312ce391003f0
Related: odoo/enterprise#52816
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-12-15 01:36:07 +00:00
Robin Lejeune (role) bd1b3a5ef4 [FIX] web_editor: reactivate automaticStep on resize
[Commit 1] made sure the history worked when resizing elements by
calling `odooEditor.automaticStepUnactive()`, but applied its
counterpart `automaticStepActive()` only at the very end of the action,
leaving some `return` statements on the way that could break the flow.

This commit calls `automaticStepActive` just before leaving the listener
and moves `automaticStepUnactive` just before the first DOM
modification. It's both more logical and avoids returns pitfalls.

Note: `automaticStepActive()` makes sure modifications made on the DOM
through the browser's developer tools are tracked and can be reversed
with the undo button. Not reactivating it in time means some flows could
be broken (until another method reactivates it).

[Commit 1]: https://github.com/odoo/odoo/commit/423f4bd2a6cc47e69699d2437eaa5acda94bb98d

Related to task-3576046

closes odoo/odoo#146249

X-original-commit: b99cc41e4352d3ff9bffe7b0a5436edbef0ab01b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
2023-12-15 01:36:02 +00:00
Romain Derie 2a2fd932af [FIX] website: fix toggle redirect compressed layout in page properties
Before this commit and since [1] when the website builder was moved from
the "frontend" to the "backend" of Odoo in Odoo 16, the option to enable
URL redirect when updating a page URL was "compressed":
- The toggle/switch element has not enough room to be displayed entirely
  if there were too many dependencies
- The toggle/switch label was split in multiple lines, words could even
  be split in 2.

Step to reproduce:
- Go to / in the website builder (so the / finds a lot of dependencies)
- Open page property
- Change the URL field, you see the redirect url field appear with the
  mentioned issues.

Note:
- In other languages, the switch label could be even longer, splitting
  the line makes even more sense
- Removing a class is generally something to be avoided in stable, but
  this type of class should not be xpath'd anyway. And given the
  template structure, it's unlikely someone would have xpath it as it's
  easy to xpath any element without relying on classes.
  One solution would have been to add a new class to cancel the first
  one but it seems overkill in this case.

[1]: https://github.com/odoo/odoo/commit/2ef7e788263b4742a8e0788f47673b7b31da3726

closes odoo/odoo#146244

X-original-commit: 8c17c487e6632192874133a2ce4265a0f1eaf6fb
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-15 01:36:01 +00:00
1069763b3a [FIX] core: importlib find_module is deprecated
As find_module has been deprecated since python 3.4:

https://github.com/python/cpython/blob/05c28b08f6e2fc8782472b026c98a3fdd61a2ba9/Lib/importlib/_bootstrap.py#L1347

and warnings added in python 3.10:

https://github.com/python/cpython/blob/f91dfdf5ff9f68a4b012e1b70ab9997c6dc1542d/Lib/importlib/_bootstrap.py#L764

to respect the PEP-451 specification : https://peps.python.org/pep-0451/

So, override the find_spec() method to display depreaction warnings if
applicable.

X-original-commit: 000ce83492d67febc8b45b902500d57304455d04

---

This commit should have been merged by odoo/odoo#128924, but has been
wrongly ignored.
This oversight has been detected due to a fix inside the `find_spec`
method (odoo/odoo#145800) that couldn't be forward-ported.

This commit is therefore the combinaison of those two patches and the
removal of the depreacted `find_module` method.

closes odoo/odoo#146205

X-original-commit: df63a8aede024f7d4423f80f270a4aa662150e3e
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Co-authored-by: Enric Tobella <etobella@creublanca.es>
Co-authored-by: Christophe Simonis <chs@odoo.com>
2023-12-15 01:35:59 +00:00
tsm-odoo 9f4341d784 [FIX] im_livechat: restore chatbot state on page reload
When a page is reloaded with the chat bot, it sometimes restarts from
the beginning. This commit ensures the chatbot starts where it left
after a page reload.

closes odoo/odoo#146175

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-12-15 01:35:57 +00:00
Romain Derie f57b92a8de [FIX] website: remove duplicate action in page list view
Before this commit and since commit [1], it was possible to clone a page
in the page list view.
It shouldn't be the case, cloning a page lead to bad result: a page
with the same URL which is not shown in the page list view because pages
are filtered by URL to remove duplicates.

Cloning a page has always had to be done through the page properties >
"clone page" button. Doing it this way will ask the user for a new page
name (and so a new url). The page will then correctly be listed.

[1]: https://github.com/odoo/odoo/commit/3192051806e0da1276604a31ad818f8768105362

opw-3591738

closes odoo/odoo#146173

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-12-15 01:35:57 +00:00
Earth Patel 35d5b96d05 [FIX] mass_mailing: don't autopublish mailing lists
Purpose:
- Changed the default value of 'Show In Preference' (is_public) field from true
  to false for preventing the automatic publishing of mailing lists.

Task-3594678

closes odoo/odoo#144699

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-12-14 22:18:38 +00:00
vlst 7403a2b7a7 [FIX] pos_self_order: remove blank option
In this pr we remove the blank choice in the self-ordering mode select.
It's unnecessary and throws a validation error on saving settings.

Task 3599144

closes odoo/odoo#142351

Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
2023-12-14 19:06:10 +00:00
rhe-odoo 69ff0f075d [FIX] point_of_sale: load product requests
When the pos was loading only a part of the products, the request should follow those rules order:
- product is a favorite
- product is a service
- product had stock moves soon
- product update

But this request didn't take into account consumables products and if there was no stock move,
the value was null and postgres consider null values first when ordering desc.
Now with that changes, the order is correctly set based on the rules above.

closes odoo/odoo#139981

X-original-commit: 35a9168a53bded7e13451f4b485443c1b419ea21
Signed-off-by: David Monnom (moda) <moda@odoo.com>
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2023-12-14 19:06:08 +00:00
Josse Colpaert 0664155bff [IMP] account: allow unknown fields in chart template.
Problem
---------
In most cases, default deferred accounts and journal need to be set up
for localizations. This is normally done in the enterprise report module
for that localization. However, in some cases, the localization does not
have special report formats. In such situation, a localization report
module that sets up very few default values for the data company is
defined. This is way overkill.

Objective
---------
Allow the community company template to have 'unknown fields' defined.
Doing so, allows for the default deferred accounts and journal to be
defined without entreprise module to exists. Currently, this raises an
error.

Solution
---------
In the pre-processing of the chart template values, we skip all the keys
in the company data that are not company fields.

We add a context value which, when True, revert that behavior back to
before this commit and checks that all fields in the company template
are actual company fields (this will be used in the standalone test for
l10n modules).

We also update the standalone test for l10n modules so that:
 1. it reports errors in all l10n modules at once.
 2. it uses the context value described above and checks that all fields
 in the company chart template are correct company field.

closes odoo/odoo#138937

Related: odoo/enterprise#50305
Signed-off-by: William André (wan) <wan@odoo.com>
2023-12-14 19:06:06 +00:00
sesn-odoo 9e1326fbe9 [FIX] point_of_sale: ensure the numpad is always left-to-right
Currently, if you switch to a right-to-left language and open the POS,
the numpad will look like this:
3 2 1
6 5 4
9 8 7

The numpad should stay the same even in RTL languages:
1 2 3
4 5 6
7 8 9

opw-3623228

closes odoo/odoo#146181

X-original-commit: fb0ece3336f53cfba4e7ef9c59f4acbd292da45a
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2023-12-14 17:57:05 +00:00
moerradi bc838e8806 [FIX] account: Quantity Reset in Invoice Move Lines on Customer Change
Issue:
Invoice move lines' quantities reset to 1 on the second page when the
customer is changed after pagination.

Steps to Reproduce:
1. Create an invoice with over 40 move lines (requiring pagination).
2. Navigate to the second page of move lines and observe quantities.
3. Change the Partner (e.g., Azure -> My Company).
4. Save changes.
5. Notice that quantities on the second page are reset to 1.

Solution:
Identified the issue as stemming from the `flush_model` method, which is
called on creation and triggers re-computation. This process calls
the `compute` method for the quantity field, leading to an erroneous
reset of quantities to 1.
Modified the compute method to only reset values to 1 if they are
initially 0 or False, thereby resolving the issue of unwanted quantity
reset during pagination when customer details are updated.

opw-3483851

closes odoo/odoo#146136

X-original-commit: bb08a627528cd7402a16689c420f3013488e9a4d
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Mohamed Erradi (moer) <moer@odoo.com>
2023-12-14 17:57:04 +00:00
Solan Delvenne (sode) cbec6b188b [IMP] snailmail: Only resend concerned letter from format error
Previously, when updating and resending a snailmail through the chatter,
it would re-send every snailmail letters in the DB with an error.

This behaviour lead to users mistakenly sending dozens of unwanted
snailmails, expecting to re-send the one they were currently on.

This commit changes that by only sending the relevant letter(s).

closes odoo/odoo#146078

X-original-commit: 43a56e84919604608d12bf3d8528339733fc79d8
Signed-off-by: Louis Baudoux (lba) <lba@odoo.com>
Signed-off-by: Solan Delvenne (sode) <sode@odoo.com>
2023-12-14 17:57:03 +00:00
Alexandre Kühn e5e01b884e [PERF] mail: faster opening of messaging menu
Before this commit, when many channels were pinned in Discuss,
the messaging menu took a while to open and render all items.

This happens because `fetchPreviews()` and `inbox.fetchNewMessages()`
were inserting data for each thread and message. This meant computed
and sorted fields were called with that many objects.

This commit improves the performances by wrapping all of it in an
update cycle transaction, so that computed and sorted fields are
invoked only once at the end of the update cycle.

With `contacts` installed, populate `medium`:
- Before this commit: 1min.
- With this commit:   2sec. (30x faster)

closes odoo/odoo#145980

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-12-14 17:57:00 +00:00
Benjamin Vray 3803406298 [FIX] website: fix misaligned elements in headers
This commit correctly aligns certain header elements when the CTA button
has a larger vertical padding.

Steps to reproduce the issue:

- Install 'eCommerce' on your website.
- In Website edit mode, click on the 'THEME' tab.
- Adjust the vertical padding of buttons to 25px.
- Click on the header in the page.
- In the 'STYLE' tab, select the 'Menu - Sales 1' header.
- Bug: The 'logo" and the 'menu items' are not aligned with the CTA
button.
- In the 'STYLE' tab, select the 'Menu - Sales 2' header.
- Bug: The 'menu items' are not aligned with the CTA button.
- In the 'STYLE' tab, select the 'Menu - Sales 4' header.
- Bug: Bug: The 'cart' button is not aligned with the CTA button.

task-3478334

closes odoo/odoo#145683

X-original-commit: d2f6710bcaa5cee7e77fc4df902929264ffa4830
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-12-14 17:56:58 +00:00
Bastien PIERRE d39b13121b [FIX] base: Automated action default update path
Before this commit, the default update_path even if the field was
readonly, it weas returned. So, if you try to create an automated
action on the stock.move.line model and try to add an action, the
button return a traceback because the field is readonly.

After this commit, the method that get the default update_path will
also check if the field is not readonly.

Bugfix Task-Id: 3624328

closes odoo/odoo#146166

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-12-14 14:26:43 +00:00
Romeo Fragomeli e95b3d1c47 [FIX] web: avoid search bar overflow
Overflowing search facets do not wrap making them disappear from view
when too long. This can happen when searching a single field for
multiple values (as they are bundled in the same facet).
The problem is fixed by allowing facets to wrap.

Steps to reproduce:
* Open a view with a search (kanban, list, ...)
* Add many, many long terms search for the same field
  => BUG the search overflow outside the search bar

opw-3581553

closes odoo/odoo#146133

X-original-commit: acd476a4ded3ca873e10dc4cc72668efdcb2c629
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-12-14 13:04:12 +00:00
Bastien PIERRE 3b2ced13cf [FIX] product: split domain between python and view
How to reprodruce:
1) Go to product.template view form
2) Open Studio
3) Go to tab 'Purchase' tab
4) Edit list/form view of the seller_ids (supplierinfo)

Before this commit, the domain on product_id of supplierinfo was using
'parent' as if already doing the filter on the view. Because of the complex
domain in the string, a traceback was throw when editing supplierinfo view
with studio on the product.template.

After this commit, the domain on the python side is simpler. The domain for
the view has been moved in the view and changed to not be dependent of the
parent view, but of the context.

Bugfix Task-ID: 3615851

closes odoo/odoo#145586

Signed-off-by: Steve Van Essche <svs@odoo.com>
2023-12-14 11:41:46 +00:00
Brice bib Bartoletti e0fb0fbc26 [FIX] PoS: payment date should be order date
The aim of this commit is to correct the date of the payment.

Context:
When creating a PoS session and a PoS order on date X
The customer gets its invoice on date Y
the payment date is printed on the invoice

Before this commit:
The payment date will always be the date of the invoice

After this commit:
The payment date will always be the date of the order, the date at which
is was really paid.

Corner case not taken care of in this commit:
Claiming the invoice after the `fiscalyear_lock_date`.
In such a case, the payment date will be set to today (the invoice_date)
again.
This should be really rare as setting that lock date in short time frame
is quite unusual.

closes odoo/odoo#146259

Task-id: 3629054
X-original-commit: 732e43d8a6d4012eafb434952ccb6609f9be8066
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-12-14 08:00:59 +00:00
Jorge Pinna Puissant 3e92da43e1 [FIX] web: clickall should not click on tablet mode views
Before this commit, clickall was clicking on an app that redirect to a
tablet mode view. The issue with this is that clickall don't know how to
exit the view, so it was stuck in the view.

This commit adds that view on the blacklist of clickall.

Also, this commit adds an error message when clickall is stuck in a view.

closes odoo/odoo#146216

X-original-commit: 8f365824c9dddacf1b3a40688a30c8498df3d5d4
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-14 08:00:58 +00:00
Aaron Bohy 64be692f7e [FIX] web: kanban: always open dialog if quick create fails
Before this commit, when the user tried to quick create a record in
a grouped kanban view (by clicking on the "+" icon of a column, for
instance), and then clicked on the "Edit" button of the quick
create, if the name_create rpc failed, the webclient switched to
the form view and an error was displayed.

The displayed error was about a destroyed component trying to do an
rpc, namely the kanban controller. This is because it does 2 things
when the name_create failed: it opened the form view in a dialog
and it also switched to the form view. The latter was unwanted:
in case of errors, we don't want to switch to the form view but
rather to quick create from a dialog.

The error was actually caused by a small mistake: we use the
record variable to determine if the quick create succeeded and if
we can switch to the quick created record. However, that same
variable was already set before, for another purpose.

OPW 3620671

closes odoo/odoo#146141

X-original-commit: 01bc79051b22f41eff20d860327ed0e41b572cd4
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-14 08:00:57 +00:00
Pierre Paridans 7a5cabe889 [FIX] website_event_track: crash in SW's fetch listener on Safari 17.0+
Before this commit, when browsing the "Events" part of website on Safari
(both macOS and iOS/ipadOS), the page could be loaded only once and
returns a "FetchEvent.respondWith received an error: NotSupportedError:
The operation is not supported." error message on afterward, completely
blocking access to everything under the `/event` path.

This error is actually thrown from the ServiceWorker's `fetch` event's
listener, and more specifically, from the storage availablity check.

Since Safari 17.0, the Storage API - and in this case its `estimate()`
function -  has been enabled in WebKit's builds for Apple platforms (see
WebKit PR [1]). But even if this feature should be available in Web
Workers (cf. MDN [2] and the spec [3]), it returns a NotSupportedError
error when called from the ServiceWorker on Safari 17.0+ (but works fine
in the global scope).

This commit works around that issue by wrapping this call in a
try/catch, acting as if not supported when an error happens.

Steps to reproduce (on Safari iOS):
- Install website_event_track module
- Navigate to the `/event` page
- Reload the page
=> Browser level error page "FetchEvent.respondWith received an
error..."

Note: due to the browser's engine restriction on iOS/ipadOS, this issue
also affects all browsers on these platforms.

[1]: https://github.com/WebKit/WebKit/pull/10973
[2]: https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/estimate
[3]: https://storage.spec.whatwg.org/#ref-for-dom-storagemanager-estimate

opw-3553880
opw-3570730
opw-3610167
opw-3629039
opw-3547759

closes odoo/odoo#146190

X-original-commit: 45020635a81ce53ee0769ca54ac733528e4110b1
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-12-14 06:56:23 +00:00
aliya 3890a4a540 [FIX] account_peppol: don't log success message in case of error
Currently, when a peppol document is received, we log a success message regardless of whether the account_move has been created properly or not. This commit changes that to only show the message if everything went well.

A follow up to a fix for opw-3628030

closes odoo/odoo#146236

X-original-commit: d1d35429d6897db7210a98889d6268a4d0d3cbe8
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
2023-12-13 20:07:41 +00:00
Alexandre Kühn ad45817435 [PERF] mail: no memoryerror from slow load_message_failures
Earlier PR improved ACLs in Discuss [1].

Route `/mail/load_message_failures` was made in non-sudo as to take
ACLs into account, so that we don't get mail failures that we don't
have access [2]

However, checking ACLs on `mail.message` from `search` on
`mail.notification` is very slow [3], to the point where the RPC
takes minutes and results in a `memoryerror`.

Ideally we should have non-sudo and make checking ACLs more
performant. As a quick fix in a stable version, we revert to using
`sudo`, which results in same quick results as before.

[1]: https://github.com/odoo/odoo/pull/138330
[2]: https://github.com/odoo/odoo/pull/138330/files#diff-6be51f3695e69474a19cf6857370c8bb9b529a15d568952258cec9a0ae519fc4R23
[3]: https://github.com/odoo/odoo/blob/17.0/addons/mail/models/res_partner.py#L251

closes odoo/odoo#146184

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-12-13 17:12:02 +00:00
Romain Derie dede76bd5c [FIX] website, website_form_project: set email_from as custom for task
Commit [1] removed the `email_from` field from the `project.task` model
but forgot to adapt/delete some field occurences.

One of those is related to the form in the website builder which allows
to create task when the form is sent.

Two errors were detected:

- Non critical:

  The field is still passed to the form field whitelisting process.
  Since the whitelisting is done in raw SQL, it didn't crash or log
  anything even if the column did not exist anymore.

- Critical:

  The field was still marked as model required in the form JS registry,
  altering the form builder behaviors.
  One of those is that when the form input related to this field was
  re-created (eg when changing / hovering an option in the right panel),
  it would lose it's "name" attribute.
  Two possible issues from that point:
  1. When a visitor submit the form, the "email_from" field value is not
     set anymore in the task description and that information is just
     lost. You then have no way to reach back to him.
  2. (Minor) The auto-fill behavior of the form was not working anymore

Probably more issues were introduced but only those ones got detected as
of today.

Step to reproduce:
- Drop a website form, choose "Create a Task"
- Focus the default "Email" field
- Hover the mouse on the "eye" icon ("Invisible") next to the Position
  attribute. If you inspect the DOM, the input has now lost the `name`
  attribute.
- If you save, you will face the issues reported above.
- If you then reopen the editor and focus the email field again, the
  tooltip will now say that the "null" field is required.

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

opw-3626573

closes odoo/odoo#146170

X-original-commit: 6679fddbcaf7d9146ab242e0eed61ee0628f047f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-13 17:12:01 +00:00
Victor Piryns (pivi) 170f09c118 [PERF] project: invert domain on task closed states to hit index
Description:
Indexes on a Selection field are never used in a `NOT IN` where clause,
as PostgreSQL doesn't have the complementary values (in DB a Selection
field is just a VarChar) to make use of an index on the field.
The ORM currently doesn't invert
`not in <selection>` -> `in <complement of selection>`.

Benchmark:
Positive impact in the project modules all around, specially for long running
projects where the proportion of "done" tasks are >90% of the
project's task. On a populated project with 10k tasks, 200 of those are
open, there were around 10x improvement on the requests linked to
rendering the kanban view of the project. More elaborate benchmarks are
available in the referenced task.

Reference:
task-3576802

closes odoo/odoo#146168

X-original-commit: 403a7c78f06f6b99233e6fc045bde67f0c670702
Related: odoo/enterprise#52708
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-12-13 17:12:00 +00:00
Yann Papouin d03a377326 [FIX] mrp: Don't override user domain already defined in production model
The view set a domain with `share = False` but the model search for
users with group `group_mrp_user`

closes odoo/odoo#146167

X-original-commit: 25386559629c5e7bbd9decb3fb7ca57ab0ccea18
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-12-13 17:11:58 +00:00
Julien Alardot (jual) 5785139f10 [FIX] account: Fix sequence hole warning
Lacking a flush to database before the query used to compute
the gap-in-sequence warning, the gap-in-sequence warning
would stay active even when the all-users lock-date was set.
Which is confusing for the user as they can't do anything about it.

This
 - adds the required flushes
 - adds a tooltip explaining the warning in more details
as it was deemed confusing
 - Adds all the moves that took a sequence number in the query

Task-3613058

closes odoo/odoo#146160

Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
2023-12-13 17:11:57 +00:00
Aurélien Warnon 3eaddbd76f [FIX] survey: fix nondeterministic runbot issue
This commit fixes a nondeterministic runbot issue during the survey session
management tour suite (that actually contains multiple tours).

It turns out that the first tour is so short that it does not let enough time
to the web framework to correctly initialize everything before it gets killed
(as the tour steps are completed almost instantly).

It's hard to say exactly where the issue comes from, as the error does not
mention anything (we only know that it's a rejected promise):
"""
Error received after termination:
PromiseRejectionEvent(
    isTrusted=true,
    reason=Event,
    type='unhandledrejection',
    target=Window,
    currentTarget=Window)"
"""

Removing this first tour also removes the nondeterministic issue.

It seems like an acceptable compromise as this tour was not really testing
anything anyway, we now directly start the session from the python code.

(Note: this issue only started occurring in v17).

Task-3637591

closes odoo/odoo#146107

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-12-13 17:11:55 +00:00
Antoine (ande) 377ddf7f85 [FIX] event: QR code is squished
Current behaviour:
QR code is squished, it's 77x21 px

Expected behaviour:
QR code should be 100x100 px

Steps to reproduce:
1. Go Email Templates
2. Find 'Event: Registration Confirmation'
3. Click on preview
4. QR code is squished

opw-3625701

closes odoo/odoo#145963

Signed-off-by: Jérémy Hennecart (jeh) <jeh@odoo.com>
2023-12-13 17:11:53 +00:00
roen-odoo 711ec4a9e1 [FIX] pos_loyalty: Consider reward divided by tax as 1 reward
Current behavior:
When a reward is applied on an order containing different product with
different taxes, the rewarded is divided in multiple lines (one per tax)
This cause issue when calling, the `_updateRewardLines` method.
Because it will consider each line as a full reward, and therefore will
apply the reward multiple times even though the reward is only applied
once.

Steps to reproduce:
- Create a reward with a discount of 5$ in exchange of 100 points
- The reward should give 1 point per 1$ spent
- Create a product with a price of 100$ and a tax of 10%
- Create a product with a price of 100$ and no tax
- Open the POS and add the 2 products to the order
- Select a customer, and click the reward button
- The reward will be applied 2 times (4 reward lines are created)

opw-3583174

closes odoo/odoo#145759

X-original-commit: 8214322a0f06d74005c46d2623972f6eb393cc08
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2023-12-13 17:11:51 +00:00
suth-odoo ee5a83d3e1 [FIX] mrp_subcontracting: fixes the breadcrumb issue indicates 'projects' twice
Steps to Reproduce:
- install service apps and website
- install website related bridge modules
- install quality and related mrp_subcontracting bridge module
- click on website , click on My account
- click on project ,or timesheet,or tasks,or tickets

Issue:
- after clicking,we will notice that breadcrumb  indicates 'title' twice

Cause:
- this is because,in mrp_subcontracting , the title for productions is given
  without checking the page_name , so that will affect all the titles.

Solution:
- if we gave condition to check the page name for production this issue is
  solved.

task-3607053

closes odoo/odoo#144477

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-12-13 17:11:49 +00:00
Hubert Van De Walle 63a4481ad4 [FIX] web: reset expanded fields on import compatibility switch
Steps to reproduce
==================

- Go to users
- Open the export dialog
- Expand the Groups field
- Add the Groups > Groups/Access Controls field
- Check the import compatibility option
- Expand the Groups field again
=> `TypeError: this.knownFields[id] is undefined`

Solution
========

The expandedFields were not reset. We also need to update the t-key to
take the compatibility state into account.

opw-3378834

closes odoo/odoo#146116

X-original-commit: d2f52abb8ce1b7e5291e0de7d4ea7788f39115bd
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-12-13 15:53:00 +00:00
Levi Siuzdak (sile) 95f12b4667 [FIX] sale_timesheet: set is_so_line_edited when clearing so_line
Versions:
---------
- 16.0+

Steps to reproduce:
-------------------
1. In Timesheets, add a new line;
2. link it to a Sale Order project;
3. make it non-billable by clearing the Sale Order Item field;
4. select related project in Project / Configuration / Projects;
5. in Invoicing tab, add yourself and a Sales Order Item, then save;
6. go back to Timesheets;
7. check the Sales Order Item field of the timesheet you created.

Issue:
------
Sales Order Item was changed automatically, this shouldn't happen after
a manual change.

Cause:
------
The `so_line_field` widget used the `this.changeOnEmpty` attribute to
check whether `is_so_line_edited` should be set, but this was removed in
1ecdbfcfbf, hence the field will never be
set when clearing the `so_field` value.

Solution:
---------
On a field change, compare the previous ID of `so_line` with the new ID,
and set `is_so_line_edited` to `true` if they're different.

Related:
--------
odoo/enterprise#52544

opw-3547725

closes odoo/odoo#146062

X-original-commit: bc1ad08286be9bb02d111e49fe095879b649449e
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Levi Siuzdak <sile@odoo.com>
2023-12-13 15:52:59 +00:00
Arnold Moyaux 8f6e89bdd7 [FIX] mrp, purchase_stock: default route on replenishment
Usecase to reproduce:
- Install purchase and mrp
- On a product set both routes manufacture and buy
- Create a BoM for the product and define a seller
- Sell a unit
- Open the replenishment. Buy or manufacture is set as route
- Go to the settings and set the route not sellected to the smallest
  sequence
- Delete the orderpoint and open the replenishment menu again.

Expected behavior:
The new route with smallest sequence is selected

Current behavior:
The same rule is selected and the order used by _get_rule and to
compute the lead time is bypass

It happens because both override of the method are at the same level
(super of stock) and are call arbitrary one before the other.

In order to fix it uses rule_ids that was computed before calling the
function and it contains the real rules used to compute the lead time

closes odoo/odoo#146051

X-original-commit: cad38a349c3486cb199ef8079bdd46cffefd5b2e
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-12-13 15:52:56 +00:00
Mahdi Cheikh Rouhou (macr) e64211e04f [FIX] hr_attendance: open front camera in kiosk attendance
Issue:
======
Front camera doesn't open even if we set it in the configuration.

Steps to reproduce the issue:
=============================
- Install attendance
- Go to attendance/ configuration and put front camera in barcode source
- Use mobile : Go to kiosk mode and start scanning

Origin of the issue:
====================
There was a typo in the props values where we assigned `employee` to
`barcodeSource`

opw-3621239
opw-3608019

closes odoo/odoo#145880

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-12-13 14:15:43 +00:00
Xavier-Do 30db58e5e6 [FIX] base, website: don't cleanup invalid bundle
Before this commit the clean_assetbundle could unlink invalid
attachment, mostly when generating a no website assetbundle with
a different version than a website one, the website assetbundle will be
deleted.

Generating a new asset bundle attachment /web/assets/439-b4c80c3/1/web.assets_frontend.min.css (id:439)
Generating a new asset bundle attachment /web/assets/440-3723971/web.assets_frontend.min.css (id:440)
Deleting attachments [439] (matching /web/assets/%-%/web.assets_frontend.min.css) because it was replaced with /web/assets/%-3723971/%%%

The issue is that %-%/ will match 439-b4c80c3/1/ and not only
439-b4c80c3/

Note that it looks like this issue existed for a while but was invisible
because before 16.4 clean_attachment was invalidating the ormcache,
hiding the fact that a still valid asset was deleted and regenerated.

The proposed fix replaces the domain with %-_______/. The unique is
always 7 character long. Note that this change was already made in 17.0
when removing the id from the asset url so this doesn't need to be
completely forward-ported.

opw-3558552

closes odoo/odoo#145452

X-original-commit: 2ac466547e01bfd65415a53ae1efc9d45d9299fb
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-12-13 14:15:40 +00:00