Commit Graph
159023 Commits
Author SHA1 Message Date
Thomas Lefebvre (thle) 75e9b2f383 [FIX] hr_holidays: allow archiving according to the context
Steps to reproduce:
Archive an employee who has allowances in the approved state.

Issue:
The error is triggered and that says we can't archive an allocation.

Solution:
Use the context to avoid triggering the error if the archiving
is part of another archiving process.

Introduced with the commit 1839bf83a14a12eb83a8f721f82ece7238319e43

opw-3211372

closes odoo/odoo#114385

X-original-commit: 19cbf1d68052f002bff4f1fd12f9f94d60c17df2
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-03-06 09:14:23 +01:00
John Laterre (jol) 33b40687fb [IMP] account_sepa: allow sepa on non EUR journals
Currently, SCT requires the journal to be in a set of determined currencies.
We want to allow using this payment method for all journals,
whatever their currency.

The only check that should be made is on the currency of the payment.

opw-3159737

closes odoo/odoo#114347

X-original-commit: ad1bcd01c84c71a0a79bf5231d9bbdeea69f87c6
Related: odoo/enterprise#37778
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-03-06 09:14:20 +01:00
Julien Van Roy 0d85631fe7 [FIX] account_edi_ubl_cii: change mapping for Buyer/Order Reference
The BuyerReference (BT-10) should be easily editable by the user, so it is read
from the `commercial_partner_id.ref`.

The OrderReference (BT-13) should also be editable by the user, it is read from
the `move.ref`.

The definition for both tags in the peppol doc defines these tags as:
"An identifier assigned by the Buyer used for internal routing
purposes".

The new tag SalesOrderId (BT-14) is added, and is the sale order's name
linked to the invoice.

opw-3175906

closes odoo/odoo#114379

X-original-commit: 0cb27f4c6a0eda02fdab15b11cbf671166497ecc
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
2023-03-05 20:04:00 +01:00
Ricardo Gomes Rodrigues (rigr) da019b6280 [FIX] account: add account move's name into the fields used by the hash
Currently, it is possible to resequence account moves which are hashed.
This should not be the case. Therefore, we are adding the name of the
move into the list of hashed fields.

However, since we are changing the hashing algorithm by including a new
field in its computation, we must add a versioning system to make sure
we don't break the integrity (data inalterability) report.

In practice, this means that prior to this commit, all hashed moves used
the fields of v1, and moves after this commit will use v2 (which adds
the name into the list of hashed fields). Thus, whenever we generate
the integrity report, we will run the v1 algorithm, and if it a
potential corrupted move is found, we will switch to v2 and check again.
If it also fails, this means the hash is indeed corrupted.

task-id 3102481

closes odoo/odoo#114376

X-original-commit: cb76725b071d89a9f3e81861f19d073138741b58
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
2023-03-05 16:30:57 +01:00
Raphael Collet 6ef3772847 [IMP] *: optimize code with search_fetch() and fetch()
closes odoo/odoo#112126

Related: odoo/enterprise#36782
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-03-05 15:12:57 +01:00
Raphael Collet 8c81074e60 [IMP] base: optimize code with search_fetch() and fetch()
Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Raphael Collet 8659a4e5a3 [FIX] test_mail: hack to make broken test work anyway
The test is based on a record that the user cannot read.  It used to
work by accident, because some side effect leaked data in cache.

Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Raphael Collet 44d336128d [FIX] mail: overrides of _search()
This is about the overrides of _search() on models mail.activity and
mail.message, which both make extra queries to implement their specific
access rights.  We combine both queries made in _search() to retrieve
accessible records.  This simply uses the API of the Query object to
retrieve the data that is necessary to restrict access to messages.

Move security check outside of _message_format() for performance.  The
call to check_access_rule() inside _message_format() was redundant in
many cases and generated more SQL queries than necessary.

Also for performance, accessing fields from records should not actually
check permission.  That's a bit freaky, but this reproduces the former
behavior of mail.message.

And finally, make method check_access_rule() on mail.message check
ir.rules, in order to make it consistent with method _search().

Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Raphael Collet ae31aebf09 [FIX] base: fix and optimize ir.attachment._search()
Make ir.attachment._search() consistent with method check() for access
checks.  Also make it generate less queries by combining the extra query
with the main query of _search().

