Commit Graph
162049 Commits
Author SHA1 Message Date
Sébastien Theys c38e1bfee9 [REF] mail: move public page to discuss folder
Part of task-3265211

Part-of: odoo/odoo#124495
2023-06-12 17:41:10 +02:00
Valeriya(vchu) bce4aededc [IMP] (pos_,sale_)loyalty: improve validity period
currently it is only possible to define the end_date that
does not allow to prepare the program in advance.
Added the start_date property to the program model.
task-3305712

closes odoo/odoo#121193

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2023-06-12 17:40:58 +02:00
Victor Piryns (pivi)andFeyensv 500c7ab056 [FIX] website_sale: correct base_price in shop with tax included
Current behaviour:
If you have a product with tax included, and you make a discount via
a pricelist, the `base_price` of the product in the /shop page is not
correct. (it's not the same as the one on the product page, which is
correct)

Expected behaviour:
The base price in the /shop page and on the product page should be
the same in general. Should the price with tax included before the
discount.

Steps to reproduce:
- Install eCommerce, Sales
- Settings > Display Product Prices > Tax Included
- Settings > Pricelists > Advanced price rules
- Check Settings > Comparison Price
- Create a tax of 21%
- Create a product, set it's Sale's Price to $61.98, with the tax
  (tax incl = $75)
- Create a pricelist that apply to the product, give it a discount
  of 20%, and apply the discount policy "Show public price &
  discount to the customer".
- Go to the /shop page and search for your product, observe the
  `base_price` of the product is not correct.
(refer to video in ticket for a walkthrough)

Reason for the problem:
Lack of adaptation of a fw-port in commit:
30ad33de9c320f19258974a8eb77df26480d653c

Fix:
Correct the fw-port and aggregate the conditions when applying taxes
on the base price.

Affected versions:
- saas-16.1
- saas-16.2
- saas-16.3
- master

opw-3194646

closes odoo/odoo#124649

X-original-commit: a4500d1535bbf5cff7014a29971fb2e7637e2acc
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
Co-authored-by: Feyensv <vfe@odoo.com>
2023-06-12 15:27:04 +02:00
Julien MougenotandJorge Pinna Puissant 1e959827b2 [FIX] web: Fallback to latin numbers when parsing dates
Before this commit, when inputting latin numbers (i.e. 0-9) with a
locale using a numbering system different than "latn" (e.g. "arab"),
the parsing failed resulting in an error.

The issue is that these locales often support both their numbering
system as well as the "latn" one. This commit makes the parsing fall
back to the "latn" system in case latin numbers are found in the input.

OPW-3316325

closes odoo/odoo#124635

X-original-commit: 12970754fc915eb181e040d3e45fc566fe310167
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-06-12 15:27:00 +02:00
Adrien Minne (adrm) 2ef25b8372 [FIX] spreadsheet: download excel with filtered values
Open a spreadsheet, add a data filter, filter some values,
File > Download
=> the filtered values are not exported.

Previously, we gave the exported data to the action_download_spreadsheet
action, and we created a new model based on the data. This was a problem
for data that was only exported for the xlsx in UI plugins, because this
wasn't in the exported data.

Fixed by giving the xlsx data to the action_download_spreadsheet action instead
of the data.

Odoo task 3231170

closes odoo/odoo#124617

X-original-commit: 8a7e2ecf60993c6862c8980b70e847c0e5aa2a50
Related: odoo/enterprise#42355
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Minne Adrien (adrm) <adrm@odoo.com>
2023-06-12 15:26:50 +02:00
Daniel BlancoandJosé Moreno Hanshing 9d4710a823 [FIX] l10n_cl: enable purchase invoice for foreign vendors
Description of the issue/feature this PR addresses:
Before SII resolution 46 from 2022, the only documents for foreign vendors were 110 111, and 112.
After that, SII and accountants are indicated as a practice to issue purchase invoices (Factura
de compra 46) to foreign vendors in order to pay the vat taxes, mainly for digital services.

Current behavior before PR:
It is not allowed by validation restrictions to issue this document type to foreign vendors

Desired behavior after PR is merged:
the validation release the restriction for document type 46

closes odoo/odoo#124392

X-original-commit: ee2485fd4c4e0f1ababbc74a0e1f349d58380cff
Signed-off-by: Josse Colpaert <jco@odoo.com>
Co-authored-by: Daniel Blanco <daniel@blancomartin.cl>
Co-authored-by: José Moreno Hanshing <jose@blancomartin.cl>
2023-06-12 15:26:46 +02:00
Jurgen (jugj) d782a42483 [FIX] web, hr(_recruitment) : Fix the phone field widget text breaking in multiple lines This PR Fixes the phone widget in the hr views and adds back the possibility to SMS to mobile and phone task - 3242157
closes odoo/odoo#124626

