Commit Graph
151076 Commits
Author SHA1 Message Date
Odoo's Mergebot 95e4eb6adc [MERGE][MOV] product: split product.py
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#84970

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-02-21 12:24:17 +01:00
Victor Feyens 78776bf3de [MOV] product: split product.py (2)
Files split in two commits to keep lines ownership and git blames.

Part-of: odoo/odoo#84970
2022-02-21 11:24:16 +00:00
Victor Feyens 2e3c21941c [MOV] product: split product.py (1)
Part-of: odoo/odoo#84970
2022-02-21 11:24:16 +00:00
Nicolas Lempereur 79459e037b [FIX] link_tracker: get redirected page title instead of URL
In 2e3075693b06d71222b446bd8a805dacb639d0e4 we used a head request to
determine type of page before trying to get a title out of it.

But requests.head does not allow redirect by default:

https://docs.python-requests.org/en/v2.9.1/user/quickstart/#redirection-and-history

so if an URL was a redirect, we would not longer get the page title.

opw-2457640

closes odoo/odoo#84832

X-original-commit: 63346cf4b77f760121f88762ab2911c37603b548
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-02-21 11:24:10 +00:00
Andrea Grazioso (agr-odoo) a358096aec [FIX] web: lost sign between -1 and 0
Create a credit note for an amount between 0 and 1, confirm it.
In Accounting app, open Reporting -> Invoice Analysis
Switch to Pivot View
The credit note amount will be positive

This occur because in `insertThousandsSep` the number -0 is converted
to "0" (string), thus losing the sign before saving it

opw-2759964

closes odoo/odoo#84946

X-original-commit: c71d4c2349e623a4bcc49c2318fbbc9de08e0fa4
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-02-21 10:28:28 +00:00
Ivàn Todorovich f561d2a95c [FIX] sale: Impossible to unset invoice_mail_template_id
Steps to reproduce:

1. Go to Configuration > Website
2. Enable Automatic Invoice and Save
3. Remove the value from Invoice Email Template and Save

Result:

* The field shows as set by the default value.
* The ir.config_parameter doesn't exist.

Excepted:

* The field should be shown as unset.

closes odoo/odoo#84901

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-02-21 10:28:22 +00:00
Rémy Voet (ryv) 534087fa8d [REF] core: simplify tooling of browse()
Remove str from IdType, because those kinds of ids are no longer
necessary, and lead to unusable recordsets.

Because IdType now only contains int and NewId, simplify (and speed up)
the conversion of the parameter of browse().

Preferably wrap single NewId into a tuple instead of a list, as tuples
are faster.

closes odoo/odoo#83687

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-02-21 10:28:15 +00:00
Rémy Voet (ryv) c2ab0a5c54 [REF] core: simplify some base methods of BaseModel
Simplify __bool__(), __repr__(), __hash__() by removing calls to
getattr/hasattr.  We can expect a performance improvement of these
highly used method (for a single record):
 - __bool__(): 145 -> 108 ns
 - __hash__(): 330 -> 289 ns

Discard support for user id in sudo(), the method now only accepts a
bool.

Part-of: odoo/odoo#83687
2022-02-21 10:28:15 +00:00
Rémy Voet (ryv) ce7704e836 [FIX] base: nondeterministic order of res.partner
Part-of: odoo/odoo#83687
2022-02-21 10:28:15 +00:00
Rémy Voet (ryv) 3fc5996c3e [REF] core: refactor the filtered_domain method of BaseModel
The method filtered_domain() didn't conserve the order of `self`, which
may be confusing, and a subtle source of bugs.  It now preserves the
order from `self`.

The processing of `child_of`/`parent_of` making a search with the
default order of the model, which may be slow.

Add documentation.

Part-of: odoo/odoo#83687
2022-02-21 10:28:14 +00:00
Rémy Voet (ryv) 0e9adf7138 [REF] core: improve doc and params naming
- Improve the documentation of some methods of `BaseModel`.
- Change `args` name of search in `domain`

Part-of: odoo/odoo#83687
2022-02-21 10:28:14 +00:00
Rémy Voet (ryv) 6580fe0610 [REM] core: remove attribute 'limit' from X2many fields
Part-of: odoo/odoo#83687
2022-02-21 10:28:14 +00:00
Rémy Voet (ryv) 8a1302a502 [REM] core: remove mutable default for parameters
Part-of: odoo/odoo#83687
2022-02-21 10:28:13 +00:00
Rémy Voet (ryv) a31cbaf639 [REM] core: remove method _mapped_cache
Remove `_mapped_cache` because the `mapped` do the same stuff.
And it was unused. Also remove useless pass and import.

