Commit Graph
170604 Commits
Author SHA1 Message Date
Nguyễn Đại Dương aac2f49acf [FIX] http_routing: can't redirect the user to friendly access error
-Step to reproduce: create a custom module and try to extend method in
website_slides controller like this:
@http.route(sitemap=sitemap_slide_view)
def slide_view(self, slide, **kwargs):
    return super(WebsiteSlidesSeo, self).slide_view(slide, **kwargs)

From there, 'rule.endpoint.original_routing' will take the value from
the extend method not the original one therefore user will one again go
to the the forbidden error page which is'n friendly. We shouldn't access
original_routing because that's the "function's specific @http.route"

closes odoo/odoo#160864

-solution: we only need rule.endpoint.routing because it is the one holding the "merged @http.route accross inherited controllers".
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2024-04-11 09:50:45 +00:00
Petr Vojta b2ae038ceb [FIX] account_edi_ubl_cii: fixing import of a payment reference from Factur-X
When importing an invoice from a Factur-X format a payment reference is now read from correct field. From the same field where the original payment reference is exported.

closes odoo/odoo#157811

Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-11 09:50:43 +00:00
Hesham 3b3b90b6d6 [IMP] l10n_de: Added steuernummer validation at field adding
Steuernummer was being validated at tax report xml generation. The check was moved to the company form view.
Moreover, the field was set visible in the company form view for multivat.

It should be a constraint raising when trying to set the steuernummer to the company; there is no point in only checking it at XML generation.

task-3809218

closes odoo/odoo#161423

X-original-commit: c8543f716164d9e1f7e5b39908ff9805c9cc53bd
Related: odoo/enterprise#60496
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Hesham Saleh (hsal) <hsal@odoo.com>
2024-04-11 08:13:00 +00:00
lase@odoo.com 61231577a2 [FIX] account: assign a vehicle to a posted journal entry
steps to reproduce:

- Go to Accounting > Accounting > Actions > Lock Dates
- Set a Tax Return Lock Date to a date of the previous month
- Create and confirm vendor Bill with a taxed line of positive price
- Go to Accounting > Reporting > Audit Reports > Journal Report
- Hover over the Vendor Bills and click on "journal items"
- Add the optional vehicle field to the recods
- Select your expense line and try to add a vehicle

> Invalid Operation "You cannot modify the taxes related to a posted
  journal item..."

Cause of the issue:

Modifying the "vehicle_id" of the account move line will trigger a call
of the `_sync_dynamic_line` method in order to modify other account move
line linked to the same account move:
https://github.com/odoo/odoo/blob/6a4808802c67f98696338d0b6f6a07934c8003fb/addons/account/models/account_move.py#L2285-L2287
During the call of this write method, the account move line that we
did not directly modified will not be excluded:
https://github.com/odoo/odoo/blob/6a4808802c67f98696338d0b6f6a07934c8003fb/addons/account/models/account_move_line.py#L1571
as `..._field_will_change(line, vals,"vehicule_id")` will be `True`.
The error will therefore be raised two lines later because a 'tax_id' is
present in vals as a 'tax_id' was set on our related account move line.

Expected behaviour:

Since the 'tax_id' present in vals is the same as the one already set on
our account move line, we are not modifying the taxes related to a
posted journal item and we should not raise the error.

opw-3810718

closes odoo/odoo#161387