X-original-commit: f6964d7cab3090acdd9a3b777ef17f02b0d2ac02
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-12 14:04:23 +02:00
Didier (did) 4cda4fab1f [FIX] mail: remove hard coded text-danger
closes odoo/odoo#124619

X-original-commit: 1c1b1e92c86e1ea7c81384e66b2549d77d3b37f2
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-12 14:04:19 +02:00
Alexandre Kühn aea5e51c42 [FIX] mail: long logged note in chatter should word break
Otherwise it makes whole chatter overflow on the right.

closes odoo/odoo#124618

X-original-commit: 61f47dfe74fa65fa55aa68c4a9676362511dc478
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-12 14:04:15 +02:00
Ivan Rasputin 1040be1010 [FIX] website_sale_loyalty: fix dictionary updating
After recent refactoring [1], sentry caught [2] `KeyError` on adding a record to
`res[coupon]` in `_get_claimable_and_showable_rewards` method.

Dictionary `res` may not have `coupon` and hence it leads to the error

https://github.com/odoo/odoo/blob/31b8151736b3382cca5601cd652b1d5482790af9/addons/website_sale_loyalty/models/sale_order.py#L198-L205

https://github.com/odoo/odoo/blob/31b8151736b3382cca5601cd652b1d5482790af9/addons/sale_loyalty/models/sale_order.py#L595

Fix it by checking `coupon in res` first.

[1]: https://github.com/odoo/odoo/commit/6525d5fba40c77ef9ed4445b8b9573550a1e2442

[2]: https://online.sentry.io/issues/4235487414

closes odoo/odoo#124616

X-original-commit: 57a00cae57116869f33e7267ad5ee84bd7600593
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2023-06-12 14:04:10 +02:00
tsm-odoo 5c12a8b82e [FIX] mail: load after message order
In [1] the order by `id ASC` has been removed from the
`_message_fetch` method. This is wrong since we want
to load the messages coming DIRECTLY after the given
id thus, this order is required.

In order to solve this issue, this commit ensures the
order of the messages returned by the `_message_fetch`
method is always in descending order as it was done
implicitly before [2].

[1]: https://github.com/odoo/odoo/pull/123664
[2]: https://github.com/odoo/odoo/pull/116666

task-3349175

closes odoo/odoo#124169

X-original-commit: 074a5fea5a7f08c7018620cb9b2b956b3a871344
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-06-12 14:03:53 +02:00
Valeriya(vchu) a29971df55 [FIX] payment_adyen: prevent override of the server error by the generic one
Before this commit the generic message error was shown in the payment form
instead of the server error message that did not allow the users to
understand the problem that caused it.

After this commit the server error is shown in the payment form.

closes odoo/odoo#124040

X-original-commit: dc1230648415dbeeb672c6fb9168472ac8c7d651
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Valeriya Chuprina (vchu) <vchu@odoo.com>
2023-06-12 14:03:48 +02:00
Valeriya(vchu) 0a5ee69c51 [FIX] payment_adyen: set error when offline transaction failed
When the offline transaction failed, the error was raised that rollback
all the operations and the failed transaction was not traced anywhere.

With this commit the error is caught and the failed transaction can be
seen in chatter.

X-original-commit: 21e84624841690d36bd38b768e35cc61b3c6a17b
Part-of: odoo/odoo#124040
2023-06-12 14:03:47 +02:00
Nicolas Viseur (vin) 12473cb0c0 [IMP] l10n_au: The opening statement should be dated to the 30th of june
Since the fiscal-year end this day.

Task id #3338971

closes odoo/odoo#124607

X-original-commit: c2640430874771d7db9cd587e7a9a04a01f7ae42
Related: odoo/enterprise#42349
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-06-12 12:41:52 +02:00
Demesmaeker 39a7cdca21 [FIX] product: price computation based on cost
- Standard price (cost price) is there for variants and for product template when there are no
variant, as it has no sense the have one otherwise. Templates with variantS have a cost of 0.
- On the website, product shown are the product templates, but you select and then buy the product
product (variants).
- The pricelist can be set to make a discount based on the cost.

==> If such a pricelist is used, the product templates having more than 1 variant are shown with a
price of 0 until you can select the wanted variant

