Commit Graph
170331 Commits
Author SHA1 Message Date
Pierre Paridans 9c31da401d [FIX] web: handle MouseEvent triggered from TEXT_NODE in Firefox
This commit "fixes" a weird behavior in Firefox where a MouseEvent
("mouseenter" in this case) can be triggered from the target's
TEXT_NODE, even if it shouldn't...

Note: even though this isn't clearly defined in the spec, MouseEvent
shouldn't be dispatched for TEXT_NODE, as implemented in Blink or
WebKit... But not everyone agrees (cf. tickets linked below).

Steps to reproduce:
- open website
- go into edit mode
- actually edit the page
- add a snippet to the page
- click on the "Discard" button and move very fast out of it
=> the error `el.matches is not a function` is "sometimes" raised (if
you got the right timing)

References:
- https://w3c.github.io/uievents/#event-type-mouseenter
- https://bugzilla.mozilla.org/show_bug.cgi?id=185889
- https://bugzilla.mozilla.org/show_bug.cgi?id=42717
- https://bugzilla.mozilla.org/show_bug.cgi?id=103055

closes odoo/odoo#158810

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-03-27 10:59:17 +00:00
amdi-odoo 65cd911a5a [FIX] web: fix properties mobile display
Fix the property mobile display:

- Set the popup in fullscreen.
- The draggable feature is disabled.
- Replacing the move up/move down property arrows in the popup by a
back arrow so that the fullscreen popup can be closed.
- Removing the min-width on the property popover to prevent the popup
from going out of the screen.
- Edit button is now always visible as hovering on it is not possible on mobile.

Task-3635554

closes odoo/odoo#156886

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2024-03-27 10:59:16 +00:00
Gauthier Wala (gawa) a5017cd7cd [FIX] l10n_es_edi_sii: certificate for aeat isn't valid anymore
Our certificate for aeat seems to not be valid anymore.
We don't have a replacement currently.
The flow is still tested with bizkaia or gipuzkoa (mostly just
different servers/addresses, but same flow/xml), where the
certificate is still accepted.

We remove this test that fail every day.

Linked to Runbot error 25907

closes odoo/odoo#159382

X-original-commit: ccd5ce7f0f106f68ce704cb032bcb754a480be14
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2024-03-27 09:12:49 +00:00
Pedram (pebr) eca2ec1328 [FIX] point_of_sale: prevent unbalanced error for invoicing cash orders
Before this commit, attempting to invoice an order paid by cash in a
new session, with cash rounding enabled only for cash payments in the
PoS config, would result in an unbalanced entries error.

opw-3813932

closes odoo/odoo#158907

X-original-commit: 3a61e143af62f1edeec299a39ab133138ec0560c
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2024-03-27 09:12:48 +00:00
Andrzej(pian) 99d360b055 [FIX] website_slides: Stop sending completion mail on all slides removal
Construct deciding on whetheres an attendee should receive 'complete'
mail, contains a condition which checks if the attendee has:
number_completed_slides >= number of all slides
This however falls into a corner case when there is no slides at all and
computation gets triggered (which got introduced with commit [1] ).

[This Commit Change]
This commit introduces an additional check on the total number of slides in
a channel. Consequently, records without any slides in the related channel
will no longer send completion mail notification.

[Reproduce]
- Install website_slides
- Create a new eLearning course with some content but do not publish it.
- Add attendees.
- Delete all the content.
- BUG: emails about finishing the course got sent (Settings/Technical/Emails)

[Why this commit modifies existing test]
The test introduced with commit [2] checks if a specific template is used
in email generation, requiring email generation to occur as a prerequisite.
Originally (before [This Commit Change]), it relied on the default behavior
that considered an attendee a completer even without any published slides,
thus triggering an email. However, after this commit, with a course containing
zero published slides, completion cannot occur, and thus, no emails are sent.

For this reason slight alteration of the test setup is required allowing
for the emails to get sent and in effect the test to perform its role.

[References]
[1] https://github.com/odoo/odoo/commit/3efa80847c4631febefc770b79bb786953a05b36
[2] https://github.com/odoo/odoo/commit/9a0231d5c3fa25f4ec63303cfc7eb8e2bc8ff9e1

opw-3703987

closes odoo/odoo#153178

Signed-off-by: Andrzej Pietrusiak (pian) <pian@odoo.com>
2024-03-27 09:12:47 +00:00
Dylan Kiss (dyki) 790ecdbda7 [FIX] l10n_ee: tax report computes according to updated taxes
In the beginning of 2024, the default tax of 20% in Estonia was changed
by 22% (with the 20% still supported as a legacy) [1]. With that change,
the tax report was also updated so the line previously containing the
taxable amount at 20% now contains the taxable amount at 22%.

However, the formula computing the tax amount itself was not updated to
reflect this change and was still computing the tax by multiplying the
taxable amount by 0.2.

This fix corrects the tax computation in the report.

[1] ec25405367eaeca6bdd1f54e2a09fe6b93b8a4b6

opw-3815147

closes odoo/odoo#159339