Part-of: odoo/odoo#83687
2022-02-21 10:28:13 +00:00
Rémy Voet (ryv) 8f7fad7601 [REM] core: deprecate fields_get_keys and get_xml_id of BaseModel
Part-of: odoo/odoo#83687
2022-02-21 10:28:13 +00:00
clesgow 6f2ba1e1b4 [FIX] stock: negative move propagation
When a warehouse used multi-steps for incoming/outgoing shipments,
negative procurements could create returns pickings instead of reducing
the quantity of subsequent moves down the chain.

For example a two-step delivery, a sale order with 5 product A would
have the following pickings linked :
Pick:
- product A : 5 qty
Out:
- product A : 5 qty

Then reducing the amount of product A to 2 in the sale order would do :
Pick:
- product A : 2 qty
Out:
- product A : 5 qty
Return:
- product A : 3 qty

closes odoo/odoo#84900

X-original-commit: c9bc689468d2c775d3b3ec65c8894e4dd66e7249
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-02-21 09:34:58 +00:00
Bernat Puig Font 6806a72e45 [CLA] Update ForgeFlow
closes odoo/odoo#84896

X-original-commit: 1a5afdef92589ca9ea31bfd30af755de7bb20985
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-02-21 09:34:54 +00:00
Bernat Puig Font 97835e4a8b [FIX] mrp: date_planned_finished field correctly saved
When creating a MO _date_planned_finished_ is not added.
Consequently calculates wrongly the date planned to finish the MO.

X-original-commit: 2b2509e154af0e58a3f30f1d7fe40fb854b6b881
Part-of: odoo/odoo#84896
2022-02-21 09:34:54 +00:00
Antoine Guenet def50847d5 [FIX] mass_mailing: properly convert base64 images
The function that converts inline images to urls returned the modified
html as a byte string. As a result, the Mail Debug tab showed a
hexadecimal string rather than rendered html. This makes sure the string
is encoded in unicode instead, so the format of the string coming out of
the function is the same as it was coming in.

closes odoo/odoo#84942

X-original-commit: b4094ed004a59512d70913f9cc41de8df894296e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-21 08:41:45 +00:00
Mathieu Duckerts-Antoine 0ae13be7de [FIX] web: action service: button action with html help
The method call_button sometimes returns an action with a help key.
That help was not marked up, leading to an incorrect display of that help.

closes odoo/odoo#84869

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-21 08:41:37 +00:00
Victor Feyens bfe8838445 [IMP] website_sale_slides: forbid adding a course n times in cart
* Also remove unused product_template_id param for /shop/cart/update 
route

closes odoo/odoo#82374

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-21 08:41:34 +00:00
Victor Feyens d4b046e238 [REF] website_sale: pricelist computation & cache
Try to put some logic and clarity in the cached e-commerce pricelist logic
* Try to reduce cache invalidations
* Pass all parameters as id/tuple(ids) to have clean/coherent cache keys
* Add comments

Part-of: odoo/odoo#82374
2022-02-21 08:41:33 +00:00
Victor Feyens 3687826206 [IMP] website_sale: clean /shop/product route
* Remove unnecessary context modifications
* simplify code

Part-of: odoo/odoo#82374
2022-02-21 08:41:33 +00:00
Victor Feyens a647a3323d [REF] website_sale*: cart lines creation & update
Clean whole flow of cart updates (new lines, modified quantities, ...)

* Use clean hooks to differentiate line update and creation, quantity verification, ...
* Avoid write calls with unmodified values, useless recomputations, queries, ...
* Create new lines directly with the correct quantity and values
* Delegate fields computation logic to sale as much as possible (price, discount, name, ...)

Part-of: odoo/odoo#82374
2022-02-21 08:41:33 +00:00
Victor Feyens 945bbe6894 [REF] website_sale*: cart creation & pricelist update
Clean cart creation/updates
Rely on sale computes as much as possible
Remove dead code
Add comments

Part-of: odoo/odoo#82374
2022-02-21 08:41:33 +00:00
Victor Feyens 63338d3f9b [REF] website_sale: clean qweb templates
* Indentation
* use of "cached" methods
* Do not compute prices on /cart page, show the prices in the cart 
instead

Part-of: odoo/odoo#82374
2022-02-21 08:41:32 +00:00
Victor Feyens 1c6ec568ac [REF] website_sale: force website methods to be called on a record
Part-of: odoo/odoo#82374
2022-02-21 08:41:32 +00:00
Victor Feyens 6d587718aa [IMP] website_sale: computes prices on /shop page in batch
Bypass the unnecessary `_get_combination_info` call for each template
and compute the prices in batch, avoiding N-1 times the calls to get the
pricelist price and the fiscal position.

Part-of: odoo/odoo#82374
2022-02-21 08:41:32 +00:00
Victor Feyens a985182259 [FIX] sale: do not discard price computation if feature is disabled
The discount must be computed regardless of user groups (computed fields 
should not be dependent of user groups ideally).
Anyway, pricelist discount policy is by default to show the price with 
discount.