opw-3232621

closes odoo/odoo#124594

X-original-commit: 561eba8f2adece4c21ea46c1bd050779ea3dc676
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-06-12 12:41:45 +02:00
Romain Derie 9addf96178 [FIX] website: make megamenu thumbnails template translate mode friendly
Without this commit, the words in this template (below the images) won't
be colored as translated (green) / not translated (yellow).

This is because there is a block element inside an inline element and
the color is applied on the inline element which has no impact on
children blocks since inline elements don't take up available space.

See https://stackoverflow.com/a/7439861
Note that:
- `display: inline-block` is not an option either as it would be messing
  with the `t-field` which receive this `data-oe-translation-state`
  property too. Applying the `inline-block` style on those will break
  the layout, typically on a product page.
- same for `display: contents`, it's not working as such elements don't
  generate any box, properties like border / bg color etc are thus
  ignored.

opw-3305117

closes odoo/odoo#124560

X-original-commit: ed89b0ffd7f4d6a04f71f474720ff4d82c9ecf9a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-06-12 12:41:40 +02:00
Om Rabara c3340c37e9 [FIX] website: prevent typeerror when 'url_from' field is empty
TypeError: expected string or bytes-like object

This error occurs when the 'url_from' field is left empty during website rewrite
To reproduce this issue, follow these steps:
1. go to website ->  configuration -> redirects
2. create a new record -> select 308 redirect / rewrite in action
3.  keep 'url from' empty and put any value in 'url to' such as '/'
4.  Click on the save button, and this error message will be displayed.

After applying this commit will fix this issue.

task-3346588

sentry-4229658026

closes odoo/odoo#124558

X-original-commit: 26fa923f6ab01298bf1a1e9f6a615c9aa9e2e5ed
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-06-12 12:41:36 +02:00
Demesmaeker 9a14037d50 [FIX] test_sale_product_configurators: use saveForm
Currently, discardForm has some indeterministic problems during the nightly runs.
To avoid this and until the problem is solved, these tours now use the saveForm instead.

closes odoo/odoo#124544

X-original-commit: 29d6ba2716fe0067903f1b5ee480e2e03757e0f7
Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2023-06-12 12:41:23 +02:00
Andrea Grazioso (agr-odoo) 4caddf1787 [FIX] hr_expense: due date conflict with payment terms
Have an employee with payment terms set in the contact form
Create an expense for $100 for the employee
Create the expense report > Submit to manager > Approve > Post journal
entries

Issue: The bill due date is manually set to the Accounting Date.
This is not consistent with the Payment terms applied on the
bill

opw-3298981

closes odoo/odoo#124542

X-original-commit: d363aa12429768e63d0f9def7006101983fd0adc
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2023-06-12 12:41:19 +02:00
Saurabh Choraria 2476a5b1bb [FIX] base: prevent traceback when icon file is not found
When user tries to import a module which does not consist of an icon and then
when user tries to access that module the error occurs.

Steps to reproduce:
1. Install web_studio.
2. Import a module(without icon) from apps > import module menu.
3. Now search that module in apps and click on module info.
4. The error will occur.

Applying this commit will fix this issue.

sentry-4206999375

closes odoo/odoo#124540

X-original-commit: 4b0221800ab75d5573e7066bf8beee14488062dd
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-06-12 12:41:15 +02:00
Andrea Grazioso (agr-odoo) f95e49beb0 [FIX] account_edi: multi record send&print
With an EDI localization (MX)
Create 2+ invoices with edi attachments (xml)
In list view, select both and hit actions > send&print

Issue: EDI file will not be attached to the mail

opw-3330554

closes odoo/odoo#124446

X-original-commit: 9730a9753936f040a987505ed064cfd51acb50e0
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2023-06-12 12:41:08 +02:00
Benjamin Vray 114736ba49 [FIX] website: fix alignment label of magazine and hamburger-full header
This commit modifies the label of the alignment option for the
"magazine" and "hamburger-full" header. It changes the label from
"Mobile Alignment" to "Alignment" when the "hamburger type" option is
set to "off-canvas." This is because in this case, the alignment also
affects desktops.

The bug was introduced by this commit [1].

This commit also changes, for the same reason, the label of the
alignment option for the slogan header.

[1]: https://github.com/odoo/odoo/commit/3eaab4e81ea2598788c9d6757ef38bbbd6454f65

task-3254619

closes odoo/odoo#124277