X-original-commit: 6ea02a52b2cedce70572df78ddb7142acb784886
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2024-03-26 22:20:21 +00:00
Aungkokolin1997 60a1035244 [IMP] stock_account: refactoring for checking restrict_partner_id
Refactored the restrict_partner_id check in the stock_account module to make it more flexible for future updates.
Now, it's easier to extend restrict_partner_id check without override the whole method.
Related with https://github.com/odoo/odoo/pull/155694

closes odoo/odoo#158687

X-original-commit: 8a4c6e51a200c4b093571d4f2003b39de07fe4b1
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
2024-03-26 17:22:12 +00:00
Hubert Van De Walle 80e0f3463f [FIX] account: remove newId from display_name for invoices
Steps to reproduce
==================

- Create a new Invoice

=> The tab title is `Odoo - Draft Invoice (* NewId_0x7f545c9d6980)`

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

In 17, the display_name is computed for the tab title

https://github.com/odoo/odoo/blob/82fd8e702588d2cc5bdad474ed21188257cc7397/addons/web/static/src/views/form/form_controller.js#L342

opw-3794671

closes odoo/odoo#159301

Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-03-26 15:40:34 +00:00
Julien Castiaux bfc62bc3ef [FIX] base: cron indeterministic test
Upon calling `invalidate_recordset` the current recordset present is
flushed. That recordset can be active=True which override active=False
set `_process_job()`. Flushing the recordset *before* calling
`_process_job` makes sure that there is no dangling data to be flushed.

closes odoo/odoo#159262

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-26 15:40:32 +00:00
roen-odoo e114934423 [FIX] point_of_sale: fix receipt qrcode size on iOS
Current behavior:
When printing a receipt with a QR code on an iOS device, the QR code was
too small and couldn't be scanned