Part-of: odoo/odoo#112126
2023-03-05 15:12:56 +01:00
Raphael Collet dc15044cc0 [FIX] base: visible menus is a search() feature, not a _search() feature
Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet 4e6f1d7805 [FIX] core: invalidate the cache of forbidden records when raising AccessError
Issue: checking access rules fetches some data in cache.  Sometimes,
accessing a forbidden record does not crash because of the data left in
cache.  This is the case when accessing a field on a record, like in the
field accessor method:

    try:
        records._fetch_field(f)     # (1)
    except AccessError:
        record._fetch_field(f)      # (2)

The field f is included in the data fetched to check access rules in the
prefetch set of record (1).  Therefore, when trying to fetch the same
field in (2), there is nothing to fetch and no access error occurs.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet e962860c6f [IMP] core: introduce search_fetch() and fetch()
This fulfills the goal of searching and fetching fields in a single SQL
query.  We introduce the new method search_fetch() for that purpose.
Also introduce method fetch() to fetch some fields for a recordset if
they are not in cache yet.

The call graph is as follows:

    search()        calls   search_fetch()
    search_read()   calls   search_fetch() and _read_format()
    read()          calls   fetch() and _read_format()

    search_count()  calls   _search()
    search_fetch()  calls   _search() and _fetch_query()
    fetch()         calls   _search() and _fetch_query()

The methods _search() and _fetch_query() are usually the ones to
override to implement business-specific logic.  The method _search()
returns a Query object to retrieve the records that satisfy the given
domain and are accessible for reading.  The method _fetch_query() uses a
Query object to retrieve fields from the database and store them in
cache.

Also use search_fetch() to save one query in search_read() and the
reading of one2many fields.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet 46c23fd64d [IMP] *: _search() always returns a Query
Goal: make _search() always return a Query object, in order to make
search_read() in a single query when possible

Adapt the overrides of _search() towards the given goal.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet c161177cb7 [IMP] core: _name_search() now takes explicit order and limit parameters
This API is much more sensible for making subqueries.  Specifically, one
can generate a subquery without the clauses LIMIT and ORDER BY.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 136eb34f07 [IMP] core: _search() no longer uses a default order
This simplifies the use of subqueries by avoiding some costly default
order on the model or the idiotic order='id'.  Method _flush_search()
has been adapted accordingly.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 7e6cff5479 [IMP] core: search() and _search() no longer have parameter count
The parameter in search() is redundant with method search_count(), and
was making the calls less readable.

The method _search() is aimed at always returning a Query object.  The
method can therefore never return an integer, hence the removal of the
parameter.  This does not actually remove any functionality from the
method; counting result is simply given by using it differently.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Raphael Collet 789c643925 [IMP] core: improve Query for subqueries
The goal is to be able to use Query objects for both subqueries and
known ids tuples.  This provides a single API for injecting either a
subquery or its resulting ids into another query.

Part-of: odoo/odoo#112126
2023-03-05 15:12:53 +01:00
Raphael Collet 537a60ffd1 [IMP] core: quote field "id" in SQL queries
Part-of: odoo/odoo#112126
2023-03-05 15:12:53 +01:00
Raphael Collet 637cdc8ffa [IMP] test_performance: more tests and adapt query counts
Part-of: odoo/odoo#112126
2023-03-05 15:12:53 +01:00
822618fb17 [FIX] sale_project: improve performance for project update
Before this commit, when the user wants to see the project.update of a
project billable to see the project profitability, the project
profitability could take more 20 seconds to be loaded because of a
search on account.move.line to get the others revenues (that is, the
invoices manually created without any SO linked) for which the AA of
those invoices are the one of the project. The problem is the AA of a
account.move.line is stored as key in a JSON field called
`analytic_distribution` and so the fetch of related
`account.move.line` could be slower when there are many records
in the `account_move_line` table.

This commit adds a new index on `account.move.line` to spped up the
search in `analytic_distribution` field. By doing that, the project
update is loaded in less than 2sec instead of 15-20sec.