X-original-commit: 5b854cb332d1cd65769427750bb2bef758176c2d
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
2023-06-12 12:41:04 +02:00
Camille Spiritus 0889c999a5 [IMP] account-l10n_ch: remove ISR documents
In Switzerland, an ISR payment file was to be added to an invoice.

This file has since been replaced with the QR Bill: https://www.pikon.com/en/blog/everything-you-need-to-know-about-the-swiss-qr-bill/

Removed its usage, while keeping the references that the QR Bill still uses.

task-3040400

closes odoo/odoo#111176

Related: odoo/enterprise#38187
Related: odoo/upgrade#4451
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-06-12 12:40:57 +02:00
Mahdi Cheikh Rouhou (macr) 297cf7c7ea [FIX] purchase_requisition : prevent creating purchase agreement from PO form
When you create a purchase agreement from the from view of a purchase order , it can have some invalid states which may lead to not having a vendor too.
Since choosing a purchase agreement makes the vendor read only on the PO form , then it may lead to having a PO form without a vendor and can't update it.

Steps to reproduce the error :
1- activate blanked orders
2- create a new purchase order directly from the PO form

opw-3335891

closes odoo/odoo#124528

X-original-commit: 100187e904b85306a7823c54adb78f493abacf78
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
2023-06-12 11:22:07 +02:00
Soukéina Bojabza 7c7c37fe32 [FIX] web_editor, website: keep text selection when toggling grid mode
Since commit [1], the text selection must be kept if there was one when
using a snippet option. However, it is not the case when toggling the
grid mode for snippets that have None columns (e.g. Text) or have some
content outside of their row element (e.g. Picture). Indeed, when these
contents are wrapped inside a new column and then in the row, the
selection is lost.

This commit, as done in commit [2], restores the selection after the
content wrapping. It also adds a test checking if the selection is well
kept when toggling the grid mode and going back to normal mode.

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

task-3324775

closes odoo/odoo#124513

X-original-commit: bcb0e9b83fcb7e3f8a66131a089b88b39f58a2e4
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-06-12 11:22:03 +02:00
Soukéina Bojabza 0f84b3aed7 [FIX] web_editor: allow to delete/replace text after toggle to grid mode
When toggling a snippet to grid mode, if it has None columns (e.g. Text)
or if it has contents located outside of the row element (e.g. Picture),
the contents are wrapped inside a column and then put inside the row.
However, after this operation, it is impossible to delete or replace the
text in this newly created column.

As mentioned in commit [1], this happens because there is an unwanted
rollback in the history, which should be prevented by resetting the
nodes unbreakable id (i.e. the `ouid` property).

This commit makes this property reset and therefore allows to delete or
replace the text after the toggle to grid mode.

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

task-3324775

X-original-commit: 5bd354802a9aae9575806ad83350e0b002efa2fa
Part-of: odoo/odoo#124513
2023-06-12 11:22:02 +02:00
Eteil Djoumatchoua(etdj) d1da2928e9 [FIX] stock: number field for stock picking record
The ``stock.picking`` record doesn't have a 'mobile' or a 'phone'
field which can be used by ``sms.composer``,thus we need to return
the ``partner_id`` field instead.

opw-3286153

closes odoo/odoo#123716

X-original-commit: 35311aecef034402eac76e60acdc2658b9c681cf
Signed-off-by: Djoumatchoua Eteil Junior (etdj) <etdj@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-06-12 10:02:23 +02:00
Eteil Djoumatchoua(etdj) 16bb22f5fc [FIX] sms: send SMS on transfer without traceback
Steps to reproduce:
- Create a SMS template with the 'Applies to' property set to
  Transfer (without this the action will never appear)
- Go to Transfer, pick one, open action and try to send a SMS

Issue:
Traceback

Cause:
When sending the SMS we try to modify the 'mobile' attribute of
'stock.picking' but it doesn't exist.

opw-3286153

X-original-commit: c84f952824bea4c1e0d5dcc7450d5e48a5637db8
Part-of: odoo/odoo#123716
2023-06-12 10:02:22 +02:00
Dossogne Bertrand dc37979e7b [IMP] hr_holidays: display correct calendar attendances
Before this commit, the attendance and non-working days were
always based to the current calendar of the user's employee.
This is not accurate since we can see other's calendars and
contract changes can lead to calendar changes (from full-time to
part-time,...).
This commit base that view on the viewed employee contracts so that
even a contract change is correctly viewed.

task-3060722

closes odoo/odoo#121153