Steps to reproduce:
- Setup an ePos printer for the PoS
- Activate QRCode on receipt option
- Start a PoS session on an iOS device
- Add some product to the order and validate it
- On the receipt screen click on the print button
- Try to scan the QR Code on the ticket (it's probably too small)

Note:
If you don't have an iOS device you can use browserstack and use ngrok
to expose your local server to the internet and connect to it on
browserstack. You can do the same process to expose the printer so that
you will be able to print from browserstack.

opw-3788988

closes odoo/odoo#159185

X-original-commit: 7fff77b5b60e15f20622ce0a9c6dbe28e25e2660
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2024-03-26 13:35:57 +00:00
Achraf bb2e76ee12 [FIX] mail: Allow users to edit log notes in mobile
Example of steps:
	- Open any record with a chatter
	- Log a note
	- Edit it
	- Try to save

Actually it is impossible to save it, because we can not
perform a CTRL+ENTER in mobile and there is no button

This commit adds a button to save editing, using `fa-paper-plane`
icon similarly to send button.

opw-3784145

closes odoo/odoo#159092

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-03-26 13:35:55 +00:00
maad-odoo a4d6ed6332 [FIX] web_editor: delete behaviour on heading elements
Before this commit:

1. When an empty heading from H4 to H6 is the only element in the editable
   area, the backspace key doesn't turn it into paragraphs.
2. When the cursor is at the start of a heading element with text content, and the
   user hits the backspace key, the element gets converted into a paragraph.

After this commit:

All heading elements are removed on backspace if they're empty.

task-3456815

closes odoo/odoo#158970

X-original-commit: 6a52ac3d76a23f47bcebcc43603e2963ea52521e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2024-03-26 13:35:54 +00:00
Ethan Vincent 02322b3124 [FIX] l10n_dz: make 0% immo tax names unique
**Current behavior:**
Trying to select the Algerian fiscal localization for a company
after installing the respective module is impossible.

**Expected behavior:**
The localization package should be installable after the module
has been installed.

**Steps to reproduce:**
1. Install `l10n_dz` and create a new company without any fiscal
     localization

2. In the fresh company, select `Algeria` as the fiscal
     localization package, observe the error

**Cause of the issue:**
Two tax names in the module's tax data file have the same values
for a field that should be unique.

**Fix:**
Change the values in the identical fields.

opw-3787096

closes odoo/odoo#158877

X-original-commit: 122d9e8827ef26f72ff967b164ec550d349a6ee4
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Vincent Ethan <etvi@odoo.com>
2024-03-26 13:35:53 +00:00
Mahdi Cheikh Rouhou (macr) 4e8d7e8edf [FIX] purchase_mrp: fixing test test_valuation_with_backorder
this commit https://github.com/odoo/odoo/pull/158788/commits/07e2fca9e39e9c32182f10bae6ba814a4241b6bf
uses `qty_done` instead of `quantity` in test
`test_valuation_with_backorder`

closes odoo/odoo#159248

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-03-26 11:40:20 +00:00
Jorge Pinna Puissant 08081fc742 [FIX] web: buttons with special attr close, close x2many dialogs
Before this commit, if a button had the attribute special="close" on the
footer of an x2many dialog, the dialog was not closed.

This occurs because the view button hook searches the dialog close
functions put in the environment by the dialog component, and in this
case is another component that initialize the hook, and the function is
not found.

Now, the view button hook will use the dialog close function put in the
environment by the dialog service.

closes odoo/odoo#159121

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-03-26 11:40:18 +00:00
Tanguy Quéguineur e5802da6c2 [FIX] sale: correct norwegian translation error
Issue
-----
The sale confirmation mail template is not rendered because a part of code is translated.

Note: there's currently no Norwegian translation on Transifex for versions after 16.3

opw-3809578

closes odoo/odoo#159082

X-original-commit: f4a0c70f3fc42fff94c8d259a828f1a1b37e0b1b
Signed-off-by: Tanguy Quéguineur (taqu) <taqu@odoo.com>
2024-03-26 11:40:17 +00:00
Andrea Grazioso (agr-odoo) f72968561a [FIX] sale_loyalty: cheapest product discountable
Create a Loyalty program:
- Program Type: Loyalty Cards
- Rules: 0.01 per $ spent
- Reward: 1.00 per point on cheapest product
Make a SO with total 339
Loyalty Card will get 3.39 points
Make a SO with line having
- Unit Price 140
- Tax 15%
- Total will be 161
Hit Promotions

Issue:
The system will add a discount line with unit price 5.0.
With 15% taxes applied the total discount will be 5.75
While it should be 5
Order 1, Total with tax 339 => 3.39 loyalty points
Order 2, Total with tax 161 => 1.41 loyalty points from current order
                             + 3.39 from past order
                             = 5.00 total loyalty points
When applying the discount on Order 2 the system converts 5 points to 5$,
but considering 15% tax included, the price unit of the discount line
should be 4.35

opw-3642795

closes odoo/odoo#159227

X-original-commit: 5888145b6cc27ccf0c963cf00971d386f0433a11
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
2024-03-26 09:54:32 +00:00
Victor Feyens 458ccf74eb [FIX] delivery: revert method signature change
36e6728b2cac87c7cd922001be0222688ad52abb fixed an issue
where the volume and weight were incorrectly computed
for carriers based on rules.

But it was done by changing the method api, which
seems to break some custom modules using/extending
the modified methods.

This commit reverts the API change, conveying the
needed information through the context for now
(the api change will be done in master only).

opw-3826165

closes odoo/odoo#159220

X-original-commit: d6e004b23822e98e8d1052b75b66a7d4f6d2c38c
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2024-03-26 09:54:31 +00:00
Denis Ledoux 236a03f3e7 [FIX] sale_project: action_view_task performance
Since revision 81b5ef93a773b94a4e3770632469c692b0ff57fa,
adding by default the filter `sale_order_id`
which does:
```py
<field name="sale_order_id" string="Sale Order"
    filter_domain="['|', ('sale_order_id', 'ilike', self), ('sale_line_id', 'ilike', self)]"
/>
```

becomes useless, because the final domain, with that `[('id', 'in', self.tasks_ids.ids)]` becomes:
```py
[
	"&",
	"&",
	"&",
	[
		"project_id",
		"!=",
		false
	],
	[
		"display_in_project",
		"=",
		true
	],
	[
		"id",
		"in",
		[
			3341211,
			3526685,
			3692221
		]
	],
	"|",
	[
		"sale_order_id",
		"ilike",
		"SO2023/123456"
	],
	[
		"sale_line_id",
		"ilike",
		"SO2023/123456"
	]
]
```

which makes an "AND" connection between the task ids domain leaf and the
sale order name ilike leaves, and all these task ids will come from
these SO names, making the AND useless.

In addition to be useless, it downgrades the performance.
On Odoo.com,
- with the filter `sale_order_id`: 15473 ms
- without the filter `sale_order_id`: 39ms

opw-3752003

closes odoo/odoo#159205

X-original-commit: 1a9302dc3a9b0d9323612c10e0f3a91300bb89fd
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2024-03-26 09:54:30 +00:00
Brieuc-brd 3bf4fa0ac6 [MOV] web: allow oi icons to flip in RTL frontend
Prior to this commit, `oi` icons were not adapted when RTL was defined
in frontend.
This is because RTL adaptations were defined in the backend bundle.

This commit moves the RTL adaptations to be used wherever `oi` icons can
be defined.

Steps to reproduce :
- Enter in edit mode
- Drag and drop an image gallery and a carousel snippet
- Navigate to the theme tab
- Add an RTL language (Arabic, for instance)

Bugs :
- The image gallery displays inverted chevrons
- The carousel's chevrons are correct, but clicking on "previous"
  displays the next picture, and vice versa.

Also, some icons a bit everywhere in the apps were not rotated either.
For instance, the back button a forum post to go back to the forum.

Note that task-3714335 will replace FA icons by BS icons, and will
triple check Odoo icons at the same time, to ensure all Odoo icons are
available in the frontend and correctly imported. For instance,
`oi-spin` and `oi-pulse` could make sense in the frontend too.

opw-3747848
task-3794966

closes odoo/odoo#159150

X-original-commit: fc105130551cf9897c7a0a78baf4458e6d5e6fd8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-03-26 09:54:29 +00:00
Ethan Vincent 71eea06e7c [FIX] website_hr_recruitment: get location job app
**Current behavior:**
In the jobs/ directory on the website, if a position has a
location set in its configuration, the 'Location' label will
display the name of the company rather than the city where it is
located.

**Expected behavior:**
The city will be displayed under the 'Location' label.

**Steps to reproduce:**
1. In the Recruitment app, give a job a location value

2. On the website, go to the jobs/ directory and navigate to the
     position from step 1

3. Click 'Apply Now!' and look at the location label on the
     right side of the page

**Cause of the issue:**
This field was missing the "contact" widget type in its
t-options.

**Fix:**
Add the widget type and additionally display "Remote" for the
location when there is no location set.

opw-3761348

closes odoo/odoo#159149

X-original-commit: fdb07fa0e67cacbcaee9ef99bbb3b315cd6baaf5
Signed-off-by: Vincent Ethan <etvi@odoo.com>
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-03-26 09:54:27 +00:00
Antoine (anso) e7d0b3b828 [FIX] base_import: fix background color in dark mode
This commit adapts `base_import`'s background that was too dark
compared to other modules. This was caused by the use of a `bg-white`
class that is not very "dark-mode friendly" as it will display as a
pure black, which is not visually appealing and not wanted.

This commit also adapts the background color of the sidebar to make it
more consistent with other modules.

We also add a `bg-view` class to the table, so it stands out more in
light mode and stays the same in dark mode.

task-3814508

closes odoo/odoo#158822

X-original-commit: 57131926a3d2a20d2deb64a4a4f30b31cb6251e4
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-03-26 09:54:25 +00:00
Thomas Lefebvre (thle) 6c4bd3c186 [FIX] hr_holidays: apply timezone on request date
Steps to reproduce:
-------------------
- be in a UTC+08:00 (or more) timezone
- go to Time Off dashboard
- click on a day (to request a leave)

Issue:
------
Default request dates are on 2 days instead of 1.

Cause:
------
Default request dates are determined during an onchange.
The datetimes (`default_date_from/to`) are set in the context in UTC
calculated in relation to the client's timezone.
Consequently, these datetimes can be set over several days.
In the backend, we will use these datetimes and take only the day
(because the `request_date_from/to` fields are of type date).

Solution:
---------
Put the values back into the client's timezone before they are truncated.

opw-3789265

closes odoo/odoo#158042

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-03-26 09:54:23 +00:00
Claire Bretton (clbr) f4b56dc0e9 [FIX] account_{edi_ubl_cii,peppol},l10n_{es,it}_edi_{facturae},snailmail_account: fix Send & Print only
Clean the implementation + missing peppol, ubl and snailmail.

closes odoo/odoo#157977

Related: odoo/enterprise#58819
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2024-03-26 09:54:22 +00:00
Lina (liew) d5f704a67c [FIX] portal: add loading on sign button
Show a loading spinner and disable sign button on orders
to indicate that the request is processing avoiding users
clicking multiple times and getting an error,
that the order does not require signing

opw-3709064

closes odoo/odoo#157836

Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2024-03-26 09:54:20 +00:00
Brieuc-brd e9163303d4 [FIX] web: adjust hatched events for planning
Prior to this commit, the "hatched" event style in Planning wasn't
displayed in Day and Week views.
This commit adjusts the css selector to fix this issue.

task-3617329
Part of task-3575827

closes odoo/odoo#154964

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-03-26 09:54:19 +00:00
Brieuc-brd 2b967b59ee [MOV] web, calendar: move common scss into web
Prior to this commit, some of the main styles related to event elements
in calendars were set in the Calendar module.
This created layout issues when we installed independent modules without
installing the Calendar module (eg. `planning` or `hr_payroll`).

To fix that, this commit moves the necessary styles into `web`.

task-3617329
Part of task-3575827

Part-of: odoo/odoo#154964
2024-03-26 09:54:19 +00:00
Xavier Morel 7f5f296396 [REM] base: broken method Partner._email_send
The underlying `odoo.tools.email_send` was removed in
82de620424 (merged in 14.5) but this
callsite was missed, this method has been broken ever since.

I really want to remove this method directly, but technically it's an
expensive no-op if called on a recordset of partners without emails
set (or an empty recordset), so instead make it trigger a warning &
remove in master.

closes odoo/odoo#159177

X-original-commit: 457a4be9d6bb1e15b996a5a14468f9b0d88e0b0f
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2024-03-26 08:20:25 +00:00
std-odoo d90ed9d359 [FIX] website_slides: user can not access his own attachment in the PortalComposer
Bug
===
1. login as demo user
2. add a review on a course and upload an attachment
3. click on the attachment link
=> You get a 404 error

For some reason, we do not return the access token if the user is
internal. The generation is not a heavy process, and might be needed
depending on the <ir.rule>.

Task-3693072

closes odoo/odoo#159126

X-original-commit: 74b0f88c6b15feb8d3453edf20acda81b37df66c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2024-03-26 08:20:23 +00:00
Gauthier Wala (gawa) 48e4737534 [FIX] analytic,account: groups are not defined in right module
The fields in analytic have a group which is defined in account.
We hide them in analytic module and show them in account with the right group.
We also show balance now, even if you don't have the group 'readonly',
because it's an information that is independent of credit/debit notion.

Linked to runbot error 59222 (will need to remove the group in the test)

closes odoo/odoo#159085

X-original-commit: e7e3ec8cb5e4f71ce1dbbd24485c3377c694e5eb
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2024-03-26 08:20:22 +00:00
sbel-odoo 03d7e0eb18 [FIX] sale_expense: compute expense policy for expense products
Currently, an analytic account is created when confirming a quotation for a product created as follow:
1. Enable `Can be Expensed`
2. Select `At cost` for Re-invoice expenses
3. Disable `Can be expensed`

Steps to reproduce:
-------------------
* Install **sale_management** and **hr_expense**
* Go to **Settings**
* Under `Customer Invoices`, enable `Intrastat` -> Save
* Under `Analytics`, enable `Analytic Accounting`
* Go to **Sales**
* Create 3 products
  * Product 1: Default
  * Product 2:
    * Enable `Can be Expensed`
    * Select `At cost` for Re-invoice expenses
  * Product 3:
    * Enable `Can be Expensed`
    * Select `At cost` for Re-invoice expenses
    * Disable `Can be expensed`
* For each product, repeat:
  * Create a quotation, select a customer
  * Add the product
  * Confirm
  * Select tab `Other Info`
  * Check the analytic account

**Observations:**
* Product 1: No analytic account created
* Product 2: Analytic account created
* Product 3: Analytic account created

Why the fix:
------------

The creation of the analytic account depends on the value of `expense_policy`. When the value is `no`, no analytic account is created. Whereas when the value is `cost`, an analytic account is created.

https://github.com/odoo/odoo/blob/57ad9c05014ca0219d7892c1ff8a2e949fab3c49/addons/sale/models/sale_order.py#L853-L856

In this workflow, `expense_policy` is visible only when `Can be expensed` is enabled. If you select an `expense_policy` then disable `Can be expensed`, the value for the `expense_policy` stays as previously selected.

https://github.com/odoo/odoo/blob/3e320ffe0ff4d1c6bb7d0314f36dd13ad1cf23f4/addons/sale_expense/models/product_template.py#L33-L41

opw-3706305

closes odoo/odoo#159084

X-original-commit: 4b8e0559248d75ef27f47903041e5cca2059fa80
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Sarah Bellefroid (sbel) <sbel@odoo.com>
2024-03-26 08:20:21 +00:00
dhba a42ca8f3ba [FIX] web_editor: issue with copy paste
Before this commit:

When attempting to copy a button that is a direct child of a div tag, the div
was unintentionally copied along with the button, leading to additional space
upon pasting, along with the background color.

After this commit:

Now, only the button will be copied and pasted

task-3764652

closes odoo/odoo#158975

X-original-commit: b27b9ca18da9b1c39906f8a374418105c2e9c487
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2024-03-26 08:20:20 +00:00
Anh Thao Pham (pta) 8dd03a3059 [FIX] account: fix PO line matching on XML bill
Steps to reproduce:
- Install Accounting and Purchase
- Install a localization that supports electronic invoice (e.g. l10n_it_edi)
- Switch to a company with that localization
- Go to Purchase and create a PO:
  * Vendor: Vendor X
  * Product: Product X
  * Unit Price: 50.00
- Create an electronic bill in XML format with:
  * a reference to PO name
  * the same partner than the PO
  * the same line than the PO, except for the price (e.g. 200.00)
- Go to "Accounting / Vendors / Bills"
- Upload the XML bill

Issue:
The bill is generated and linked to the PO, but the price and subtotal on
the bill line is the one coming from the PO instead of the one coming from
the XML.
Values coming from an imported XML should not be overridden by values found
in matching PO.

Cause:
"timeout" parameter is wrongly passed as "prefer_purchase_line" parameter in
a call to "_find_and_set_purchase_orders" method.

opw-3707731

closes odoo/odoo#159139

X-original-commit: fc6b71c649c17c7534cdc9b9853d75b58076a823
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
2024-03-26 07:02:59 +00:00
shq_lenovo d3b8f05e1e [FIX] core: --dev=reload with watchdog==4.0.0
If you're on Linux, make sure `inotify` is uninstalled:

	pip uninstall inotify

Install `watchdog` to its latest release, 4.0.0, and start odoo in
dev-reload mode. This mode restart the application everytime a file is
modified in one of the addons.

	pip install watchdog==4.0.0 -U
	odoo-bin ... --dev=reload  # replace ... with your arguments

Modify a file, save it. The server doesn't reload while it should.

Before gorakhargosh/watchdog@41fca1eb, only the `FileSystemMovedEvent`
class had a `dest_path` attribute (actually a property). In our code, we
used a `getattr` approach to fallback on `src_path` (which is set on all
three event classes) in case `dest_path` was not set.

Since that commit, the attribute has been moved to the base abstract
class `FileSystemEvent` which all three `FileCreatedEvent`,
`FileModifiedEvent`, and `FileMovedEvent` inherit. Hence the attribute
is always set (sometime to an empty string) and the getattr must be
adapted.

The new code supports both watchdog==3.0.0 and watchdog==4.0.0.

closes odoo/odoo#159102

X-original-commit: 9dd441858fa26d1fb6f13c7cd59076e8898aceb3
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-03-26 00:14:25 +00:00
Alvaro FuentesandChristophe Simonis c18b9f44be [IMP] *: optimize multi-company rule
When we use the `|` (or) version of this rule the ORM generates two
sub-queries when checking the company. This causes sub-optimal and in
some cases really bad planning for the queries and thus PG takes hours
to complete them.

Example (formatted):
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE ("mrp_bom"."company_id" in (1))
                   )
              )
           OR ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE "mrp_bom"."company_id" IS NULL
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```

If we use the single term version the generated query has only one
sub-query:
```sql
    SELECT "mrp_routing_workcenter".id
      FROM "mrp_routing_workcenter"
 LEFT JOIN "mrp_bom" AS "mrp_routing_workcenter__bom_id"
        ON "mrp_routing_workcenter"."bom_id" = "mrp_routing_workcenter__bom_id"."id"
     WHERE "mrp_routing_workcenter"."workcenter_id" in (1)
       AND (  ("mrp_routing_workcenter"."bom_id" in (
                    SELECT "mrp_bom".id
                      FROM "mrp_bom"
                     WHERE (("mrp_bom"."company_id" in (1))
                        OR  ("mrp_bom"."company_id" IS NULL))
                   )
              )
           )
  ORDER BY "mrp_routing_workcenter__bom_id"."sequence",
           "mrp_routing_workcenter__bom_id"."id",
           "mrp_routing_workcenter"."sequence",
           "mrp_routing_workcenter"."id"