closes odoo/odoo#114301

X-original-commit: a0b608c3a45ca33bcd535cfb4b1c73b73fa17317
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
Co-authored-by: SEINLET Nicolas <nse@odoo.com>
2023-03-05 14:16:57 +01:00
9650671871 [FIX] project: improve performance to search tasks with milestone set
Before this commit, when the user goes to project update of a project
with many tasks and some tasks are linked to some miletones of that
project the the `_compute_can_be_marked_as_done` could take more than
500ms depending on the tasks and miletones in the project (when the
project update of that project is loaded).

This commit fixes the performance by adding an index on `milestone_id`
field in `project.task` model.

Test case:
---------
The sql query made in that compute method took more than 600ms before
that commit.

With the index, the query takes less than 1ms.

X-original-commit: 47e02120b1aa5607a7fc528853629438cecf3e64
Part-of: odoo/odoo#114301
Co-authored-by: Yannick Tivisse <yti@odoo.com>
Co-authored-by: SEINLET Nicolas <nse@odoo.com>
2023-03-05 14:16:57 +01:00
althaf shaik 3afc97c42e [FIX] account: expected currency value in compute tax total.
Expected singleton res.currency() trace back
that occurs in account/account_move : _compute_tax_total
was caught by sentry.
Because currency is not available when we remove journal_id in account_move.

In res.company currency_id is a required field.
So we are accessing currency value from res.company.

Sentry-3946448424

closes odoo/odoo#113927

X-original-commit: 326ae981b767a9ae3cacd50099dcce354df591d8
Signed-off-by: William André (wan) <wan@odoo.com>
2023-03-05 14:16:54 +01:00
momegahed 1d54dfad33 [FIX] base: Cannot print multiple checks
Steps to reproduce:

1. Settings > Accounting > Vendor Payments > Checks > Enabled with
Print Check (Top) - US
2. Accounting / Vendors / Payments
3. Create at least 2 vendor payments using "Checks" as the payment method
4. In the list view select both payments and click action/print checks
5. Error

Bug:

in `_render_qweb_pdf_prepare_streams`, in the case of multiple
documents on multiple pages, we can only split them if the pdf has an
outline, and it will have an outline only with templates that have a
header tag. For the ones that don't have them like
`l10n_us_check_printing.print_check_top`, it is not possible with the
current logic to unambiguously split them. (maybe we can add a
heuristic like if number of pages = number of documents we can assume
1 document/page)

thus the streams returned by `_render_qweb_pdf_prepare_streams` don't
contain the record ids and
`safe_eval(report_sudo.attachment, {'object': record, 'time': time})`
might fail based on the expression to evaluate.

Fix:
It doesn't make sense to save the attachment if we can't split the
attachments clearly anyway, so we can just continue and skip the saving
 if record is null

OPW-3124089

closes odoo/odoo#113863

X-original-commit: 1fac708bd335dce27eeb77e0a11e12883a83dac6
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
2023-03-05 14:16:51 +01:00
xO-Tx 190b1b1609 [FIX] web_editor: fix icon update on mediaDialog
To reproduce the issue:

- Website (edit mode) > Drop a snippet with icons (e.g. "Steps").
- Open mediaDialog to change an icon.
- Select the same one (or click immediately on "ADD") > This will set an
empty icon (without any "fa" specific class).

The code on `MediaDialog` > `save()` adds CSS classes from the original
icon to the new created one then removes the old 'fa' classes from it.
(see `initialIconClasses`), as a consequence, the class will be deleted
(not replaced) when the selected icon is the same as the old one.

The goal of this commit is to fix this behaviour by simply closing the
dialog if the selected icon remains the same as the old one.

task-3210472

closes odoo/odoo#114345

X-original-commit: 0515e987b985622bc7b913dbbb37c0d0cd69eb4b
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-03-03 23:27:47 +01:00
MerlinGuillaume 9ea183bc39 [FIX] account: use currency to format tax
An error is thrown when trying to edit the tax in a vendor bill