Related: odoo/enterprise#42125
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-12 10:02:15 +02:00
Victor Piryns (pivi) 3d01757aba [FIX] sale: correct disabling of attr. for archived variants
Current behaviour:
In the context that a variant is being archived after the removal of
one of it's attribute lines, on the e-commerce product's page of
said product some of the attribute values are disabled because they
were part of the archived variant.

Expected behaviour:
Archiving a variant due to removal of an attribute line shouldn't
disable the selection of the other attributes on the e-commerce
product's page of the product, since the variant can never be
reconstituted (the current selection of attributes lines is `X-1`,
where `X` is the number of attribute lines of the archived variant).

Steps to reproduce:
- Install eCommerce,
- Create a product with 2 attribute lines and add values A1,A2 and
  B1,B2 respectively, 4 variants should be created (cross-product).
- Go on the e-commerce product's page of the product, add the
  variant A2,B1 to the cart
- Go in the backend, delete attribute line (B1,B2), from the product
  template
- Go back on the e-commerce product's page, the option with A2 is
  disabled.

Reason for the problem:
When deleting an attribute line from a `product.template`, if one of
the variant is being used somewhere (in our case as a `sale.order.
line` of the cart), it is archived instead of deleted. This means
that when loading the page of the product with send the attribute
values of the archived products, so we can disable the selection of
the attributes that would make the archived variant. Since A2 is
part of the variant A2,B1 that was archived, we disable the
selection for A2, without taking into account that we don't have the
same number of attributes than the archived variant and it is
impossible to make the archived variant from the e-commerce
product's page.

Fix:
Restrain the condition that checks for which attributes to disable.
We make sure that we have *any* common part of the selection to the
archived variant, and we also make sure the count of the attributes
for the product is the same as the archived variant we are checking
against.

Affected versions:
- 16.0
- saas-16.1
- saas-16.2
- saas-16.3
- master

opw-3329225

closes odoo/odoo#124536

X-original-commit: 411441861a3242fddce5ffd02b09cbc5556aef90
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
2023-06-12 08:16:30 +02:00
Thomas Lefebvre (thle) c6079e8946 [FIX] website_sale: prevent multiple click on confirm button
Issue:
When the product sold has a zero price,
it is possible to click the "Confirm Order"
button several times.
This will send several confirmation emails.

Cause:
Because the price is zero,
we do not have a widget that handles
the `disabled` attribute of the button.
This is handled by a widget
when we have the `o_payment_checkout` form,
but it is not the case when
selling a zero price product.

Solution:
Change the attribute of the submit
button when submitting the form to prevent
multiple click.

opw-3246935

closes odoo/odoo#124519

X-original-commit: 53c6ebfdf7c5acb5103bf9ef5cb7c12f92ceefb9
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-06-12 08:16:26 +02:00
Julien Castiaux ade2715910 [FIX] core: jsonrpc sends 400 for non json request
Send a request to any json-rpc route with a HTTP header
`Content-Type: application/json-rpc` but send non-json or
non-jsonrpc data in the body. The application crashes with
a 500 Internal Server Error instead of a 400 Bad Request one

closes odoo/odoo#124571

Closes: #122048
X-original-commit: a1b83b07996f3fe4744474ff4023a3a2ce17ac7f
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-06-11 00:34:31 +02:00
Jason Ribble f2cc5b6661 [CLA] signed CLA for jasonribble
closes odoo/odoo#124567

X-original-commit: f9054dff53db2cd07a8bdfe5f332a40223c88aa2
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-10 16:50:55 +02:00
Xavier Bol (xbo) c23e10654c [FIX] sale_project: edit SOL in subtasks subtree if user is salesman
Before this commit, when the user set a subtask and wants to directly
set the SOL of that subtask in the subtree view of a task form view. He
cannot because the field is in readonly.

This commit makes the field editable if the user has access to Sales app
as it is the case for the SOL field in the form view of task.

task-3336215

closes odoo/odoo#124563

X-original-commit: 0373abdf24e1139706e6d7610873cc89ada60e74
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-06-10 12:18:56 +02:00
Audric Onockx (auon) 6b3c5370a8 [IMP] hr_timesheet: allow timesheeting on sub-tasks with no project
Allow timesheeting on sub-tasks with no project_id set.
Instead, refer to the project_id set on its parent_id, and so on,
recursively.

task-3336215

X-original-commit: d794e41619a36a8c9ad1e77a816e57051207cdcf
Part-of: odoo/odoo#124563
2023-06-10 12:18:56 +02:00
Xavier-Do ca8dc2d9b4 [IMP] base, website: small refactoring
Mainly to simplify website overrides and general api