```
In this version PG is able to produce a better query plan resulting in
better execution times.

Also, the `company_id` field is required on some models, so the "= False" comparison is useless.

closes odoo/odoo#159123

X-original-commit: 1b5c41f36801fb886ec591f29dba42787d698526
Related: odoo/enterprise#59378
Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
Co-authored-by: Christophe Simonis <chs@odoo.com>
2024-03-25 17:50:06 +00:00
Pedram (pebr) adc04e2bb2 [FIX] point_of_sale: prevent rounding modification with an open session
Prior to this commit, the rounding setting could be modified while
a session was open. This could potentially cause accounting
discrepancies and lead to unbalanced account moves.

opw-3677480

closes odoo/odoo#158625

X-original-commit: 021302a270028373ab519ea1d5409ffb73ee8424
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2024-03-25 17:50:05 +00:00
Pedram (pebr) 8865312f7c [FIX] pos_loyalty: Accurate computation of free product with tag
Prior to this commit, if a "Buy X get Y" promotion was in place, with
a free product reward associated with a specific tag, the computation
of the free product reward could be incorrect in the Point of Sale
when combined with products carrying the tag.

opw-3753994

closes odoo/odoo#158618

X-original-commit: 5f3c8017c5cf255e3b3fa53631a243d2f61c9f60
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2024-03-25 17:50:04 +00:00
Antoine Guenet 421f1f693b [FIX] web_editor: apply format in classless unbreakable inline
When applying a format in an unbreakable inline (without a class), the
format was immediately rolled back as we tried to remove split the
unbreakable in order to remove its style.

task-3768157

closes odoo/odoo#159110

X-original-commit: 78e809c18db7bd520ccf706b2504139248fbd0ff
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet (age) <age@odoo.com>
2024-03-25 16:26:59 +00:00
Mahdi Cheikh Rouhou (macr) 7d66b910c4 [FIX] web_editor: resize columns correctly in RTL
Issue:
======
resizing columns doesn't work properly in rtl direction.

Steps to reproduce the issue:
=============================
- Install arabic
- Go to notes
- insert a table
- Try to resize columns

Solution:
=========
We will handle the cases one by one:

Start: We need to update the `marginRight` prop instead of `marginLeft`
and calculate `sizeDelta` correctly which `clientX - (rect.x +
rec.width)`.

Middle: We will handle this the same as ltr direction, since it's the
reverse direction, we swap `previous` with `next` and `next` with
`previous`. Columns are sorted from right to left so we need to swap
columns when we recalculate them from the columns array so `item` will
be the one on the left and `neighbor` the one on the right.

last: We calculate correctly `sizeDelta` which is `rect.x - clientX`

task-3721794

closes odoo/odoo#159087

X-original-commit: 87f8bcd99a4b1049deed7bccbc5b85812ebc4674
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2024-03-25 16:26:58 +00:00
Mahdi Cheikh Rouhou (macr) 711e2a534a [FIX] web_editor: move columns left/right correctly
Issue:
======
The icons does match the direction of the move but it doesn't match the
label in the ltr language.

Steps to reproduce the issue:
=============================
- Install arabic
- Go to notes and insert a table
- write something in a column in the middle
- Click on the top of the column on the 3 points.
- The first item of the dropdown have the label in arabic meaning `Move
  to left` but the direction of the icon and clicking on it will move it
  to the right.

Origin of the issue:
====================
- The icon is being flipped because we are in rtl but in realtity left
  is the same for rtl or ltr direction.
- We need to call `_onTableMoveLeftClick` when we are moving to the
  right in rtl because the left of rtl direction is the visible right.

task-3721794

X-original-commit: 58cdfb8c80ecfb305ecdb84398508bd2fc180fb3
Part-of: odoo/odoo#159087
2024-03-25 16:26:58 +00:00
Andrea Grazioso (agr-odoo) a5a206f8a8 [FIX] stock: lost history after unpack
In Inventory Settings activate packages and storage locations.
Create a storable product [TEST] with tracking by lot
Create a PO for [TEST] with a [QTY] larger than one.
Receive the products (lot [A]) and put them in a package [PKG].
Create and process an internal transfer of the whole package [PKG]
  from the input location to any location.
Unpack [PKG].
Go to Stock > Reporting > Locations
Locate the received product, hit 'History'

Issue: traceability is empty.
This occurs because the 'unpack' operation clean the information
relative to the package from the stock quant.
When accessing the history, the system lookup for move lines having the
same package (none in this case), so nothing is found

opw-3769752

closes odoo/odoo#158949

X-original-commit: 314d44b400717f392bfbb70f66ef9605c1f31041
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
2024-03-25 14:39:18 +00:00
vava-odoo 3a5c85fe19 [FIX] base: ValidationError for required m2o with 'set null' on_delete
Before this commit, when creating a many2one field from an xml, with an
impossible combination "`required=True` - `on_delete='set null'`", the
column was not created in the database without any notice to the user.

This commit adds a constraint checking that any attempt to create a field
with this configuration would raise a ValidationError. This constraint
replaces the previous onchange method.

closes odoo/odoo#158778

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2024-03-25 14:39:17 +00:00
Arthur Detroux (ard) ed10f6a814 [FIX] website_sale, *: only reload once on options changes
*: web_editor, website

Commit [1] introduced new image settings for the product page.
When those settings were introduced, the editor was reloaded after the
RPC to properly reflect when the settings were changed. While this was
done, a data-reload was also added in the XML template of the options.
This was not necessary as the data-reload only works for some methods
which are not used in the image settings. Therefore, the data-reload
did nothing.

However, with commit [2], the settings were moved and combined with
page options. So the image settings automatically inherited the page
options behavior, which is to save and reload the page when a method
with data-reload is called. This caused the editor to ask for a reload
twice.

This could cause the page to reload before the RPC was finished:
- Add a 10 seconds sleep at the start of /shop/config/website controller
- Go to products page
- Enter edit mode
- Change the number of products per row
=> Nothing happens
Indeed, the page is reloaded immediately, before the 10 seconds rpc is
actually done.

This is also needed by the conversion of the SnippetsMenu to OWL:
It seems like the race condition introduces a traceback.

This commit fixes the issue by ignoring any save request from an option
that will reload anyway. It also awaits the RPC to finish before
reloading the page.

[1]: https://github.com/odoo/odoo/commit/54c6d36cfbea31fe60b888bbb903b0c6f22216b3
[2]: https://github.com/odoo/odoo/commit/b274cf2427951761e59eb357fb796b54be375507#diff-754f6c793d6a168d006d2a9da108142b889036031ac1a2e62060c225d060f858

closes odoo/odoo#158468

X-original-commit: 556ae457b02e9c077d09fa9c3f9f1e6c6e26b345
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-03-25 14:39:16 +00:00
Lucas Lefèvre (lul) 67f11ff350 [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/9b128f8c [REL] 17.0.16
https://github.com/odoo/o-spreadsheet/commit/389177f9 [FIX] Composer: weird behavior of autocomplete dropdown
https://github.com/odoo/o-spreadsheet/commit/7e7b0692 [FIX] formula assistant: localize argument separator Task: 3789860
https://github.com/odoo/o-spreadsheet/commit/2f96ca07 [FIX] TopBar: Remove hidden functions from the `insert` menu Task: 3810284
https://github.com/odoo/o-spreadsheet/commit/fa60ddf1 [FIX] Composer: force light mode of the formula assitant Task: 3806513
https://github.com/odoo/o-spreadsheet/commit/69ccee4f [FIX] cf_editor: remove broken css rule Task: 3806513
https://github.com/odoo/o-spreadsheet/commit/dd7584ec [FIX] Spreadsheet: split button style to form/color
https://github.com/odoo/o-spreadsheet/commit/fe4ffe1d [FIX] export: export non-Excel formulas as value
https://github.com/odoo/o-spreadsheet/commit/0be37a0d [FIX] FigureComponent: Undo/Redo broken after pasting figure
https://github.com/odoo/o-spreadsheet/commit/d1e41517 [FIX] evaluation: accept 1x1 result array in sub-formula

closes odoo/odoo#159066

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-03-25 13:08:03 +00:00
Antoine Guenet c1fa1e2391 [FIX] web_editor: prevent InvalidStateError with stressed webrtc
This prevents a traceback* which happens when the webrtc connection is
under signaling stress and a local rollback is triggered when the state
has been set back to stable.

This seems to be caused by browser bugs (both in
[Firefox](<https://bugzilla.mozilla.org/show_bug.cgi?id=1628139>) and in
[Chromium](<https://issues.chromium.org/issues/40132342>) due to an
[error](<https://github.com/w3c/webrtc-pc/issues/2508>) in the webrtc
spec) that occur under stress. To prevent this sort of issue, a solution
was provided in the form of an [implicit
rollback](<https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setRemoteDescription#browser_compatibility>)
on the remote description setter. This solution has recently become
available everywhere (since Safari adopted it in
[2022](<https://caniuse.com/mdn-api_rtcpeerconnection_setremotedescription_implicit_rollback>)
for desktop and iOS).

This allows us to simply rely on the remote description setter to handle
the rollback if needed.

* Traceback: InvalidStateError: Cannot rollback local description in
  stable.

task-3823100

closes odoo/odoo#158861

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2024-03-25 13:08:01 +00:00
Alexandre Kühn 0aae1ae147 [FIX] mail: opening chat with deleted new message should mark as read
Before this commit, when a user of in chat posted a message and
deleted it, all other users kept the chat as unread.

Steps to reproduce:
- Connect as Admin and March Demo
- Send a message to Admin as Demo in DM chat
- Demo deletes this message
- Marc opens the chat
=> the unread counter is 1 and cannot be removed

This happens because when a message is deleted, there's still a
trace of it but the message is empty. However, empty messages could
not be candidate of setting the last message being seing by a member,
thus members were unable to mark the chat as read until someone else
posted a newer message (and did not delete it).

This commit fixes the issue by taking empty messages into account for
setting last message message of member, which allow to mark thread as
read even when newer messages have been deleted.

opw-3764410

closes odoo/odoo#158943

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-03-25 11:43:40 +00:00
roen-odoo 751fe5282c [FIX] stock: fix zpl label for product without barcode
Current behavior:
When printing a ZPL label for a product without barcode, the label was
printed with a barcode containing the "False" value

Steps to reproduce:
- Install the stock module
- Create a product without barcode
- Print a ZPL label for this product
- The label contains a barcode with the "False" value (You can check the
  rendering on labelary.com)

opw-3797462

closes odoo/odoo#158939

X-original-commit: e392027afa245a708a906b484250ed46200e13be
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
2024-03-25 11:43:39 +00:00
Mehdi Outagant (MOU) d956199ddd [FIX] web_editor, website: adapt hover animations to shape availability
Steps to reproduce:

- Go to website in "Edit" mode (on a blog post page).
- Select one of the default images in the blog content.
- Click on the "Animation" option and select "On Hover" > Traceback!

Starting from [1], the "On hover" image animation was implemented to be
able to pick an animation that triggers when hovering an image.

This feature is setting a default "Square" shape (required for the
hover effects to work) on the target. Which means that an error can
always occur if the "On Hover" animation option is available while the
targeted image is not linked to an attachment and can't support image
shapes (which is the case here).

The goal of this commit is to fix this issue by only allowing the
"On Hover" animations when it's possible to apply shapes to the image.

[1]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85

opw-3795599

closes odoo/odoo#158433

Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2024-03-25 11:43:38 +00:00
Guillaume-gdi 88b016fdc4 [FIX] website, test_website: fix cache for navbar active element
Since [this other commit], the style indicating the active nav item
stopped working if the user added record pages to the navbar. This was
due to the cache system not being invalidated when switching from one
record page to another.

This commit fixes the issue by disabling the cache for the navbar if
there is a record page in the menu.

Other potential solutions were considered but ultimately rejected:
1. Using the record as a t-cache key. However, this would mean that if
you have 60,000 visible forum posts, you would end up with 60,000
different caches.
2. Activate the correct element using JavaScript. This would lead to a
duplicate logic in the JavaScript and the Python code, and it would
introduces a slight lag to add the active class on the correct nav item
(due to the time it takes to load and execute the JavaScript).

The chosen solution is the best compromise, as it maintains the cache
for most cases (website menu without records page links in it), nothing
change with this commit. For problematic cases (record pages in the
website menu), this commit disables the cache, which is a reasonable
trade-off.

Steps to reproduce the bug fixed by this commit:
- Edit a website's menu
- Add a link to a product page (e.g., customizable-desk)
- Add a link to another product (e.g., chair-floor-protection)
- Save the menu
- Click on the menu link to go to customizable-desk
=> At this point, the active menu element is correct
- Click on the menu link to go to chair-floor-protection
=> The active menu element does not update

This commit fixes the issue (a update of the website module is needed)
and adds a test to prevent regressions.

Notes:
- To see the issue locally, remove the --dev xml or --dev all arguments.
- The same issue was occurring with other record pages (blog posts, ..).
- We will introduce back the groups on menu and benefit from this new
  method to also disable the menu cache if one of the menu is linked to
  a group. See task-3800830

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

opw-3694651
opw-3750925
opw-3781668

closes odoo/odoo#159006

X-original-commit: 43576cd424b6d0fc7da01142b5e6550e371ad1ff
Related: odoo/enterprise#59321
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2024-03-25 10:00:51 +00:00
Pablo Montenegro 1d57f3b335 [FIX] account: resequence journal with payment sequence set to False
Resequencing entries that come from payment and non payment
raise a UserError, even if the journal has `payment_sequence`
set to False

Steps to reproduce:

1) Go to "Accounting / Configuration / Accounting / Journals" and create a new
   journal with type "Bank" and "Dedicated Payment Sequence" in False.

2) Create a "Bank Statement Line" in the journal created in step "1".

3) Create and confirm a customer payment using the journal created in step "1".

4) Go to "Accounting / Accounting / Journals / Journal Entries".
   Select journal entries created on step "2" and "3" and then click on Action --> Resequence.
   Then a User Error is being show "The sequences of this journal are different for Payments
   and non-Payments but you selected some of both types." it is not correct as the journal
   created on step "1" has the field "Dedicated Payment Sequence" set to "False".

opw-3763500

closes odoo/odoo#159003

X-original-commit: 11d71cf1b244174c12c0094eb2f0f072894aecc6
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
2024-03-25 10:00:50 +00:00