Steps to reproduce:
1. Install Accounting
2. Go to Accounting and create a new Vendor Bill
3. Add product 'Large Cabinet' to the bill
4. Click on the pencil icon next to the tax in the total amount
5. An error is thrown

Solution:
Partially revert the erroneous fix in TaxTotalsComponent by adding the
currency getter. If there is no currency, floatFormat will fallback on a
decimal precision of 2.

Problem:
https://github.com/odoo/odoo/pull/108412 removed `currency` from
TaxTotalsComponent. This value was passed in the props of
TaxGroupComponent so it was undefined.

opw-3212170

closes odoo/odoo#114362

X-original-commit: 59a1d1f825cfbc1f720cccb80de212f6ee6d5404
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-03-03 22:23:51 +01:00
maximilien(malb) d55438187a [FIX] sms: invisible description when empty
Before this change, when the recipient_single_description field was empty (the field is then false), the field box was still displayed before the number. Since the field is not editable there is just a blank space.

This PR hides the field when it is empty to avoid having the empty space.

closes odoo/odoo#114354

X-original-commit: a7425a2d829a7bfe0e25619a3bd5c40d9e112bb0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
2023-03-03 20:10:57 +01:00
Lucas Lefèvre 4217c5b3dd [FIX] spreadsheet: load async formulas without delay
Now the promise waiting for all async no longer relies on a setInterval.
It was a hack that can be better solved by listening to the data sources
event.

closes odoo/odoo#114348

X-original-commit: de1f42f98410bc796dfdbfd237b1e20be4496166
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-03-03 19:10:20 +01:00
Hansun (hale) d47b5c3fa7 [FIX] mrp: broken UI on Group By
1. Install [Manufacturing] on Apps
2. On [Settings]>[Manufacturing]
- toggle on [Work Orders], [Quality] & [Quality Worksheet]
3. Go to Manufacturing
- Work Centers (a.k.a WC) Overview should be visible
- if no W.C. by default, add from [Configuration]>[Work Centers]
- give tag to each W.C. (lengthy so as to test the overlap)
- click Manufacturing and [Group by] Tag (Custom)

affected branch: 16.0-master

opw-3177656

closes odoo/odoo#114303

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-03-03 19:10:18 +01:00
Laurent Smet 955091e707 [IMP] account*: send&print with documents
Refactoring send&print wizard.
==============================

Main reason for this commit is that we want to let the user
decide when to generate the relevant documents / approvals
for its invoices. The natural choice is when the information
leaves Odoo. So now, each time the users decide to
download/send its invoices, he will be able to select the
relevant documents to be generated and the approvals to be
requested from the send&print wizard.

This used to happen automatically during the posting with lots
of undesirable behaviors (difficulty to update/revert, hard to
know exactly what will happen,...)

Main changes:

1/ Send&print wizard

- The model 'account.invoice.send' has been replaced by
'account.move.send' and became models.Model to handle
asynchrounous generation of documents (webservice,..) in
case of more than one invoice.

- The wizard is meant to be overriden in order to add
checkbox and document to be generated. A comprehensive exemple
can be found in account_edi_ubl_cii.

2/ Import invoice from attachments

- The decoding logic has moved from account_edi to account
on the attachemnts.

- The function _extend_with_attachments() serve as a common
entry point for import (from chatter, dashboard).

3/ Export invoice pdf / document

- All the specific actions to export attachments should be
implemented on the account.move and called from the wizard in
 _generate_documents()

- The official pdf for the invoice is now only generated once
 the user request it. In order to regenerate the pdf and
documents, it needs to be deleted.