closes odoo/odoo#121376

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-06-10 11:14:12 +02:00
Xavier-Do 1b9ac0e100 [IMP] base, website: match similar assets.
This is a proposal to try to find a similar asset before generating one.

If get_attachments fails, the next step will be to generate the
attachments from scratch, a slow operations.

When creating a new website, all assetsbundle would actually be
similar to their version without website, but the url is different.

This can be visible because the first loading of /web is slow after
creating a new website: the website_id is forced in the session
and the assets_backend are regnerated, identical to the original ones.

This commit proposes to try to find an attachments with differents extra
but the same uniquifier when possible and copy it's content.

Note that just returning the other attachement url may work, but it
would be confusing to randomly have links to assets comming from another
website_id. This would also be a problem if the original attachment is
unlinked, forcing to recompute it for other websites.

Good to know, since the content is the same, no duplication of the
content should appear in the filestore, just an entry in the database.

Part-of: odoo/odoo#121376
2023-06-10 11:14:11 +02:00
Xavier-Do 6d5d234f15 [IMP] base: better ormcache management
1. move cache to _get_asset_paths

The `_get_asset_content` cache has many cache key that are related to a
posprocessing of the `_get_asset_paths` result, the heavy part of this
method. Moving the cache to _get_asset_content will have the benefit
to create less duplicates entries in the ormcache as well as less cache
miss.

To simplify even further, the css and js parameters are removed since
they only filter the output of get_paths, the heavy part of globing the
file will be done before that. Anyway, they are both true when called
from _get_asset_content, and the only other call, in
`_get_related_bundle` don't really need to filter them since it is not
a critical part regarding performance, and the funtional result will
stay the same.

The initial orm cache key was using `_get_template_cache_keys`, a little
overkill and possibly creating duplicates entries again. The only
context key needed is website_id for `_get_related_assets`.

Note that it is not really enough, the orm cache key should actually
contain `request.session.get('force_website_id')` as well has
`request.httprequest.host`. This will be addressed latter since a nicer
solution would be to have website_id as a unique parameter computed
earlier.

2. better _get_asset_paths cache key

The orm cache key was simplified in previous point but there is still
one concern, the website_id depends on more parameters than that:
- request.session.get('force_website_id')
- request.httprequest.host
- existing websites

The idea here is to call `get_current_website` instead of using all
parameters that could define the webiste.

In the same spirit of `_get_template_cache_keys` `_assets_path_params`
can be overriden to give extra params that are usefull to list assets
path. Those params are computed before entering the method
`_get_asset_paths`. This may latter put at a higher level latter, in
get_asset_node, to simplify the _generate_asset_nodes_cache key.

3. better assets_node caches key

The main purpose of this part is to improve ormcache containing assets
nodes. The ormcache key contains
- to much context key
- missing session/host/env info
- unwanted boolean options.
- keys leading to the same cache value

The main goal being to reduce the size of the cache keys, decrease the
number of cache entries and improve the cache hit.
This will also make the behaviour more coherent and hopefully less bug
prone because of mismatch in parameters.

The main reason of the orm cache is the slowness of the validation of
the assets. This includes:
- listing files (dedicated orm cache)
- computing version

The cache key was depending on
- `debug`
The only relevant value for debug is "contains assets"
We dont need to differ between debug='', debug='1', debug='test',
and 'debug=assets', 'debug=tests,assets', ...
- `defer_load`, `lazy_load`, `media`
Those values are only useful to generate html node, a leightweight
operations that does not really needs to be in cache. `media` was also
used in the generation but it looks useless if we have the media on the
node. THIS NEEDS TO BE VALIDATED but in any case, since media is not
used to generate the url, it doesn't make sence to use it in the
generation.
The main idea to remove them from the ormcache key is simply to generate
the nodes outide the ormcached values.
-`async_load`
This one is similar to `defer_load` and `lazy_load` but it looks like
it wasn't used anymore. This was simply removed
- context.get('lang')
The only information needed is the direction, rtl or ltr. This means
en and fr languages, despite sharing the same css assets, will duplicate
the ormcache entries.
-`_get_template_cache_keys`
Only the lang and webiste where really relevant in this flow. Other
keys are actually useless in this flow.

Some information used in the generation where not in the orm cache key
- `self.env.user.lang` if there is no lang in the context
- `request.session.get('force_website_id')`
- `request.httprequest.host`
- ...

