Commit Graph
141912 Commits
Author SHA1 Message Date
oco-odoo 7d541b9956 [IMP] account: allow deleting moves that were posted before it they are the last element of the sequence chain
We don't check anymore that a move has been posted before in order to allow its deletion. Instead, we look at its sequence: if it's set and is not at the end of the sequence chain it belongs to, we know removing the move will create a gap, whatever the move state, so we forbid it.

If the user really wants to remove the move anyway, it is possible, by manually emptying the name of the move to delete. This way, he won't have any sequence anymore, and will be deletable. Users should however, rather rely on move cancellations and reversals, just for the sake of a cleaner accounting.
2021-04-01 12:09:20 +00:00
Ivan Yelizariev 5a4e7b711e [FIX] core,account: avoid useless recomputations in res.config
User may use Settings menu just to click "Manage Users" buttons. Such simple
navigation sends ``create`` request, which may trigger a chain of
recomputations. To avoid that we redefine ``create`` method to check if a value
is really changed.

The previous explicit implementation lacks in v14 two fields at least:

* from module `account`
    ```
    qr_code = fields.Boolean(string='Display SEPA QR-code', related='company_id.qr_code', readonly=False)
    ```

* from module `enterprise/account_reports`
    ```
    account_tax_fiscal_country_id = fields.Many2one(string="Fiscal Country", related="company_id.account_tax_fiscal_country_id", readonly=False)
    ```

Performance Tests
=================

In this test we click "Manage users" and check stats for
``res.config.settings/create`` request.

Demo database with eCommerce and Accounting app installed:

```
|        | Number of queries | Query time, sec | Remaining time, sec |
|--------+-------------------+-----------------+---------------------|
| Before |               707 |           0.325 |               0.215 |
| After  |               382 |           0.283 |               0.174 |
```

The same, but with extra 1400 invoices:

```
|        | Number of queries | Query time, sec | Remaining time, sec |
|--------+-------------------+-----------------+---------------------|
| Before |               715 |           0.459 |               0.349 |
| After  |               382 |           0.176 |               0.107 |
```

---

opw-2489335

closes odoo/odoo#68620

X-original-commit: 5e3f37191a4687b305e2337780c7f10278f6a7aa
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-03-31 18:02:08 +00:00
Romain Derie 8fcf930a6b [IMP] web_editor, website, *: introduce popover as edit system for links
*: website_form

This commit introduces a simple & light popover/tooltip (as in Google Doc) when
editing a link.

It will be used:
1. (web_editor) On every page links.
2. (website) In the website navbar, when clicking on a menu, it will replace the
popup shown to ask the user what he wants to do (edit the menu or go to the link
or do nothing). That popup was a bit invasive and old-fashioned.

Part of https://github.com/odoo/odoo/pull/64756
task-2439860

closes odoo/odoo#64756

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-04-01 09:49:45 +00:00
Romain Derie fe67b34f1a [IMP] website: keep dropdown open when clicked in navbar on edit mode
Before this commit, when a menu inside a dropdown was clicked, the dropdown
would close itself, making the menu impossible to be edited.
That was not really an issue as those menu could still be edited through the
menu editor dialog.

That behavior was already prevented for mega menu in order to be able to edit
them.

This commit adds the same behavior to regular dropdown menu. It is mandatory
for the following commit adding a popover on menu to edit them instead of the
dialog.

Part of https://github.com/odoo/odoo/pull/64756
task-2439860
2021-04-01 09:49:45 +00:00
Romain Derie 9658cc2944 [FIX] website_blog: add missing require
Require to website snippets options was missing.
Indeed, `CoverProperties` is defined in it, but is `include` in website_blog
without requiring it.

Somehow, it was not raising an error on runbot but adding new odoo module
(totally unrelated to CoverProperties or blog) seems to change the order of
import and reveal the issue.

Part of https://github.com/odoo/odoo/pull/64756
2021-04-01 09:49:45 +00:00
Christophe Monniez e42a5342ee [FIX] hr_holidays: fix typo in relativedelta days
In relativedelta, `day` means day of the month and `days` is for number
of days. Today, the demo data failed because the computed `date_to` was
before the `date_from`.

closes odoo/odoo#68632