X-original-commit: 3cd87c61c852eef96195a39a4011a6baa39e3078
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
2024-04-11 08:12:58 +00:00
Rémi Rahir (rar) 3fa4d2d3ad [FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits:

https://github.com/odoo/o-spreadsheet/commit/62947587b [REL] 17.0.18
https://github.com/odoo/o-spreadsheet/commit/0d8547c82 [FIX] misc: faster `deepEquals`
https://github.com/odoo/o-spreadsheet/commit/b934dcafc [FIX] xlsx: Shortcut `deepEquals` for primitive types in `pushElement` Task: 3733743
https://github.com/odoo/o-spreadsheet/commit/0b2be2266 [FIX]xlsx: replace json.stringify with deepEquals Task: 3733743
https://github.com/odoo/o-spreadsheet/commit/0e0f31a38 [FIX] xlsx: remove useless normalization Task: 3733743
https://github.com/odoo/o-spreadsheet/commit/a87b0d0b5 [FIX] XLSX: simplify `pushElement` helper Task: 3733743
https://github.com/odoo/o-spreadsheet/commit/9f6996086 [FIX] Evaluation: ignore invalid ranges in dependency graph
https://github.com/odoo/o-spreadsheet/commit/c678905b3 [FIX] Grid: Context menu position was broken
https://github.com/odoo/o-spreadsheet/commit/fe8161032 [FIX]: Filters: Do not export 1-row filters to xlsx files Task: 3839556

closes odoo/odoo#161367

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2024-04-11 08:12:57 +00:00
Emilio Pascual 7d7e2a1cf4 [IMP] delivery: disable only delivery carriers from external providers
Only delivery carriers that can communicate with the outside should be deactivated.
Every time a database is neutralized, all delivery carriers are deactivated. In staging or test databases this should not be the case, only delivery carriers with an external connection, i.e. delivery carriers with an external provider should be deactivated.
Delivery carriers with fixed price or based on rules should not be deactivated with every neutralization. This way Odoo can continue to operate with shipping methods without prejudice to the users in neutralized databases.

@moduon MT-5612

closes odoo/odoo#161182

X-original-commit: bdaeae0230fe0da7743f8cc4ed9dcb210b994540
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2024-04-11 08:12:56 +00:00
kdeb@odoo.com 3117ba3d4a [FIX] hr_holidays: reset allocation to 0 on date change
Issue:
    - when creating an accrual plan based on attendance,
    the duration is not computed accurately when allocating.
    - the computation is not correct if you select a different
    start date in the allocation without emptying the field "Allocation"

Steps To Reproduce:
    - In the time-off app create an accrual plan:  where employee
     accrue 1h for every hour worked based on attendance.
    - In the attendance app create a new attendance for 8 hours.
    - add a new allocation to Mitchell Admin with the plan you created.
    - Change the date on the validity period, new allocation is 8h.
    - change the date again and notice the Allocation not computed correctly.

Solution:
    - In `_onchange_date_from` when simulating how many days an
    accrual plan would give from a certian `date_from` we don't reset
    `number_of_days` to 0. reseting it to 0 fixes the issue.

opw-3793961

closes odoo/odoo#160696

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-11 08:12:53 +00:00
Maximiliano Mezzavilla 827ed3c91a [ADD] l10n_uy: Uruguayan accounting demo
We add the following demo data:
-Invoices, credit and debit notes, both from customer and supplier
-Examples of rates
-Data from Uruguayan partners
We also adjust demo data of the company.

closes odoo/odoo#145112

Ref: ADHOC 34810
Ref: LATAM 1132
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2024-04-11 08:12:51 +00:00
Chrysanthe (chgo) 72785de2d4 [FIX] account: fix searchpanel width issue
This commit fixes an issue about the search panel content being cut in
some accounting interfaces. This is due to the fact that the searchpanel
with a specific class would get an arbitrary width value in px.

To avoid this issue, we set a `w-auto` to the searchpanel, allowing it
to adapt its width to its content.

task-3560617

closes odoo/odoo#161382

X-original-commit: f90339c0c6fc27bab7e21d2e78bec043f6327146
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: Chrysanthe Gomrée (chgo) <chgo@odoo.com>
2024-04-11 06:34:43 +00:00
Xavier-Do 308326816f [IMP] base: fix test_tz to work with if target is missing
The test test_tz_legacy will fail if the taget does not exist on the
operating system. This is breaking in some versions of the tz-data
package. Don't make this test fail if the target is missing.

closes odoo/odoo#161341

X-original-commit: 276eb0192fdddb736453857c18bf9f0cccecb4a3
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-11 06:34:43 +00:00
Paul Stroobant bff38ae366 [FIX] hr_timesheet: remove display_name compute dependencies
Steps to reproduce issue:

1. In settings, activate Timesheets
2. Go to _Project > Tasks > All Tasks_
3. Create a new task
4. Give the task a title
5. Choose an Assignee
6. The title disappeared

Explanation:

The title field, `display_name`, is a computed field that gets its value from `name`. This compute has dependencies coming from other computed values. Those dependencies lead to other dependencies up to `project_id`. Because of it, changing `project_id` will trigger `_compute_display_name`.

Suggested fix:

Backporting odoo/odoo@8178ad79bb, the cause of the issue is the same.

opw-3823040

closes odoo/odoo#161276

X-original-commit: 89b1ff812ecd4186f2196341d72fe7e6380404dd
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Signed-off-by: Stroobant Paul (stpa) <stpa@odoo.com>
2024-04-11 05:21:48 +00:00
imanie383 2d79430e18 [FW][FIX] website_sale: toggle T&C display from customize tab
Before this commit, users could not disable the Terms and Conditions display on the product page from the Customize tab of the web editor. To remove it from the product page, the only workaround was to remove the text in that div.

Now, a button will be available in the Customize tab of the web editor to quickly show or hide the Terms and Conditions.

closes odoo/odoo#161354

Forward-port-of: odoo/odoo#161230
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2024-04-11 00:15:44 +00:00
Denis Ledoux aa67ae7879 [FIX] tools: safe_eval._UNSAFE_ATTRIBUTES as a list
`_UNSAFE_ATTRIBUTES` was changed from a `list` to a `set` in odoo/odoo#151989.
odoo/odoo@cde2781591

Reset it to a `list` as before, by retro-compatibility concerns,
in case developers used features not working on `set`.
For instance:
- `_UNSAFE_ATTRIBUTES.append`
- `_UNSAFE_ATTRIBUTES.extend`
- `_UNSAFE_ATTRIBUTES + ['foo']`

The opportunity is taken to add `_co_code_adaptive`,
which is a new attribute added from Python 3.11,
hence available from Ubuntu Noble.
Firstly added as `_co_quickened` in
https://github.com/python/cpython/commit/001eb520b5757294dc455c900d94b7b153de6cdd
Then renamed to `_co_code_adaptive` in
https://github.com/python/cpython/commit/2bde6827ea4f136297b2d882480b981ff26262b6

The opportunity is also taken to move `mro` out of the `Python 2 functions` section,
as `mro` is available in Python 3, hence making the comment confusing.

Part-of: odoo/odoo#151989
2024-04-11 01:06:51 +02:00
Jigar Vaghela 762dce2555 [FIX] l10n_in_edi: separate value of RC from normal GST
Before
======
In E-invoice Value is pass as other values

After
====
No RC value is pass to the E-invoice because not required to pass RC value.

closes odoo/odoo#161125

Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-10 20:56:59 +00:00
Victor Piryns (pivi) c0282c01ae [PERF] analytic: add missing indexes
Description:
Add indexes affecting queries related to `account.analytic.line`.
Based on heuristics like domains in `search`/`read_group` that are
not really selective, or being an inverse of One2many.
Some of these searches are on code-paths that are frequent, like
creation of an SO.
The goal is to reduce the number of Seq.Scan or non-selective Index
Scan.

Reference:
task-3724844

closes odoo/odoo#160472

Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
2024-04-10 19:14:18 +00:00
Lina (liew) 12e5296c1d [FIX] website_sale: revert to div being t
After odoo/odoo#154035 users were unable to upgrade

closes odoo/odoo#161274

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2024-04-10 17:30:53 +00:00
Lucas Perais c1db28a260 [FIX] web: views: x2many form_view_ref when field already present and invisible
Have a form view that has twice the same x2many field, excpet the first one is invisible=1.
The second occurence has a context with the form_view_ref key.

The x2many should have at least one record.

```xml
<form>
    <field name="x2m" invisible="1" />
    <field name="x2m" context="{'form_view_ref': 'some_ref'}">
        <tree>
            <field name="display_name" />
        </tree>
    </field>
</form>
```

When opening a record, the context was not taken into account, yielding the wrong form view to open that record.

After this commit, the form_view_ref context key is taken into account, and the right form view opens.

opw-3845448

closes odoo/odoo#161253

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-04-10 17:30:52 +00:00
lase@odoo.com 8574e18180 [FIX] hr_recruitment: update the description of interviewer's rigths
Current Behavior:

The description of the "Interviewer" access rights is the following:
"Interviewer right will give access to all job position/applications
where the employee is defined. It will allow to refuse, plan meetings.
**Chatter content will not be available.**"
However, the "interviewer" users have access to the chatter as no
sensible content can be accessed from it.

> The description therefore needs to be updated.

Note:

This access right did not exist before saas-16.4

opw-3783965

closes odoo/odoo#161197

X-original-commit: eb2facc88701ca7deaa02947ee9e6c30687c0588
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-10 17:30:52 +00:00
Antoine Boonen e9cc9204d3 [FIX] account: multiple pdf msg records creation
Configure an email alias for the journal 'Vendor Bills'
Send to the mail alias two pdf bills

Issue: Only 1 record is created with the 2 bills as attachment
The system should split the bills into separate records, but this does
not occur:
- after the first bill is processed the current move extract_state is
  'waiting_extraction'
- when the system check whether to extract data from the second document the
  result is negative as it check the state of the first document

opw-3822262

Co-authored-by Andrea Grazioso <agr@odoo.com>

closes odoo/odoo#160983

Related: odoo/enterprise#60168
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-10 15:14:58 +00:00
Soukéina Bojabza b392d85b62 [FIX] web_editor: fix dragging a column from the bottom in a grid
Since commit [1], we can now drag and drop an image column by dragging
it directly, and not only by the move handle. Commit [2] allowed the
image to be dragged from anywhere and not only from the top middle.
However, since commit [2], it is really difficult to drag a column
downwards in a grid, if the drag started from the bottom move handle or
near the bottom of the column if it contains an image, because we easily
get out of the dropzone.

Indeed, since the positioning of the column now takes into account the
mouse position on the column where the drag started, the mouse cursor is
therefore located under the column (or almost under in the second case).
This is why it gets out of the dropzone before a new row could be added.
For the second case, new rows can be added, but only if the drag is slow
enough, which is not convenient.

This commit bounds the vertical position of the mouse when dragging, in
order for it to always be considered inside the column, so it cannot
escape the dropzone anymore. A safety margin of one grid row is
considered, to not escape when dragging rapidly.

Steps to reproduce:
- Drop enough snippets to have a scrollbar or select the "Sidebar"
  header template.
- Drop a "Text-Image" snippet
  - at the top of the page if the header was changed at the previous
    step, or
  - at a place where the top of the snippet can be hidden with a scroll.
- Toggle it to grid mode.
- Start dragging any column with the bottom move handle or drag the
image column by clicking near the bottom of the column.
- Go over the grid dropzone if the move handle is used.
- Drag towards the bottom of the grid.
=> The mouse easily gets out of the dropzone, making it impossible to
add new rows and drag further down the grid.

[1]: https://github.com/odoo/odoo/commit/cff6f79b5f38239be8a498ff03549ad9a5deebae
[2]: https://github.com/odoo/odoo/commit/514d3dbad4d20db375cba634b6af68a4fb0cafe9

task-3601336

closes odoo/odoo#144427

Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2024-04-10 15:14:57 +00:00
Soukéina Bojabza 3a0a52ee99 [FIX] web_editor: make the drag towards the bottom in grid mode smoother
Since commit [1], we can now drag and drop an image column by dragging
it directly, and not only by the move handle. Commit [2] allowed the
image to be dragged from anywhere and not only from the top middle.

In grid mode, in order for the column to stay well inside the grid when
dragging, its computed position was originally bound horizontally, to
the left and the right of the row. With commit [2], it is now also bound
vertically, to the top and the bottom of the row.

While it makes sense for the top, because we need to take into account
from where we dragged the image, it should not have been the case for
the bottom, as we need to overflow in order to add new rows. This
resulted in the drag towards the bottom becoming jumpy, because it locks
on the bottom of the grid until a new row is added, when the mouse
pointer is down enough.

This commit removes this bottom bound, in order for the drag towards the
bottom to be smooth again.

Steps to reproduce:
- Drop the "Text-Image" snippet and toggle the grid mode.
- Drag a column towards the bottom in order to add new rows.
=> It is not smooth: it locks on the bottom of the grid.

[1]: https://github.com/odoo/odoo/commit/cff6f79b5f38239be8a498ff03549ad9a5deebae
[2]: https://github.com/odoo/odoo/commit/514d3dbad4d20db375cba634b6af68a4fb0cafe9

task-3601336

Part-of: odoo/odoo#144427
2024-04-10 15:14:57 +00:00
tsm-odoo fdce0f0d41 [FIX] im_livechat: chat bot redirection on pages without chat bot
Before this PR, the chatbot script would hang when redirected to a
page where the chatbot is not enabled.

When such a scenario occurs, we should restore the chatbot's state to
where it stopped, and the script should continue.

This PR fixes this issue.

task-3625853

closes odoo/odoo#161121

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2024-04-10 11:45:56 +00:00
tsm-odoo ce59946eab [FIX] web_tour: observe shadow roots when resuming tour
Prior to this commit, the tour service would fail to observe changes
in the tour's shadow DOM after the tour was resumed.

A mutation observer waits for the shadow host to appear in the DOM,
then registers it with the macro engine observer in order for the
macro engine to take shadow DOM modifications into account.

This commit ensures that the same logic is applied when resuming a
tour.

Part-of: odoo/odoo#161121
2024-04-10 11:45:56 +00:00
Benjamin Vray fb7246f3dd [FIX] web_editor: fix infinite loop on empty oe-structure click
Steps to reproduce the bug:

- Install e-commerce.
- Open a product page in edit mode.
- Click on the "product.description_ecommerce" field.
- Bug: an infinite loop starts. The "selectionchange" event is triggered
in an endless loop, causing various issues such as the page freezing
after a while.

This issue was introduced by this commit [1].

Since this other commit [2], when a selection itself is the main
container of the editable area, we replace this selection to only
include the content of it. With commit [1], this has been modified to
take into account "oe_structure" and "[contenteditable]" elements. As
these elements can be empty, clicking on them would reselect them,
creating an endless loop since we'd never leave the condition that
replaces the selection.

[1]: https://github.com/odoo/odoo/commit/e93fa23c29421ffe8917d9650330585d6dad210f
[2]: https://github.com/odoo/odoo/commit/10c5a16cd44b8d8e54082df90166f2309dfa788d

task-3830033

closes odoo/odoo#160535

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2024-04-10 11:45:55 +00:00
Nicolas Viseur (vin) 7b4624b078 [ADD] l10n_my_ubl_pint: Malaysian Peppol PINT specialization
Add support for the Malaysian Peppol PINT specialization,
allowing to generate the related XML file.

This also adds a few additional features that are in the
specifications:

- SST registration number, needed in the xml and on the
invoice.
- TTx registration number, needed on the invoice.

Both numbers are optional, but if the business is registered
in any of them they are required to display these on the
invoices and they are required to enforce some rules. (cannot
send taxes that are not 0% "Out of scope" if not registered with
SST, ..)

Task id # 3647922

closes odoo/odoo#159407

Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com>
2024-04-10 11:45:53 +00:00
Florent de Labarre 7f947871f0 [FIX] base: logger show cron done even if it is not done.
The logger show "Job done" before the flush. But if during the flush an
error appear (sql constraint, validation error during computed field,
...), the log contain "Job done", but is not True.

The time to compute the cron is not good because it doesn't contain the
flush time.

closes odoo/odoo#161204

X-original-commit: 0cde9c7238ece225ebd50c50f4a78d16ac6b5226
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2024-04-10 09:44:14 +00:00
Florent de Labarre af096f3ecf [FIX] account: add index
Before this commit the time to unlink an account.move can take lot of time (60s on large database).

closes odoo/odoo#161172

X-original-commit: 73c1fdd192577bba56dcad213d8a22de8b5de06f
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2024-04-10 09:44:13 +00:00
ArminandJulien Castiaux a26d3b245d [FIX] core: add support for windows-874 encoding
Outlook and similar Windows based systems use windows-874 for encoding
Thai characters which is not natively known by Python.
Simply aliasing the Windows encoding as cp874 adds support for this
encoding.

opw-3684161

closes odoo/odoo#161117

X-original-commit: 65d4c2507e762dc273a02a2e2215c49a5976568d
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2024-04-10 09:44:11 +00:00
Aurelien van Delft (avd) abd8736150 [PERF] mrp: add missing indexes
Add missing indexes on stock.move and mrp.workorder
to speed up search_read on mrp.production. That's mostly
useful at the opening of the Shop Floor app.

closes odoo/odoo#160349

Related: odoo/enterprise#59998
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-10 09:44:09 +00:00
Atul Patel ac8c7febd3 [FIX] account: fixed tax name unique constraint error
due to the absence of IR model data entries for certain
account taxes, but with identical tax names, tax types,
and scopes, attempts to create standard taxes with the
same names alongside IR model data result in a constraint
violation, specifically, "tax name must be unique." To address
this constraint, we append "old" to the tax name for existing
taxes lacking IR model data entries.

see:
https://github.com/odoo/odoo/blob/740fb9ac8c8e121820feeac0e1f25a304e47da9d/addons/account/models/account_tax.py#L202

```
 File "/home/odoo/src/odoo/17.0/odoo/models.py", line 4864, in _create
    records._validate_fields(name for data in data_list for name in data['stored'])
  File "/home/odoo/src/odoo/17.0/odoo/models.py", line 1456, in _validate_fields
    check(self)
  File "/home/odoo/src/odoo/17.0/addons/account/models/account_tax.py", line 201, in _constrains_name
    raise ValidationError(
odoo.exceptions.ValidationError: Tax names must be unique!
```

closes odoo/odoo#161146

X-original-commit: 87e13a0f29ace57f1fd591d7180a64bb085a3bca
Signed-off-by: William André (wan) <wan@odoo.com>
2024-04-10 08:17:54 +00:00
Louis (loco) 9f2a920f2f [FIX] website_blog: display the total number of filtered elements
Steps to reproduce:
- Add the same tag to 13 different blog posts.
- On the "Blog" page, click on this tag to filter the blogs.

-> Problem: the result displays "12 Articles" but they are actually 13.

In this case, the result displays "12 Articles" as they are 12 articles
on the current page. When going on the second page of the results,
"1 Article" is displayed. This problem is solved by displaying the total
number of articles found after the filtering operation rather than the
number of articles on the page.

opw-3802729

closes odoo/odoo#161137

X-original-commit: 4e90dc9096cbcf9f2fe7f251b247c8d62bc0bc5d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2024-04-10 08:17:54 +00:00
Djamel Touati 4ff88bc7be [FIX] sale_crm: avoid displaying archived records in quotation
Before this commit, when the user created a new quotation from
Contact->Opportunity-> ("New Quotation" or "Quotations/orders widget
button", archived records could be added to the quotation
(e.g. ,product, taxes...) because the context was set to
active_test = false. After this commit, the context is configured back
to active_test = true when creating a quotation from opportunity.

opw-3802796

closes odoo/odoo#161087

X-original-commit: 3085c3b24bef719c3cf63ec9d3b5a7d7b2a34037
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-10 08:17:53 +00:00
reka-odoo 736ad5956a [FIX] web_editor: prevent typeerror at write of qweb fields
When user tries to empty start date or end date in website using editor,
a traceback will appear.

Steps to reproduce the error:
- Install "website_event"
- Go to Website > Events > Open any Event > Register > Edit
- Now try to empty start date or end date > Save

Error: A traceback appears:
"TypeError:'<' not supported between instances of 'bool' and
'datetime.datetime'"

https://github.com/odoo/odoo/blob/4759c6d1ee09c32381dc56c59c95949fd0e2807c/addons/event/models/event_event.py#L507
Here, When user tries to empty start date or end date,
start date or end date will become "False",
So it will lead to the above traceback.

solution:
A try-catch is used to catch typeerror at write of qweb fields.

sentry-5038057541

closes odoo/odoo#161083

X-original-commit: c893ff16e277b46796a943c5532e01e8edf8958f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Renilkumar Kajavadra (reka) <reka@odoo.com>
2024-04-10 08:17:52 +00:00
nda 0f0b471c4c [FIX] pos_sale: open sale.report form view
7bbec42 removes the 'pos_done' state without providing a substitute.
A discrepancy arises between the states defined in pos.order and sale.report.

While pos.order can have a 'done' state, this state is not defined in
sale.report. Consequently, it is possible to encounter a situation where a
state exists in 'sale.report' without being defined in its state field.
This inconsistency leads to an error in the web client when attempting to
display the state 'done' from 'pos.order', as the system cannot locate a
corresponding label for it.

Since we can't add a new state in stable, we'll re-use the sale.order 'sale'
state which is the sale.order counterpart of pos.order 'done'.
steps to reproduce:
- go to sales / reporting / sales and go to pivot view
- remove all filters
- on the pivot view, select 'product category'
- click on a cell corresponding to POS (ex: all/saleable/pos)
- click on a line in the list view

before this commit:

Caused by: TypeError: Cannot read properties of undefined (reading '1')
    at get string (https://60795873-17-0-all.runbot129.odoo.com/web/assets/af70128/web.assets_web.min.js:8393:281)
    at SelectionField.template (eval at compile (https://60795873-17-0-all.runbot129.odoo.com/web/assets/af70128/web.assets_web.min.js:1500:374), <anonymous>:15:21)
    at Fiber._render (https://60795873-17-0-all.runbot129.odoo.com/web/assets/af70128/web.assets_web.min.js:940:96)
    at Fiber.render (https://60795873-17-0-all.runbot129.odoo.com/web/assets/af70128/web.assets_web.min.js:939:6)
    at ComponentNode.initiateRender (https://60795873-17-0-all.runbot129.odoo.com/web/assets/af70128/web.assets_web.min.js:1007:47)

after this commit:

the form view is rendered

opw-3816652

closes odoo/odoo#161065

X-original-commit: 483c49ba1fd2ef3a6986f77fbc622d19c93cc55c
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
2024-04-10 08:17:51 +00:00
damr 2cfb25c033 [FIX] hr_timesheet: make portal view readonly for ts
Currently, there is an access right problem concerning timesheet. The
module mrp gives write access to portal user on analytic line, but it is not
something we want for the project app.

step to reproduce:
- install hr_timesheet on a saas-16.3 db
- go to project app, open office design
- select any task, and add a subtask to it
- go the the view form of the subtask
- create a new timesheet for this subtask
- go back to the view form of the parent task
a button 'subtask timesheet' is now visible
- share the project in edit mode with a portal user
- connect with that portal user
- open the office design project
- go to the view form of the parent task and click on the button
- the user is redirected to a view tree with the timesheet of the
subtask
this view tree is editable

Source of the problem:
in the mrp module, the access rights of the analytic line is overwritten
to give write access to it to portal user.
Soluce:
We have to make the view in readonly mode for timesheet when the
connected user is a portal one. Unfortunately, it is not 100% possible
because setting the field to readonly still gives the user the
opportunity to click on those fields (which triggers access errors). So
we have to create new views and specifically open those views when the
user is a portal one.

affected version: saas-16.3 - master
task - 3751315

closes odoo/odoo#160959

X-original-commit: 7b733f118f60ff98d9f82c69453187d70e6bece0
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-10 08:17:49 +00:00
Bastien (bvdn) 079cc8b10a [FIX] product,purchase,sale_* : add product type to catalog product props
The sale_stock module patches the ProductCatalogKanbanRecord updateQuantity method
to prevent the quantity to go under the delivered quantity of the product

The issue is that we are also using the ProductCatalogKanbanRecord in the industry_fsm_stock module
in which the services product added to the sale order are considered by default but we would like to be
able to dimish their quantity in the catalog (in case of a missclick for exemple)

Since the service product can't be considered delivered in sale modules, the condition in updateQuantity
shouldn't change anything

Task-3689939

closes odoo/odoo#155157

Related: odoo/enterprise#55455
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-04-10 08:17:47 +00:00
Achraf b4d70e34f2 [FIX] web: Make datetime options help text clearer
Steps:

Install web_studio
Change language to French
Open any form view and enable Studio
Add a datetime field and click on it
In french we have the following message:
"Première date acceptée": Date formatée ISO ou "aujourd'hui" He says that we can use the string "aujourd'hui"
when we only expect "today" in English.

This commit changes the help text to display "today" in every language

opw-3829954

closes odoo/odoo#160904

Forward-port-of: #160144
Forward-port-of: #159654
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
2024-04-10 06:46:43 +00:00
kcv-odoo 821ee43327 [FIX] web: fix binary field in settings form
Steps:
- Install sales app.
- Go to settings of sales.
- See header field there is no download button.

Issue:
- Binary field should have download button and
user should be able to download file with out
issue.

Cause:
- Since Settings is abstact model so it does not
contains id field in it and download button visibility
depends on id field.

Fix:
- Extend binary field for setting view to get proper
file from related field where actual file is stored.

task-3620555

closes odoo/odoo#160070

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2024-04-10 06:46:42 +00:00
Joren Van Onder bea603f865 [FIX] l10n_br_sales: show price_total on lines
This module was introduced in saas-16.4. In that version the sale
order report and portal template displayed both price_subtotal and
price_total for each sale order
line. 655d375af8 removed price_total.

Because this module removes price_subtotal we end up with no line
total at all on the default Brazilian quotation PDF and portal
view (just 3 columns: description, quantity and unit price).

Loosely inspired by l10n_cl [1], this commit changes our approach to
turn the two places where we use price_subtotal into price_total. The
aforementioned commit also changed the heading of this column from
"Subtotal" to a more generic "Amount", so there's no inconsistency
there. Although this is a bit of a mess, I can't think of a better
solution.

[1] https://github.com/odoo/odoo/blob/655d375af83dd49bbbd5f5818e319c3b0e9778c1/addons/l10n_cl/views/report_invoice.xml#L173-L175

closes odoo/odoo#159794

Related: odoo/enterprise#59703
Signed-off-by: Josse Colpaert <jco@odoo.com>
2024-04-09 23:14:46 +00:00
Christophe Monniez 66d2e285d6 [FIX] *: fix missed E0601
Fix various "Using variable xxx before assignment". It was not detected
by pylint <= 2.5.0 which was the version enforced on runbot.

closes odoo/odoo#160886

closes odoo/odoo#161166

X-original-commit: 328a0ce2fa619376672c591d8b4f8892aaa2da1a
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-04-09 19:35:41 +00:00
Serge Bayet (seba) de33556926 [FIX] website: fix metadata open graph site name
This commit fixes the 'og:site_name' metadata, which previously
defaulted to the company name (see [1]), causing issues for multi-site
setups. Now, the metadata actually uses the site name.

Steps to reproduce:

- Navigate to any page
- Right-click and select "View Page Source"
- In the <head> section, observe the meta property "og:site_name" set to
  "MyCompany".

[1]: https://github.com/odoo/odoo/commit/156955de6b4e6288ac606d29b843081842154eff

opw-3791082

closes odoo/odoo#161123

X-original-commit: 24ea3ca4b12f8dd4103a650436a144e776b81d83
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-04-09 19:35:40 +00:00
Rahil Ghanchi 1dbfd086f8 [FIX] mass_mailing, website: fix the weird spaces in rating snippet
To reproduce the issue:

-Drag and drop the rating snippet.
-Change the score from options.
-Notice that spaces between icons disappear.

In the release notes[1] of jQuery 3.5.0, it's stated that security
fixes related to the HTML parser were implemented. Consequently,
self-closing e.g. `<i/>` tags inside function arguments were replaced
with e.g. `<i></i>`. As a result, trailing spaces lost significance,
causing icons to stick together.

Before the commit:

Prior to Odoo 16.2, jQuery 3.3.1 was utilized, which allowed the use
of self-closing tags in the append function. This behavior was as
expected.However, starting from Odoo 16.2, jQuery version 3.6.3 was
adopted.

After the commit:

Instead of using self-closing `<i/>` tags, `<i></i> ` with a trailing
space was used. This trailing space gained significance due to the
prefilter no longer ignoring it. Consequently, icons no longer stick
together after changing the score.

task-3576760

[1] https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/

closes odoo/odoo#161076

X-original-commit: b897e836697a288bbd58a8efc340d9f7b2e76e30
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-04-09 19:35:40 +00:00
Ahmed Mohamed 565a5b1d4a [FIX] hr_holidays: hide confirm button during create
This ensures that the user will not click on the confirm button before the record is saved which will prevent unnecessary UserError if the Timeof type requires no validation

closes odoo/odoo#160839

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-04-09 16:43:46 +00:00
zel-odoo ec0ba10cea [FIX] mail: read from db when send notif in write
When writing in a discuss channel, the updated value sent to the client
should be read from the database, not directly from the values passed to
the write method.

Partially backport of https://github.com/odoo/odoo/pull/139563

closes odoo/odoo#158860

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-04-09 16:43:45 +00:00
qsm-odoo ce3b096de7 [FIX] website: make 'edit_menus' tour work without website_sale
The tour mentioned the "Shop" menu item since [1]. This is obviously
a mistake: the tour should work when only the website app is installed.

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

runbot-60696

closes odoo/odoo#161073

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-04-09 15:06:52 +00:00
aktr-odoo 7a7d6d0353 [FIX] phone_validation: update phone number parsing for mauritius
When the user adds a valid Mauritius phone number, it is not correctly parsed by
the phonenumbers library, resulting in a user error while sending a WhatsApp
message to that number.

Steps to produce:

- Create a new contact with the Mauritius country selected.
- Add a phone number (e.g., '+23057654321').
- Try to send WhatsApp messages using this phone number.
- This will throw an Invalid number error.

Problem:

`phonenumbers==8.12.1` python library is used in odoo for parsing phone numbers.
The `8.12.1` version is too old and cannot parse Mauritius phone numbers
correctly.

Solution:

The `8.12.13` version accurately parses Mauritius phone numbers. Currently, The
latest version of the phonenumbers library is `8.13.31`. Hence, the latest code
from the latest version of the phonenumbers library is monkey-patched into the
system.

Task - 3799632

closes odoo/odoo#161039

X-original-commit: c3743b5fcfb5d67c442e5eee9f084b684e4baac3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-09 15:06:51 +00:00
Logan Staelens (lost) f7688eb47e [FIX] hr_expense: Unmatched journal entries date with expenses
Before when we create an expense report paid by company with multiple expenses of different dates then we posted the expense report. The journal entries had all the same date.

Now journal entries will match the date of the expense when it is an expense paid by company.

closes odoo/odoo#160990

X-original-commit: 77d53dd3d62016f97c19645b42c772204babdd45
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Logan Staelens (lost) <lost@odoo.com>
2024-04-09 15:06:50 +00:00
Demesmaeker dc9f3680c5 [FIX] sale_pdf_quote_builder: ensure only pdf inside quote
When creating a product document, it was still possible to save
something that wasn't a pdf. The check only happened when modifying it.

opw-3802795

closes odoo/odoo#160879

Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
2024-04-09 15:06:49 +00:00
Thomas Lefebvre (thle) 47030fd605 [FIX] hr_holidays: ensure consistency with cap accrued time
Steps to reproduce:
-------------------
- create a time off accrual plan with:
    - cap accrued time equals to `True`
    - maximum leave equals to `0 days`
- create an allocation with this accrual plan
- run the scheduled action "Accrual Time Off: Updates the number of time off"
    (make sure you have the right "lastcall" and "nextcall")

Issue:
------
The number of days of the allocation is set to zero.
This scenario makes no sense from a business point of view.
In effect, we are blocking the accumulation of allocations at zero.
The result is that there will never be any days allocated to these allocations.

Solution:
---------
Add a constraint to force a maximum leave number
when cap accrued time is set.

opw-3847408

closes odoo/odoo#160626

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2024-04-09 15:06:48 +00:00
Laurent Smet bc0e9b3804 [IMP] account: Payment register wizard - writeoff to exchange diff
When a register payment is made with a writeoff in foreign currency
and when the user set manually an exchange difference account,
don't create a write-off. Instead, 2 cases to consider:
- When the payment is expressed in a foreign currency different than
the invoice's one, play with the rate between amount_currency and
balance and let odoo making an exchange difference accordingly.
That way, the payment has no write-off and the invoice is fully paid.
- When the payment is expressed in company currency but the invoice
has a foreign currency, force the exchange difference to use a rate
that will fully paid the invoice without creating any write-off line
on the payment.

task_id: 3717436

closes odoo/odoo#157398

Related: odoo/enterprise#58511
Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
2024-04-09 15:06:45 +00:00