The proposed solution is to:
- extract any informùation needed from thecontext, request, environment
before entering the ormcache, reduce it to the minimal possible set of
values needed
```
    rtl = self.env['res.lang']._lang_get_direction(self.env.context.get('lang') or self.env.user.lang) == 'rtl'
    assets_params = self.env['ir.asset']._get_assets_params()  # website_id
    debug_assets = debug and 'assets' in debug
```

and remove a leightweight part of the logic

```
    def _get_asset_nodes(self, bundle, css=True, js=True, debug=False, defer_load=False, lazy_load=False, media=None):
        links = self._get_asset_links(bundle, css=css, js=js, debug=debug)
        return self._links_to_nodes(links, defer_load=defer_load, lazy_load=lazy_load, media=media)
```

Where _get_asset_links is the cached part, and _links_to_nodes is the
lightweight part generating the nodes based on the `defer_load`, ....

Additionnal notes:
- data-asset-version and data-asset-bundle are removed from the node
since they don't seem to be used anymore since 65d70acdbf
- async_load is removed since there is no occurence of this in the code.
- a small hack is still needed to pass javascript content instead of
links, this is only to manage css compile error and will hopefully be
removed in the future.
- a context key is still in use to generate the bundle, the
`commit_assetsbundle` but it has no impact on content and will hopefully
be removed in the future.

4. Add test for ormcache hit/miss

In this context, hit/miss is about having the same cache key for the
same result. This test demonstrates the current state, were entries are
create in the ormcache only if the key is really different and will lead
to a different result.

5. remove cache invalidation

This cache invalidation is quite agressive since everytime an
assetbundle is updated, all workers will clear their cache.

The concerned cache by this clear_cache is `_generate_asset_nodes_cache`
throug `_get_asset_nodes`.

The cache is ignored, both in dev=xml and debug=assets.

This clear cache was made conditionnal in 553ea82f81 but this does
not solve an issue we can have in production.

Lets imagine a clean solution
- all sources are updated
- all workers are restarted.

The orm caches are all empty, but since the sources
changed, all bundles will be recomputed. This means that every bundle
updated in database with save_attachement will invalidate the cache of
all workers. Rendering a pdf report of any kind using a specific bundle
will invalidate all cache. Starting a debug=assets for the first time
will invalidate all cache, even if the cache is not used in this case.

But for a regenerated bundle we would expect the ormcache to be:
- empty (did not generate the same bundle yet)
- have the same value (concurrent generation of the same bundle)

Having a different value would mean that the bundle was generated with
another version of the sources. In this case it is maybe even better not
to invalidate the cache since it could lead to an invalidation war
between two workers.

The only case where invalidating this cache is useful is when a bundle
changes, Usually if an ir_asset is created, modified, ...

There is still another rare but possible possibility to have a 404 if
the transaction is rollbacked after populating the assets node cache.
In this case, we only need to clear the cache locally in case of
rollback.

Part-of: odoo/odoo#121376
2023-06-10 11:14:11 +02:00
Habib (ayh) e6973df266 [IMP] web: allow markup in dialogs
The confirmation dialog component uses `t-esc` thereby preventing the use of markup for the body prop.
With this commit, we use t-out instead and thereby allowing markup.
The same applies for the AlertDialog

[IMP] web: enhance extensibility of form/list confirmation dialog when deleting records

To extend the functionality of the delete confirmation in the form and list controllers, a lot of code has to be copied.
This commit separates the props into a getter, making it easier to be extended.

closes odoo/odoo#124553

X-original-commit: 6179d1d7928407a3199db48f0489ce645084d5aa
Related: odoo/enterprise#42310
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-06-10 09:50:04 +02:00
Hubert Van de Walle (huvw) f06c2ae2a6 [FIX] web: duplicate t-key for translated colors
Steps to reproduce
==================

- Switch odoo to french
- Go to projects
- Click on the three dots

-> Got duplicate key in t-foreach: Violet

Cause of the issue
==================

Since [0], the colors have been renamed.
In french, both Purple and Violet translates to Violet
Color is a LazyTranslatedString and its string representation is the
translation.

Solution
========

Use the index for the t-key

[0]: https://github.com/odoo/odoo/commit/ef313061301948693bfbeb16e8ccca786e5251f4#diff-df052c03baba52d267dcf7714eb1a1d03f1eddf85f096ff1c8d016f12f71a6b5L40-L53

opw-3358597

closes odoo/odoo#124545