X-original-commit: 67cb39aa74ae60dd069bf552ed06c878ec643f9c
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-04-01 07:43:08 +00:00
Alexandre Kühn 1874d6e827 [IMP] mail: Attachment viewer header UX on mobile
Task-ID 2200168

closes odoo/odoo#66614

Related: odoo/enterprise#16579
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-03-31 16:53:24 +00:00
Thibault Delavallée 389d74fab3 [IMP] crm: allow team members to opt-out from assign
Purpose is to allow members to quickly opt-out / opt-in from assign
process. For example if for some reason (leaves, too much leads, temporarily
working on something else) a salesperson cannot handle more leads he may
opt-out from assign process.

When member is opt-out, hide assign details from both kanban and form
views. It allows notably to see at a glance who is out and who is in.

Task ID-2494749
COM PR odoo/odoo#68476
UPG PR odoo/upgrade#2318

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-30 14:41:16 +00:00
jbw 5291db731f [IMP] base: correct erroneous "SOD" currency code to "SOS"
The currency code of Somali shilling is corrected from SOD to SOS.

closes odoo/odoo#66707

Task: 2450747
Related: odoo/enterprise#16614
Related: odoo/upgrade#2300
Signed-off-by: William André (wan) <wan@odoo.com>
2021-03-31 14:15:54 +00:00
jbw 32ada4a415 [IMP] base: Currencies configuration
Improves list; kanban and form view for currencies and currency rates.
Add checks to prevent changing/adding rates when accounting entries exists
on dates concerned by those rates.

Task: 2450747
2021-03-31 14:15:54 +00:00
Mohammed ShekhaandMathieu Duckerts-Antoine 3ed1890c7a [IMP] web: use search groupbys in pivot
Before this commit: all groupable fields were offered to selection when
a user would click on a suitable pivot header. While guaranteeing maximal
flexibility, this was easily overwhelming to any new commer.

After this commit: when at least one groupby is defined in the search
arch, the selection is done in the search arch groupbys (plus eventually
some custom groupbys) via a menu similar to the "Group By" menu in the
control panel. The advanced users have still access to more options in a
"Add custom group" menu again as in the control panel. When no groupby
is defined in the search arch, the selection is done among the groupable
fields as before.
This has led to a small modification of control_panel_model_extension.js:
it has become necessary to distinguish the groupBy filters coming from
the arch from those created by the user via the "Add custom group" menu.

Task ID: 2376505

closes odoo/odoo#61572

Related: odoo/enterprise#17341
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-03-31 13:56:38 +00:00
Noe Antoine 26203f194a [IMP] website_crm: propagate logged partner on lead from contact us form
Reduce friction submitting a CRM contact us form while linking the
lead to the portal contact.This facilitates the flow generating leads
from the contact us form.

The partner_id of the lead created from form is set to the one of the
logged visitor if model is crm.lead and there is a logged_visitor and
if the prefilled email and phone number of form match the logged partner's
(otherwise it would change the partner when setting it on lead

In details : there must be an email, the same in input and in partner,
after normalization. Only then:
- If there are both a phone in values and a phone on partner,
  propagate partner on lead only if they are the same.
- Else, that is if there is no phone in partner or no phone in values,
  propagate partner on lead. If no phone in input, it will not propagate.
  on the model. If no phone in partner, then if there is one in input, it
  will write that additional info on partner, completing its profile.

Concerning phone comparison: extending current logic, the numbers are
still formatted before comparison. That is:
- Before this comit, the form value was formatted according to country in
record or geoip. Now, if there is no country_id in record, uses the logged
visitor partner's country or env company country, if there is a logged user.
Finally, it uses session geoip as last option. (changes in _get_country())
- The partner's number is formatted through its model function _phone_format,
according to the partner country (or env company).
- Both formattings are done in international format.

Adds tours to check that partner is linked to lead only if phone and email
are not changed from prefilled data (from logged visitor's partner on form.

Task-ID : 2241639
PR : #61126

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-31 13:23:21 +00:00
Noe Antoine 5e0f7d1e78 [IMP] website_crm : catch logged partner info on contact form
1) Improves user experience by filling contact form with logged partner info.
This facilitates the flow when logged.

The contact us form is filled with data from the partner linked
with logged in web visitor, logged_partner. Its data is used in priority.
Empty fields (e.g. no partner is logged) will be set to default values
in request.params if any. This way, previous behaviour is preserved (as well
as widget correct display behaviour).

2) This commit also adds a star next to the required field Subject in the contact
us form like for the rest of required fields of the form : s_website_form_mark
This improves coherence and clarity when filling the form.