Unless the database and user groups are wrongly configured, this 
shouldn't have any impact.

Part-of: odoo/odoo#82374
2022-02-21 08:41:31 +00:00
Victor Feyens d9f9692a2d [IMP] website_event_sale: use "cached" website pricelist value
Instead of calling the method `_get_current_pricelist` multiple time.

(This should not be noticeable on perf, but is a pure cleanup)

Part-of: odoo/odoo#82374
2022-02-21 08:41:31 +00:00
Victor Feyens b7420cd5c0 [IMP] website_sale: clean fields on website class override
Part-of: odoo/odoo#82374
2022-02-21 08:41:31 +00:00
Victor Feyens 667842b790 [IMP] website_sale: avoid reading attributes when unnecessary
Do not fetch combination info for products having no accessory products, 
this adds additional SQL queries for nothing.

Part-of: odoo/odoo#82374
2022-02-21 08:41:31 +00:00
Victor Feyens 756c5b4922 [REF] event_sale: correctly compute discount for event tickets
Discount wasn't computed the same way in backend sale flows and e-commerce flows.
Now the pricelist discount policy will be considered in the core logic of
event_sale.

Part-of: odoo/odoo#82374
2022-02-21 08:41:30 +00:00
Victor Feyens 6e6d9f3b63 [IMP] website_sale*: methods/routes cleanup
* consistent/clear sale_get_order params (force_create is a boolean value, do not provide integers)
* use one coherent way to get website current pricelist, through the dedicated computed field

Part-of: odoo/odoo#82374
2022-02-21 08:41:30 +00:00
Victor Feyens dfd1d29938 [IMP] website_sale_*: simplify _cart_update overrides definition
Part-of: odoo/odoo#82374
2022-02-21 08:41:30 +00:00
Victor Feyens dc8db07ba7 [IMP] product: do not fetch all categories/variants/templates data
Delegate to subqueries, reduce data fetched from database,
potentially reduce queries when computing prices.

Part-of: odoo/odoo#82374
2022-02-21 08:41:29 +00:00
Victor Feyens a73fb16da0 [IMP] product,website_sale: pricelist API cleanup
* query pricelist filters/domains directly for the correct company 
instead of relying on context/session/... content
* pass the record instead of the id to avoid useless browse calls
* also clearly highlight sudoed partner record

Part-of: odoo/odoo#82374
2022-02-21 08:41:29 +00:00
Victor Feyens 06f417012c [IMP] product: clean res_partner.py
Part-of: odoo/odoo#82374
2022-02-21 08:41:29 +00:00
Victor Feyens 5a58ba9d1a [IMP] product: clean product_pricelist.py
* rename default method according to guidelines
* reorder fields
* clean fields attributes & indentation

Part-of: odoo/odoo#82374
2022-02-21 08:41:28 +00:00
Victor Feyens 753ac6b30a [IMP] product: clean product_pricelist_item file
* order fields, methods according to guidelines
* fix some typos
* rename methods according to guidelines
* remove useless field attributes and class specifications in super()
calls

Part-of: odoo/odoo#82374
2022-02-21 08:41:28 +00:00
Victor Feyens 35bc99a77e [IMP] product: split python files by classes
Part-of: odoo/odoo#82374
2022-02-21 08:41:28 +00:00
Nicolas (vin) 9e27a1fd4a [FIX] account_reports, l10n_it_reports: carryover fix
There is an issue with the Italian carryover, line vp14b.
Use case:
 - Month 1, have a value of 25 in this line => will trigger a carryover to line vp7
 - Month 2, add more value to vp14b so that it goes above 25.82.
   This will set the bound as None, and thus this will not impact the carryover.
This is wrong, because then the next month we will see a value of 25 in vp7
while it should be 0.

closes odoo/odoo#84938

X-original-commit: ffbc7af321a36d4fd0aebb94d7a636cb1fc34b88
Related: odoo/enterprise#24555
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Nicolas Viseur <vin@odoo.com>
2022-02-21 07:49:49 +00:00
Katherine Zaoral 69e31db6ac [IMP] l10n_ar:_sanitize vat number method
* fix traceback when vat is not defined, return directly 0.
* remove api.model
* add ensure_one() to avoid misuse of the method

closes odoo/odoo#84952

X-original-commit: 5cd4df745462fcc12b9d92def9cf903ebd0df143
Related: odoo/enterprise#24565
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-20 20:39:50 +00:00
Julien Mougenot 915191cb18 [FIX] web: assign numbering system to luxon
Before this commit, the numbering system used by luxon was the default
one set by the browser (in most cases: 'latn'). This caused issues when
translating luxon dates with moment dates, as moment supports some
locales differently (e.g.: ar_001 uses the 'arab' numbering system
while Intl uses 'latn').