X-original-commit: 323dfc4e32278b52b883a78b8a91c230ac31220b
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-06-10 08:16:40 +02:00
Preksha Chouhan 918f096ecd [FIX] sale: prevent traceback when value of tax_totals is None
When user change the move_type of account_move to 'entry'. And when user try to
access 'partner_credit' field from the form view using debug mode.
The error will be generated.

Steps to Produce:-

1. Install 'account_accountant' and 'sales' module
2. Change move_type of account_move to 'entry'
3. Go to 'Edit View : Form' of Journal Entries in account_accountant using
debug mode
4. Add field 'partner_credit' to the form or tree view and click on save
5. Click on any Journal Entry

Trace-back will be generated.

Applying these changes will resolve this issue.

Sentry-4222621594

closes odoo/odoo#124515

X-original-commit: 94c1f20aaeb89cc07bb21cab2e19da67fd10f603
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Preksha Chouhan (prec) <prec@odoo.com>
2023-06-09 18:30:37 +02:00
Thibault Delavallée be398b428a [FIX] auth_*, sale: improve 'from' of templates by adding company fallback
Emails on Sale Order, Invoice, Recovery cart. When no sales on sale.order
use "COMPANY" <email of company> as fallback before the current user.
Reason is that odoobot is often used in automatized actions and having
it as email_from is not really user friendly.

Also add company fallback in auth modules email templates (if not already
using it) for the same reason.

Task-3346388

closes odoo/odoo#124472

X-original-commit: 597fc004148bf39e8f56e36e840aa6788872f237
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-06-09 18:30:31 +02:00
mehjabin 900e642af0 [FIX] purchase_stock: remove duplicate field
before this commit, the field incoterm_id is defined
twice in purchase.order model, i.e., in purchase and
purchase_stock modules

after this commit incoterm_id field is removed
from purchase_stock module

closes odoo/odoo#123602

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-06-09 18:30:25 +02:00
Zelong Lin 4c107fd8c2 [FIX] mail: systray styling
closes odoo/odoo#124467

X-original-commit: 41e839cdc2017549091ffa9ded787e131678e032
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-09 17:01:54 +02:00
Sébastien Theys 2e386d966a [FIX] mail: move channel url to discuss folder + fix cache key
Avatar didn't sync when changed due to miss reading the cache key.

Part of task-3265211

closes odoo/odoo#124466

X-original-commit: 58fea4c78e11176bac609f89476fec8cd9fdb5df
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-06-09 17:01:51 +02:00
Antoine Guenet b6288efe65 [REF] web_editor: replace all classList toggles true with classList adds
In several places, `convert_inline` uses `classList.toggle('c', true)`
to set classes. This is not a good practice, as it's not clear what the
state of the class is. It's better to use `classList.add('c')` since
this anyway checks whether the class is already present or not.

closes odoo/odoo#124465

X-original-commit: 43afc5a5a30530bc3ede9f0a46249977a7896b5a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2023-06-09 17:01:44 +02:00
Antoine Guenet 22246567be [FIX] web_editor: fix .img-fluid for Outlook
Outlook needs explicit dimensions for images, which .img-fluid - by
design - doesn't provide. This puts them in mso conditionals with said
dimensions for Outlook.

X-original-commit: d0949de8ce895b7da5fd128fb5d72d23d5634866
Part-of: odoo/odoo#124465
2023-06-09 17:01:44 +02:00
Antoine Guenet ee8442d3c0 [FIX] mass_mailing_themes: fix newsletter template's main image's width
Before this commit, the main image of the newsletter template had a set
width which doesn't do anything because it gets overridden by CSS, but
it confuses the conversion process.

X-original-commit: c23fe6dc5efe46990a5473f696966a2774ae16d4
Part-of: odoo/odoo#124465
2023-06-09 17:01:43 +02:00
Antoine Guenet c33ecdf27c [FIX] web_editor: prevent undefined class/style
The `_wrap` util function of `convert_inline` was not checking if
`className` and `style` were defined before adding them to the wrapper
element, leading to things like `<div class="undefined">element</div>`.

X-original-commit: 9fd6e069d07c3f7964511af7289d95c970d11b3e
Part-of: odoo/odoo#124465
2023-06-09 17:01:43 +02:00
Antoine Guenet 6b2a18be8a [FIX] mass_mailing: ensure mails don't get distorted with DPI scaling
This ensure the layouts of emails don't get distorted in Outlook when
the user is using DPI scaling (typically, some elements get scaled up
while others don't).

X-original-commit: 2348efb6e22544d82ce53d542975f334d5553f62
Part-of: odoo/odoo#124465
2023-06-09 17:01:42 +02:00