Task-ID : 2241639
PR : #61126
2021-03-31 13:18:07 +00:00
7cfb0e0e74 [MERGE] *: declare assets in manifest, not in xml
This PR changes the way assets are declared in Odoo modules.

Before: assets were declared in template files. Template bundles were
generated from primary templates, so technically any qweb template could
have been called as an asset bundle, with the 't-call-assets' directive.

Being standard qweb templates, they had access to standard HTML tags
(script, link, with or without raw scripts or style definition), qweb
directives (t-call, t-raw, etc.) and could be inherited by other
templates.

Now: assets are defined in the module's manifest and generated by the
't-call-assets' directive.

More information on the new system can be found on the updated user
documentation (see the "JavaScript Reference" section).

closes odoo/odoo#60632

Task: 2352566
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 17:15:51 +02:00
Benjamin Vray 229a731855 [FIX] website_sale: fix product grid tables layout
Before this commit, on the /shop page, tables inside modals (e.g.
modal optional product) were modified by the CSS of the table of the
product grid. After this commit, the CSS is modified to only target
the product grid table.

task-2492086

closes odoo/odoo#68600

X-original-commit: 312e9b60b7f2ffe6f10b9bb7c202cb72e67ac8ab
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-31 13:24:37 +00:00
Benjamin Frantzen (bfr) 90f23b6b5f [IMP] account: remove deprecated method _create_invoice_from_single_attachment
closes odoo/odoo#68596

X-original-commit: 079be25a1d994fa2166c90fa52216498b1b27d37
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-03-31 12:47:57 +00:00
Julien MougenotandSimon Genin 03641610c2 [REF] *: convert all modules to new asset system
Conversion of all modules to the new manifest assets declaration.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:18 +02:00
8cc066173d [IMP] *: Improve assets management
This commit changes the way assets are declared in Odoo modules.

Before: assets were declared in template files. Template bundles were
generated from primary templates, so technically any qweb template could
have been called as an asset bundle, with the 't-call-assets' directive.

Being standard qweb templates, they had access to standard HTML tags
(script, link, with or without raw scripts or style definition), qweb
directives (t-call, t-raw, etc.) and could be inherited by other
templates.

Now: assets are defined in the module's manifest and generated by the
't-call-assets' directive.

More information on the new system can be found on the updated user
documentation (see the "JavaScript Reference" section).

Task: 2352566

Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Simon Genin (ges)andJulien Mougenot ee412d2138 [REF] account: remove file from qweb that doesn't exist anymore
This commit removes a template file that was does not exist anymore in
the account module.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Simon Genin (ges)andJulien Mougenot 216b530002 [REF] website: remove priority for assets frontend in portal
This commit removes a needless priority attribute on a portal template.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin 26dea77c72 [REF] point_of_sale: clean up assets views
This commit handles 2 things:

- The line odoo._modules = <t t-raw="get_modules_order()"/>; used to be in
assets_backend but is now directly added to the web.bootsrap (the odoo
index template). Since pos has its own index, we add it there.

- An "id" attribute has been removed from a link tag which was used to
indentify said link as an xpath target. The xpath has been adapted to
target the href instead.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin 6b87c77502 [REF] google_recaptcha: Public key in session_info
Before this commit, the recaptcha widget got the database public key
from a qweb "t-set" directive fetching directly the key from the
database when rendering the template.

Now, it is loaded beforehand and given to the session_info instead.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin a3373db4b8 [REF] mass_mailing: clean up assets views
This commit handles 2 things:

- Clarifies why some inline style has to remain inline instead of being moved
to a separate file.

- Moves an inline modification to field_html for testing purpose to
a dedicated file.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin 043079d4dd [REF] web_editor: clean up assets views
This commit handles 2 things:

- Moves snippets used to call the summernte library inside several new
dedicated files.

- Removes a raw script declaration to move it to a dedicated file.