task-id: 3117238
[enterprise](https://github.com/odoo/enterprise/pull/36757)
[community](https://github.com/odoo/odoo/pull/111857
)

[IMP] web: enable close on ir.actions.act_url in wizard

Before this commit, calling ir.actions.act_url on a modal
leaves the modal open. Which feels ackward in the send&print
wizard.

We now enable 'close' parameter on ir.actions.act_url. If set,
the wizard will close after act_url.

closes odoo/odoo#111857

Related: odoo/enterprise#36757
Related: odoo/upgrade#4387
Signed-off-by: Laurent Smet <las@odoo.com>
2023-03-03 19:10:10 +01:00
Katherine Zaoral 17d7b5199f [ADD] l10n_ar: Liquido Product document management
* Add refunds with liquido docs
* Add Is AFIP POS field (l10n_ar_is_pos)
* Adapt letter mapping
* Add unit test

closes odoo/odoo#111076

Related: odoo/enterprise#36322
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-03-03 19:10:01 +01:00
Benjamin Vray 44e9930557 [FIX] website_editor: fix items width in we-list when dragging them
This commit fixes an issue with the width of items in the we-list not
being correct when they are being dragged using jQuery's sortable
feature.

Steps to reproduce the bug:

- Drop a "Form" snippet on a page.
- Add a "Multiple Checkboxes" field in the form.
- Move an option from the list using the move button.
- Bug: while dragging the item, the width of the items is too small.

When an element is dragged, it is given an absolute position which takes
it out of the normal flow of the document, causing the input element
within the list item to no longer be able to correctly occupy 100% of
the available width.

task-3138662

closes odoo/odoo#114343

X-original-commit: e0a4ed0b21a9f87678e13609ff597cf1b3ae4189
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
2023-03-03 18:11:05 +01:00
clesgow 3ec250e709 [IMP] stock: bypass quantity compute on replenish wizard
Currently, even if a `default_quantity` is given to the replenish
wizard, that quantity will be overwritten by the product's
`virtual_available`, which defeats the point of setting a
`default_quantity`.
This will allow to bypass that computation when a `default_quantity` is
given to the wizard.

Also makes it return a close action with some custom info when `Confirm`
is clicked, so it's possible to know which button was clicked to close
the wizard.

closes odoo/odoo#113394

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-03 18:10:57 +01:00
clesgow 724a00056f [IMP] {sale_}stock,mrp: bypass reads for forecast
Add a way to disable the read() done in the forecast report. While those
are useful to send the right data to the client, they have no use and
even slow down the process when the forecast report lines are generated
for a python-side use.

Part of task-3059467

Part-of: odoo/odoo#113394
2023-03-03 18:10:57 +01:00
clesgow 1ef03b92a0 [IMP] {purchase_,}mrp: Add MO Overview
Adds in a new report that allows the user to monitor the entire
production of a product, including the resupply of the components (i.e.
subassemblies, purchases, ...) in a single view.

Task-3059467

Part-of: odoo/odoo#113394
2023-03-03 18:10:57 +01:00
Yolann Sabaux c823f477aa [FIX] stock_account: prevent reconcile move_lines in draft
Steps to reproduce:
- create two storable products (Great Product - Super Product) - automated avco
- create rfq with the two products - confirm -receive products
- create Bill - set qty of one Great Product to 0 -> save
- create bill for the Great Product - confirm

Issue:
User Error You can only reconcile posted entries

Cause:

`_get_all_related_aml()` fetches all aml related to the `stock_moves` with the product in the bill we want to post.
It retrieves the aml of the bill in which we have put the product quantity to 0 but that it is still in draft.
And we try to reconcile this draft move_line in
https://github.com/odoo/odoo/blob/d0fdc38385f5f259da259d21e9137494e6d7c17d/addons/account/models/account_move_line.py#L2308

Solution:
filter the `product_account_moves(_lines)` so we don't take into account moves that are still in draft

opw-3180209

closes odoo/odoo#114328

X-original-commit: b1a74a1841c05e4e37643e17f6b97dfff11555cd
Signed-off-by: Adrien Widart <awt@odoo.com>
2023-03-03 17:05:43 +01:00
John Laterre (jol) f2c0bc321b [IMP] account: remove default account on misc journal form view
It was added in the context of this commit (https://github.com/odoo/odoo/commit/a3e9ca9586cba9d6161d4c05a7bfff9beeeddea7),
to auto-balance unbalanced moves.

But it's no more necessary and not only users can't select any account;
but further it is pointless.

task-3208909

closes odoo/odoo#114309

X-original-commit: eae96580f6da537d31ec43f018880bc6be82091a
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-03-03 17:05:35 +01:00
Valentin Vallaeys (vava) c5d9f4ee14 [FIX] sale: compute price unit on downpayment line
For the moment, the price unit of the down payment line on the sale
order is not always correctly computed. If the price unit is updated on
the down payment invoice, it is not updated on the sale order; or if a
regular invoice is created, the price unit of the down payment is set to
zero on the sale order.

This commit corrects the behavior by using the unit price of the invoice
line.

opw-3140740
opw-3160406
opw-3160420

closes odoo/odoo#114304

X-original-commit: 755c517fcab89df51e8b0ee4529894372b4d4ec1
Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
2023-03-03 17:05:33 +01:00
abd-msyukyu-odoo 033f14f533 [FIX] web_editor: refresh behaviors after editor reset and external steps
Dispatch events `onExternalHistorySteps` and `historyResetFromSteps` so that
they can be catched by the html_field to trigger a `refresh_behaviors`, in order
to refresh (instanciate) Behavior components.

Task-3208896

closes odoo/odoo#114262

X-original-commit: 9c6ed77988e20855ca67c5f1e03d9d2e274442cf
Related: odoo/enterprise#37745
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-03-03 17:05:26 +01:00
Soukéina Bojabza e64b93a6cb [FIX] website, website_sale: convert form-control-file class to BS5
From BS4 to BS5, the `form-control-file` class has disappeared and
became `form-control`.

This commit replaces the occurrences of the old class by the new one.
It is necessary because by letting the old class, it is impossible to
place a form label above a `File Upload` field.

Indeed, since the `.form-control-file` CSS rule setting the `display`
property to `block` has been removed, the file input now has `display:
inline-block` by default, which is why the label would end up on the
same line as the input, instead of on top. With `.from-control`, this
rule is back, allowing to place the label on top again.

After this commit, the look of the file input will change. This is
because in BS4, with the `form-control-file` class, the input was the
browser native one. It could be customized using `.custom-file` (and
the associated `custom-file-*` classes). But in BS5, the file input is
directly a custom one, thanks to custom styles added on top of `.form-
control`.

task-3071151

closes odoo/odoo#114261

X-original-commit: 7dcfe19c15bd96d65e5fda463ad65d083c6b8fcf
Related: odoo/enterprise#37744
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-03-03 17:05:22 +01:00
Aaron Bohy 0436dacb9d [FIX] web: RelationalModel: only render once when resequencing
Before this commit, in a grouped kanban view, a lot of rerenderings
were done when the user dragged a record from a column to another.
This commit adds an option to Record.update to bypass the rendering
part, and we use this option for calls during the record move and
resequencing, as we know that the view will be rendered at the end
anyway.

Fixes performance issues spotted on odoo.com (Project task grouped
kanban view).

closes odoo/odoo#114225

X-original-commit: 3aa91db099532c09b12f1a4148ae3829a1a9593b
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-03 17:05:17 +01:00
Aaron Bohy 0edd469382 [FIX] web: RelationalModel: memoize evalContext
The evalContext getter is called a lot of times during a rendering
of a view, by several components (the renderer, the fields...).
It is a getter better it can evolve (with reloads, changes...) and
we wanted to ensure that it's always up to date. This causes
performance issues, in particular in grouped kanban views where
we can have a lot of displayed records, and fields.

To mitigate the issue, we introduce a brief cache that is reset
after a micro tick. The rationale is that during a rendering, the
evalContext doesn't change, so we'll compute it once and then
retrieve the same object. After a micro tick, the value is reset,
so it will be recomputed the next time we need it.

Mitigating perf issue on odoo.com (Project tasks grouped kanban
view, when resequencing records).

X-original-commit: 7ec8e3124325da65031c6c7c392c34f56c534cc5
Part-of: odoo/odoo#114225
2023-03-03 17:05:16 +01:00
Elias Regopoulos a78f6e47b4 [FIX] base_iban: Avoid KeyError on IBAN with non-ASCII characters
If the IBAN includes a non-ASCII alphanumeric character and has just the right length, the IBAN validation crashes with a KeyError before validation can take place.

Fictional example: The supposed IBAN code "Bank München-Wiesn GmbH" gets normalized to "BankMünchenWiesnGmbH"; a string that starts with a valid country code ('BA', ie. Bosnia-Herzegovina) and happens to have the same length as Bosnia-Herzegovina's IBAN format (20 characters). Normally this erroneous IBAN would've been rejected as invalid, but Python throws a KeyError when trying to convert 'ü' to an int right before the validation step.

We therefore need to also check if all characters in the IBAN code are within the expected range, namely [a-zA-Z0-9] (strictly speaking, the IBAN's specification range is only [A-Z0-9], but we can be lenient since Python's `int()` is case-insensitive).

closes odoo/odoo#114218

X-original-commit: 99769bad49795ed5eab4c04afc7c37ffd295aa19
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Elias <elre@odoo.com>
2023-03-03 17:05:13 +01:00
yhu-odoo f7a681abff [IMP] mrp_subcontracting{, _dropshipping}: split subcontracting account move
Considering a subcontracting use case where:
 component cost = 50
 service cost = 100

we post:
|account,              |debit,         |credit
-----------------------------------------------
Receipt Component from vendor
|Stock Valuation       |50             |
|Stock Input           |               |50
-----------------------------------------------
Invoice Component from vendor
|Stock Input           |50             |
|Payable               |               |50
-----------------------------------------------
Resupply Component to subcontractor
|Stock Valuation       |               |50
|Stock Output          |50             |
----------------------------------------------
Receive Final from subcontractor
|Stock Valuation       |150            |
|Stock Input           |               |150
----------------------------------------------
Invoice Final from subcontractor
|Stock Input           |100            |
|Payable               |               |100
-----------------------------------------------
Deliver Final to client
|Stock Valuation       |               |150
|Stock Output          |150            |
-----------------------------------------------
Invoice Client
|Stock Output          |               |150
|Receivable            |150            |

Stock Input/Output account are not balanced.
In this commit, we split the credit value when received final from
subcontractor to make them balanced.

|account,              |debit,         |credit
-----------------------------------------------
Receipt Component from vendor
|Stock Valuation       |50             |
|Stock Input           |               |50
-----------------------------------------------
Invoice Component from vendor
|Stock Input           |50             |
|Payable               |               |50
-----------------------------------------------
Resupply Component to subcontractor
|Stock Valuation       |               |50
|Stock Output          |50             |
----------------------------------------------
Receive Final from subcontractor
|Stock Valuation       |150            |
|Stock Input           |               |100
|Stock Output          |               |50
----------------------------------------------
Invoice Final from subcontractor
|Stock Input           |100            |
|Payable               |               |100
-----------------------------------------------
Deliver Final to client
|Stock Valuation       |               |150
|Stock Output          |150            |
-----------------------------------------------
Invoice Client
|Stock Output          |               |150
|Receivable            |150            |
---

closes odoo/odoo#113853

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
2023-03-03 17:05:07 +01:00
Benjamin Vray 8ad736fe48 [FIX] web_editor: prevents dropping a snippet in a non-editable area
Before this commit, it was possible to drop a snippet in a non-editable
area (e.g. dynamic snippets).

Steps to reproduce the bug:

- Drop a "Dynamic Products" snippet in a page.
- Drop a "Columns" snippet in the same page.
- Moves a column from the "Columns" snippet into the "Dynamic Products"
snippet thanks to the "drag and drop" button.
- Bugs => It works when it shouldn't.

task-3054763

closes odoo/odoo#113796

X-original-commit: 4d61c356b7deed7fd0b01cb817c274afe384c0ac
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2023-03-03 17:05:04 +01:00
Maximilien (malb) 4383e3778d [IMP] base_geolocalize: adding div for xpath
Adding a div above the two buttons allows to do a xpath more readable. In the enterprise PR, a new module bridge has been added between base_geolocalize and account_avalara that hides the refresh button when the address has been validated by avalara.

closes odoo/odoo#113210

Task-id: 3186071
Related: odoo/enterprise#37157
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-03-03 17:04:49 +01:00
Martin Maes 4d52a46dfe [FIX] mrp: review and workorder wizard modification
The workorder wizard helping to track the time spend on the workorders has been automated.
The name of the employee will automatically be the name of the admin of the session.
The productivity will also be updated based on the duration
The duration, start date and end date will update based on the two other ones.
This changes will ease the addition of time trackings.

closes odoo/odoo#107473

Related: odoo/enterprise#34786
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-03-03 17:04:47 +01:00
Martin Maes 09314106e2 [IMP] mrp_workorder: employee login in workorder list view
This main feature of this commit is adding the possibility to login with multiple employees on the list view of workorders.

There is now a button in the header that will allow to log in as an employee in the list view.
The flow is the following :
- The employee logs in
- He becomes the "admin" of the session and his name appears next to the log out button.
- If another employee logs in, he will become admin and the first one will no longer be visible in the header.
- The employee will start timesheeting on the workorder if he press the start button. Notice that the employees working on the workorder will appear in the last column of every work_order record.
- If this second employee logs out, the first one will not become admin automatically. He will first need to click on his name/avatar in the popup and will be asked his pin code (if needed) to log in again.

There is also a way to assign employees to a workorder.
A filter will help retreive the workorder on wich the admin of the session has been assigned.
In addition, a new button in the header allows to mark as done multiple workorders at once.

The timer component has been updated to avoid wrong values if the computer goes to sleep mode.

The wizard of the workorders allowing to see the time traking has also be modified (switching tabs).

From a more technical point of vue, the employees and admin will be saved in the session.
The employees working on a workorder will be saved on the record.

related : https://github.com/odoo/enterprise/pull/34786

Part-of: odoo/odoo#107473
2023-03-03 17:04:47 +01:00
Mylyna Hy 4e9e96db9e [FIX] res_partner_bank: set error flag for qr
Problem: With Switzerland accounting localization installed,
the user is unable to create vendor payments for non-Swiss contacts or contacts with non-IBAN accounts
because a qr code will try to generate due to compute_qr_code.
Eventually, an error will be thrown since
the raises_error param for _eligible_for_qr_code is True by default.
When _build_qr_code_vals calls _eligible_for_qr_code, it did not explicitly pass the raises_error arg.
Thus, instead of returning None, an error is thrown instead, blocking futher operations.

Proposed Solution: Method _build_qr_code_vals should pass raises_error = not silent_error to _eligible_for_qr_code.
There is an inverse relation between silent_error and raises_error.
By default, silent_error is True so it's safe to assume that raises_error = False
because the compute for the qr code on payments should not raise any error.
This fix will resolve the issue when computing the qr code for payments while being fluid with other method calls.

closes odoo/odoo#114256

X-original-commit: 45d34a8630918abe2f988f7ed0e0df153a3edd51
Signed-off-by: William André (wan) <wan@odoo.com>
2023-03-03 15:56:52 +01:00
Guillaume (gdi) 2aaca97c75 [FIX] website_profile: prevent losing search params
Before this commit, the "rank by" parameter was deleted when a visitor
added a search criteria. This commit solves this problem.

Steps to reproduce the issue:
- Go to "/profile/users"
- Click on "Rank by" and select "This week"
- Search for a user (e.g. "admin")

=> The "rank by" parameter is lost and if you click on "This week"
again, the search (admin) will be lost.

task-3058239

closes odoo/odoo#114253

X-original-commit: eed9e3d8c1366f457d2f3170741c09ab2143d912
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-03-03 15:56:49 +01:00
Guillaume (gdi) a67528b743 [FIX] website_blog: prevent losing search params
Before this commit, search criteria could be lost when a visitor added a
new search criteria on blogs. This commit solves this problem.

Steps to reproduce the issues (with activate the sidebar):
- Go to the /blog
- Click on the adventure tag
- Select a month in the date filter

=> The adventure tag is lost.

- Go to the /blog
- Select a month in the date filter
- Click on the adventure tag
- Remove the date filter

=> The adventure tag is lost.

- Go to the /blog
- Select a month in the date filter
- Search for the blogs containing the word "heli"

=> The date filter is lost.

task-3058239

X-original-commit: 53ac1736b323257b2545946a8f96d06294c7b8c8
Part-of: odoo/odoo#114253
2023-03-03 15:56:49 +01:00