To have proper consistency, this commit assigns (as much as possible)
the same numbering systems as luxon for each supported locale.

Warning: since the numbering system is now set according to the user
'lang' parameter, it's now unsafe to use `DateTime.fromFormat(...)` with
static date strings, as they might not be parsable with the current
numbering system.

closes odoo/odoo#84833

X-original-commit: 8bd8b299d57ea930b0549446900bd51d03800041
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-02-19 22:17:32 +00:00
Benoit Socias 07290bfe8d [FIX] website: disable fuzzy search if search term contains numbers
Since [1] when fuzzy search was introduced, fuzzy search was also used
when the search term contained numbers.
This is a problem for companies where the shop search is used on
references: the fuzzy search does not match against the whole database
and therefore the exact match might not be found.

After this commit the exact search is used whenever the search term is
made of 80% of numbers or more - because it is very likely to be a
reference or an identifier.

[1]: https://github.com/odoo/odoo/commit/7559626c54e34b41e1549e28276a650accec6986

opw-2715647

closes odoo/odoo#84943

X-original-commit: 7b44907c322a7b78ef4a5cb46627df4f72b21240
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-18 21:04:54 +00:00
Paolo (pgi) d2d50ba63b [ADD] l10n_it_edi_sdicoop: user settings for demo mode
- A new flag is added to the Setting (l10n_it_edi_sdicoop_demo_mode)
  that is computed from the ir.config_parameter
  'account_edi_proxy_client.demo'.

  If the flag is 'demo', Odoo will not send invoices through the EDI,
  if the flag is 'test', Odoo will send invoices to an IAP test server
  instance that operates with a test SDICoop service
  if the flag is 'prod', Odoo will send invoices to production IAP,
  that routes them to the official SDICoop service.

- Some minor UI rework for the EDI parameters on res.company
  The EDI settings in the res_company form, under the
  'Electronic Invoicing' tab, must stay on the left

closes odoo/odoo#84925

X-original-commit: c5d049c55d21f9885e79182df2bd5f433c5bb782
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-18 18:13:37 +00:00
root 41b5d4306e [IMP] purchase: create hook to override searchbar sortings
With this commit we can now call a hook when we want to modify the code for this route.
Before this commit the only way to modify/extend this would be by taking over a big part of the code.

closes odoo/odoo#84905

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-02-18 15:30:47 +00:00
William Braeckman caefc5b048 [FIX] hr_holidays: fix invalid first level next call date
Prior to this commit the next call date for the first level would not
take the second level into account, as such it could be that the first
level would be completely skipped instead of being prorated properly.

TaskId-2768435

closes odoo/odoo#84899

X-original-commit: 791b801c7b96a94353031a06dd5da4eeb20ee08b
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-02-18 15:30:43 +00:00
Julien Mougenot f6b051a828 [IMP] web,*: Deterministic mock server sorting
This commit orders the records coming from the mock server the same
way they are ordered by the ORM, while also allowing it to support
multiple levels of orderby.

This has been done to increase consistency in the test suite and provide
a more accurate representation of how records would be returned by the
actual server.

Some tests performed their assertions based on this previous
undeterministic system and have been adapted, either by altering
the base setup or the assertions themselves.

closes odoo/odoo#84718

Related: odoo/enterprise#24509
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-18 15:30:39 +00:00
Sébastien Geelen (sge) b160eabafd [FIX] web_editor: keep cursor in empty inline tag
Ensure the user can keep typing inside a newly emptied inline tag:

* Add Zero-width Spaces (ZWS) in empty html tag

> We add zero-width spaces in elements in certain cases where they would
> not be correctly displayed by the browser if they were truly empty.
> This also ensure the user cursor can stay in an empty elements,
> and thus we keep the ability to add content in those elements.
>
> See the `fillEmpty` utils function.

* Remove lingering zero-width spaces

> However, we never remove those zero-width spaces when they are not
> useful anymore. In particular, keeping those invisible characters in the
> content prevents the ecommerce from saving the new price of a product if
> the previous price was previously completely emptied during edition.
> This commit fixes that.
>
> The issue didn't happen with the previous editor because they were
> using non-breaking space instead, which is removed by the text_content
> method of lxml. However, non-breaking space were visible during edition,
> which was weird on its own.
>
> Some changes had to be made to the deleteForward and backward commands,
> to ensure the new behaviors.
> Author : @dmo-odoo

* Adapt the deleteForward and backward commands

> To ensure the added ZWS do not break the Deletes behaviors,
> we need to adapt the `deleteForward` and `deleteBackward` commands.

Co-authored-by David Monjoie <dmo@odoo.com>

task-2622455

closes odoo/odoo#84891

X-original-commit: 4360643a446271d4ff1898d67a5b5287722a0820
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-18 14:29:30 +00:00