Also the calls to the lib files have been changed from a qweb loop to an
explicit list of script tags.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin ebe86f5ca5 [REF] web,*: Flatten _assets_helpers
Before this commit, the asset bundle "_assets_helpers" was the only
bundle using a "t-raw" directive to insert assets in between other asset
calls.

Now _assets_helpers only contains the assets called before the t-raw
directive, and the second part (1 file actually) has been added after
every call of the bundle.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Julien MougenotandSimon Genin e0efbb08a4 [IMP] web_tour: add tour 'disabled' option
This commit changes the way tours are automatically disabled when in
demo data.

Previously, an override of the assets_common template was applied by a
file loaded in the web_tour demo data, ensuring that the tours are
disabled when demo data are loaded in the database.

Now, a "tour_disable" boolean will be given to the session_info object
to determine whether the tour manager must be disabled, meaning that it
will automatically consume all registered tours.

This has been done to improve consistency in asset bundles declarations
by reducing them to the simplest possible templates.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:17 +02:00
Djamel (otd) d569a71250 [FIX] accounting: fix the creation of the first sample vendor bill during the tour
Steps to follow to reproduce the bug:
-In V14
-Go to accounting
-In the tour, click on Create First Bill
-Choose ‘Try a sample vendor bill’ and click on continue
-an error is triggered

Problem:
The returned  value of ”create_invoice_from_attachment” method is treated as an “account.move” recordset, but it is a dict used for ‘ir.actions.act_window'

Solution:
We retrieve the ‘account.move’ from the ‘res_id’ found in the dict.

The issue was introduced by this commit : https://github.com/odoo/odoo/commit/8435d0e8990509ee67425977f970ab27bea8133a

opw-2469567

closes odoo/odoo#68595

X-original-commit: 2252cae941efcca36f981d50c546cacf70ff760d
Signed-off-by: William André (wan) <wan@odoo.com>
2021-03-31 11:54:16 +00:00
Nicolas Lempereur 86b189bfea [FIX] payment_stripe: special character in reference
Special character in reference (eg. '#' character in invoice sequence)
might cause error after payment not showing it was successful.

With this changeset, when a payment reference is used inside an url, we
quote it.

opw-2479658

closes odoo/odoo#68585

X-original-commit: 47645c2f170d5a7c09ae80d4e0de6c3a821f7b36
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-03-31 11:46:27 +00:00
Goffin Simon 199878a569 [FIX] repair: Invoice lines are not added for Repair
Steps to reproduce the bug:

- In Repair: create a new repair order
- add some product to "Add' and operation.
- Select option for Invoice Method: Before/After Repair.
- Confirm Repair, finish repair and create invoice.

Bug:

No line was created in the invoice

PS: the invoice_line_ids were popped from function _move_autocomplete_invoice_lines_create

opw:2493091

closes odoo/odoo#68587

X-original-commit: 952ff15a3af90bb32660262b4fd32ca8a1172eac
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-03-31 10:52:11 +00:00
Daniel Blanco f1a0e164ea [FIX] l10n_cl: restore missing l10n_latam_document_number from cl tree view (this was present in 13.0 and was lost during forward)
closes odoo/odoo#68576

X-original-commit: edefeef7f0f25c59580395cfb4386c50ca6504f8
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-31 09:06:37 +00:00
Jérémy Hennecart e021eb0946 [FIX] calendar_sms: fix naming issue
Fix naming issue as "ttype" was replaced by "alarm_type"
Linked COM PR: odoo/odoo#68443

closes odoo/odoo#68572

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-31 08:21:38 +00:00
Nicolas Lempereur a92e702a43 [FIX] web_editor: show XML editor error if rejection value
Override in enterprise web_studio of _saveView on error never rejected
promises. But now it does so the XML editor interface is not blocked
after error.

But we were already showing the correct error in web_studio use case, so
we don't want another one and this change allow that by only showing an
error if we received rejection value.

opw-2460081

closes odoo/odoo#68569

X-original-commit: 43184af875f3eb52586348b383627cb0140484f5
Related: odoo/enterprise#17395
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-03-31 06:49:32 +00:00
Olivier Dony 66ad8f7843 [IMP] auth_signup: don't update templates unnecessarily
Calling write() on a record will touch it and update its `write_date`,
even if all the field values are identical to the current values.

Let's not touch the mail template unless we have a reason to.

closes odoo/odoo#68562

X-original-commit: ecd0253d1cc231c8695183e1688835b969864362
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-03-30 18:36:23 +00:00
Romain Derie 603ace1966 [IMP] web_editor: add error support for too big image files
ValueError is raised when image resolution is too big (over 45e6[1]).

[1]: https://github.com/odoo/odoo/blame/4c91e895a98642f10bd1d2d46819705edc38f638/odoo/tools/image.py#L47

Part of https://github.com/odoo/odoo/pull/65828
task-2345082

closes odoo/odoo#65828

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-31 07:07:39 +00:00
Romain Derie 9dab9ffce2 [IMP] web_editor: show error if uploaded image type is not suported
We only support .gif, .jpe, .jpeg, .jpg, .png, .svg

This commit won't let the code go though if we know the image format is not
suported.

Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:07:31 +00:00
Romain Derie 0d6cdeef2f [IMP] web_editor, *: show a progress bar on image upload
*: web, web_unsplash

Without this commit, the user had no hint to know something was actually
being performed.
It would be worst when uploading multiple image at once, eg in image
wall, as it could take some times for the images to be processed and
uploaded.

The user now has a visual hint about the upload progress through a
toaster and some progress bars.

For unsplash, note that as the actual image download is performed S2S,
the progress bar will automatically jump to 100%, then will wait for the
RPC success once the server is done to show a success progress bar.

Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:06:35 +00:00
Romain Derie 185c50a740 [IMP] web_editor: whitelist supported image formats in URL
Only allow URL ending with extension of supported image formats.
Don't let anything else goes though, so we remove the magic behavior
that was uploading a non-image url as a document.

Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:06:22 +00:00
Romain Derie 1dc4ca96c4 [REM] web_editor: leftover of aa8d2a8be2
Part of https://github.com/odoo/odoo/pull/65828
task-2345082
2021-03-31 07:05:51 +00:00
Rémy Voet (ryv) 69ae63e75c [IMP] stock: populate putaway
closes odoo/odoo#63516

Related: odoo/upgrade#2040
Related: odoo/enterprise#15363
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-03-31 09:00:40 +00:00
yhu-odoo 92e577d106 [IMP](sale_)stock,mrp: smart putaway rules
We introduced new Smart Putaway Rules.
Locations now can have a storage category, on each storage category,
we can specify the amount of products/packages(with certian package
type) that can be stored in the location.
On putaway rules, we can also set a storage category. Now when apply a
putaway rule, we will find a suitable child location of the out
location according to quantity/weight setting on the storage category.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 09:00:40 +00:00
yhu-odoo 1cd0a138cf [REF] delivery, stock: make delivery product a new model
Currently, delivery packaging and product packaging share the same
model product.packaging. In this commit, we make delivery packaging
a new model stock.package.type. The code is also moved to stock
instead of delivery for compatibility reasons.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 08:55:44 +00:00
yhu-odoo f2b19e4f4d [FIX] stock: don't check parent locations when finding putaway rules
Let's say we have location A, B, and C. A is the parent of B, B is the
parent of C. And we have a putaway rule to move product from A to B. Now
receive product at C, because currently when we can't find a putaway
rule at one location, we will loop to check its parent locations. So the
puteaway rule A -> B will be found, and product received at C will in
the end be stored at B.
After this commit, we don't check the parent locations when we can't
find a putaway rule.

Task 2341820
PR #63516
ENT PR odoo/enterprise#15363
UPG PR odoo/upgrade#2040
2021-03-31 08:55:44 +00:00
Odoo's Mergebot 6e972e792d [MERGE] web: fix quick edit tests mcm
This PR is two-fold. First, it removes a cause non-deterministic failing
builds. The cause was the setTimeout for the quick edit event in FormController
which waits at least 1 tick even if timeout = 0 like in those tests. Now, if this
timeout is 0 then we bypass the setTimeout.
Second, we ensure that the delay is patched to 0 for every tests, and allow
to set it to a specific value is wanted in a given test. Indeed, before this PR,
a patch done in a module was never unpatched, and some tests executed after
passed in the whole suite, but failed when executed alone, because they also
needed the patch.

closes odoo/odoo#68578

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-31 11:38:44 +02:00
Aaron Bohy c89cdcf11c [FIX] web: tests: patch form multiClickTime once for all
A lot of tests in different QUnit modules need this delay to be
patched to 0. Some of them (e.g. the 'ActionManager > Misc' module)
didn't patch it correctly. It worked before because a patch was
done in a previous test, and wasn't unpatch. The previous commit
ensures the patch is removed, so now we have at least 2 tests of
the above mentionned module that fail. This commit ensures that
the delay is patched in every tests, and allows to specify a
custom delay if necessary.
2021-03-31 09:30:07 +00:00
Aaron Bohy a3937cfde5 [FIX] web: tests: properly unpatch after test
For testing purpose, the multi-click timeout delay of the quick
edit is patched. However, in this specific test, it is patched
twice (once to set it to 0 in beforeEach, and once to set it to 50
in the test itself). A single call to unpatch removes the second
patch (50) but keeps the first one, for the remaining of the test
suite. This could lead to weird situations where the whole suite
passes, but a single test executed on its own fails.

Issue spotted in the assets revamp PR, as it alters the test order.
2021-03-31 09:30:07 +00:00
Michael Mattiello (mcm) 7ad8bb2c09 [FIX] web: fix quick edit tests
Before this commit, quick edit tests could crash in an undetermined way.
It was due to the setTimeout for the quick edit event in FormController
which waits at least 1 tick even if timeout = 0 like in those tests.
Now, if this timeout is 0 then we bypass the setTimeout.
2021-03-31 09:30:07 +00:00
Yannick Tivisse 6c11a1c15b Revert "[FIX] hr_contract: update date_end when closing contract"
This reverts commit 825b533ec964fd8a9923dd4d2091f122b92d8759.

For the following reasons:
- This is a behavior change on a stable release. See our stable policy:
  https://github.com/odoo/odoo/wiki/Contributing#what-does-stable-mean
- If a contract end date is set, it's erased when moving the contract afterward.
- There is a cron which is moving the expired contracts automatically,
  this will rewrite the end date on it, which is not a big deal, but this
  is useless.
- Modifying the contract end date also unlink all the work entries that are
  outside of the new contract period. If there is an open payslip, it also
  recomputes the worked days lines, and the payslip lines.
  That way, it's possible to recompute a payslip by introducing unpaid
  time off inside of it. If the payroll officers are checking the payslips
  at that time, and don't notice it (already checked, etc...), then at the
  validation, this could lead to some more serious issues (wrong net salary
  paid to the employee, wrong accounting entries, wrong declaration to the
  state, etc).

If the contract end date is badly configured, this is normal that the
reporting is wrong. No need to add some magic that people don't understand,
that could lead to wrong behaviors later on the process.

closes odoo/odoo#68541

X-original-commit: c34b6bc3d0d25e8b8b1bcb6684331627b823f57d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-30 12:17:20 +00:00
Yannick Tivisse cf7e386032 [FIX] resource: Correctly pass domain if set
closes odoo/odoo#68536

X-original-commit: 62a01fa6ff2f1f078b333f5d8bb16d73d0921bdb
Related: odoo/enterprise#17371
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-30 11:24:21 +00:00
Rémy Voet (ryv) 20b58fc731 [REF] stock: remove _product_available method
This method is useless and it bypass the computation of some fields
(qty_available, virtual_available, incoming_qty, outgoing_qty). Then
this method is not cache-friendly, and we should use `read` instead.

task-2439019

closes odoo/odoo#66621

Related: odoo/enterprise#16584
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-03-30 09:27:05 +00:00
Rémy Voet (ryv) 64caa930b3 [REF] stock: cache the get_warehouse of stock.location
To avoid multiple search of the get_warehouse for the same location
and extra SQL request (it happens a lot for complicate flow, e.g.
mrp_mps, replenishment report).
Translate it into a standard compute to use the cache of
the ORM for no-store compute field (`warehouse_id`) and put
some depends to be always correct (even if `warehouse_id` shouldn't
change in the same request).

task-2439019
2021-03-30 09:27:05 +00:00