Commit Graph
150205 Commits
Author SHA1 Message Date
Odoo's Mergebot b11b05b714 [MERGE] sale_subscription: Merge sale.subscription into sale.order
Purpose
=======

Migrate subscription to sales order to simplify the code, the UX & make it more flexible for the future and easier to maintain.
Subscription still appears as a separate module.

This PR aims to move the sale.subscription models to sale.order. The implementation is quite similar to the sale_renting module.

Before this PR, sale.subscription records are similar to sale.order ones. A lot of logic is duplicated to handle the subscription line computations, tax handling, etc.
The current implementation of subscription has several drawbacks:
* the sale.subscription records depends on required sale order template.
* it is not possible to mix different periodicity in a subscription. Each partner has as many contract as periodicity  needed (monthly, yearly etc)
* when the flow starts in sale_management, the first invoice must be created from the sale application.
* upsell prorata calculation to apply a discount is flawed when the salesman want to apply another discount.

This PR fixes these issues and make subscription more flexible. One record can have subscription lines with different periodicity. Each line have a next_invoice_date and invoices are generated when they are due with the matching lines.

Before this commit, the sale module could not be used to manage subscriptions in an override.
This commit adapts the sale module to odoo/enterprise#21825

closes odoo/odoo#82632

Taskid: 2568007
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-04-07 15:19:59 +02:00
Alexandre Kühn 04b8a270d4 [IMP] mail: introduce ComposerView/onClickSuggestion
Task-2579306

closes odoo/odoo#88152

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-07 14:20:59 +02:00
Alexandre Kühn 45a4f1d40b [IMP] mail: introduce AttachmentViewer/onClickRotate
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:59 +02:00
Alexandre Kühn 513067d4e2 [IMP] mail: introduce AttachmentViewer/onClickPrint
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:59 +02:00
Alexandre Kühn a1b22ae0b5 [IMP] mail: introduce AttachmentViewer/onClickPrevious
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:59 +02:00
Alexandre Kühn 1d7a4b7891 [IMP] mail: introduce AttachmentViewer/onClickNext
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:58 +02:00
Alexandre Kühn 53fcbb6a5d [IMP] mail: introduce AttachmentViewer/rotate
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:58 +02:00
Alexandre Kühn 1a26d41357 [IMP] mail: introduce AttachmentViewer/print
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:58 +02:00
Alexandre Kühn 3a7ad52857 [IMP] mail: introduce AttachmentViewer/previous
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:58 +02:00
Alexandre Kühn d54ba604db [IMP] mail: introduce AttachmentViewer/next
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:57 +02:00
Alexandre Kühn e4b1e28c48 [IMP] mail: introduce AttachmentViewer/onLoadImage
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:57 +02:00
Alexandre Kühn 9b1bb1f64a [IMP] mail: introduce AttachmentViewer/onClickVideo
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:57 +02:00
Alexandre Kühn 3fe0c9500b [IMP] mail: introduce AttachmentViewer/onClickImage
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:57 +02:00
Alexandre Kühn 2ebf060ff1 [IMP] mail: introduce AttachmentViewer/onClickHeader
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:56 +02:00
Alexandre Kühn ffd5e08d64 [IMP] mail: introduce AttachmentViewer/onClickDownload
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:56 +02:00
Alexandre Kühn 01472c8234 [IMP] mail: introduce AttachmentViewer/onClickClose
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:56 +02:00
Alexandre Kühn 2148d2d77d [IMP] mail: introduce AttachmentViewer/onClick
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:56 +02:00
Alexandre Kühn 591f3da27e [IMP] mail: introduce AttachmentViewer/close
Task-2579306

Part-of: odoo/odoo#88152
2022-04-07 14:20:55 +02:00
Kamen Zhekov b88e7aba8a [IMP] web_editor: improve video embed regexes (youku, dailymotion)
The regex patterns for dailymotion and youku were too permissive and
not specific enough for the way they were intended to be used.

The new regexes should correctly isolate the video ID from the URL
string and cover all embedding needs for the two providers.
There are also new test cases for specific embed URL variations.

For the initiating discussion and PR, see following link:
https://github.com/odoo/odoo/pull/44537#discussion_r753250276

task-2696033

closes odoo/odoo#82369

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-04-07 14:20:26 +02:00
Brieuc-brd 02983e34f0 [REF] mail: FollowButton, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2818019

closes odoo/odoo#88189

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-07 13:24:24 +02:00
Benoit Socias 768db8390d [FIX] website, website_payment: exclude Donation snippet from cache
Since [1] the CSRF token used by the donation snippet's form did end up
being cached for new visitors that did not have a session id yet.
This made the validation of the token fail when using the form because
the token from the very first new visitor on the worker was reused.

After this commit pages that contain a Donation snippet are not cached
anymore in order to always get a fresh CSRF token - similarly to what is
done for the form snippet.

When using incognito mode the csrf token is sometimes not recognized
during navigation to the donation payment page.
Simple sequence to reproduce it:
- drop a Donation snippet on the Home page
- use Firefox and do not log in
- in normal browser, select 25 then press Donate Now
- open an incognito browser, select 50 then press Donate Now
=> 400 Bad Request
Alternative (any browser):
- open page with Donation snippet in incognito window
- remove session id from cookies using developer tools
- close window
- reopen page in a new incognito window
- try to donate
=> 400 Bad Request

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

opw-2774065

closes odoo/odoo#88184

X-original-commit: 16c9b103195f342f8bcca928a53121dbe4480d58
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-04-07 13:24:20 +02:00
Michael Tietz 6e96a41cc8 [FIX] core: make one2many empty search use EXIST
This speeds update the peformance of searching empty one2many fields

closes odoo/odoo#88176

X-original-commit: a7679d246ae43bf81fd8b279008b57dbdc1bba05
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-04-07 13:24:13 +02:00
Michael Tietz 42054bd898 [CLA] Michael Tietz mtietz@mt-software.de
X-original-commit: d0967995501292c2e720b9a23b09563cd6057fe0
Part-of: odoo/odoo#88176
2022-04-07 13:24:13 +02:00
Arnold Moyaux 658391f8c9 [FIX] purchase_requistion: adapt report to agreement
In case of purchase agreement, call for tender still appears everywhere
and it's confusing for the user in case of purchase agreement. It would
be better to create another action to have a correct pdf name and report
name but it will be modify in master and we could keep a minimal diff
here.

Also the conditions where not present, so the report could be hard to
communicate to a supplier. Same for the agreement deadline

closes odoo/odoo#88164

X-original-commit: c3b9de36e40c24d0bb521ec0f161d4415b1d86ff
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-04-07 13:24:07 +02:00
Rahul Prajapati ac3c857a57 [FIX] mail: html tags visible for a split second at channel creation
Before this commit:

When you create a new channel HTML tags are visible in Autocomplete text area
for a split second

After this commit:

Added prevendDefault for the autocomplete select event to stop it's defaullt
behaviour as changing the autocomplete text area's value by the selected item's
value

Task-2792365

closes odoo/odoo#88148

X-original-commit: cc11accfeca4bee0f4a364bf59b6311a99855c2b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-07 13:24:04 +02:00
Jorge Pinna Puissant 155ec0366d [FIX] web: error when closing action Dialog
Before this commit, when closing an action Dialog ( when the action is
wowl ) an error was raised. This occurs because we use the
LegacyAdaptedActionDialog, and an old function is called.

closes odoo/odoo#88118

X-original-commit: a6e45c53642003243e8a0f498e69ffddcac6e086
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-04-07 13:23:59 +02:00
Ipsita Borisagar 4853444dca [FIX] im_livechat, mail: hide call buttons for chat with visitor
Before this commit:

In Discuss topbar, call buttons are added to allow call and video between
channel members. Those buttons were also added to live chat channels but any
voice call or video call features are not available for visitors.

After this commit:

Call buttons will not appear in Discuss top bar for live chat channels.

Task-2744224

closes odoo/odoo#88105

X-original-commit: 1fd8af1a30abbe65fd4266c2fb4793ea2a06fab5
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-07 13:23:55 +02:00
Antoine Guenet ff422df492 [FIX] mass_mailing: prevent use of unsupported image transform option
The image transform option uses the `transform` CSS property, which is
very poorly supported in email clients. This hides that option so as to
avoid bad surprises.

task-2802705

closes odoo/odoo#88052

X-original-commit: 611c9a2aa65f3c6f9e1c0780cb9177bc1e67513d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-04-07 13:23:51 +02:00
Alexandre Kühn 02b8b4edff [IMP] mail: introduce AutocompleteInputView
With all its identifying fields

Task-2817076

closes odoo/odoo#88035

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-07 13:23:47 +02:00
Yannick Tivisse 8e682dd591 [FW][FIX] hr_holidays/hr_recruitment: Write correclty on groups
Purpose
=======

This is the optimal way to add a user on a group, to avoid calling the
contraint method _check_one_user_type on all the users from the group

closes odoo/odoo#87998

Related: odoo/enterprise#25908
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-04-07 13:23:41 +02:00
Arnaud Joset 44dc3910e2 [IMP] sale: create a JS mixin to update all discounts value
Before this commit, the ProductDiscountWidget (sale.product_discount) worked by overriding the reset method.
The main drawback is that the reset method is called whanever a field on the line is changed.
This commit rely on _onFieldChanged that allows to target single change. A small mixin is created to allow working with different kind of fields of the SOL.

taskid: 2568007
2022-04-07 13:23:09 +02:00
Arnaud Joset 9ac53b07db [IMP] sale,sale_management: adaption for subscription override of SO
Before this commit, the sale module could not be used to manage subscriptions in an override.
This commit adapts the sale module to https://github.com/odoo/enterprise/pull/21825

taskid: 2568007
2022-04-07 10:57:49 +02:00
John Laterre (jol) ee5687a04e [FIX] account: display correct price_unit with 100% taxes
Currently, when modifying an invoice line and setting taxes
(price included) for 100%, the price_unit field will
be displayed as 0.

This is incorrect and is being fixed here.

opw-2793284

closes odoo/odoo#88180

X-original-commit: 674eaa3bc10210d34a02145529516da1fa1c1b66
Signed-off-by: Laurent Smet <las@odoo.com>
2022-04-07 09:46:51 +02:00
David (dafr) 227c5d13dc [FIX] stock_account: Return product with revaluation layer
How to reproduce:
1- Create Product Category "PC" AVCO|FIFO Automated.
2- Create Storable Product "P" with product category PC and unit cost to 1.
3- Create SO with 10 units of P.
4- Create PO with 10 units of P and unit cost of 2.
    Delivery of the SO should now have 2 IV layers, with one being "Revaluation of XXX (negative inventory)"
    Global IV of P should be 0 qty, 0 value.
5- Return the delivery order of SO.
6- Open valuation of the return

Error: The value is 0, should be 20
In `_get_price_unit`, `price_unit` is taken on the last svl of the origin_returned_move_id, in our case it's the revaluation layer.
`_get_price_unit` now take all svls of origin_returned_move_id into account.

OPW-2784033

closes odoo/odoo#88177

X-original-commit: bfd1a06b054dcc115f7fb0937db98812f4a6d5dc
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: DavidFesquet <dafr@odoo.com>
2022-04-07 08:50:47 +02:00
Carlos Dauden 125ff2cdae [FIX] account_check_printing: Duplicate journal generate duplicate check sequence.
Unnecessary call to _create_check_sequence because is called in create method and create is called in supper().copy()
TT35608

closes odoo/odoo#88159

X-original-commit: 2f83737b8eb4f2b378cf4d6a6348d9ba15200561
Signed-off-by: Florian Gilbert <flg@odoo.com>
2022-04-07 07:58:12 +02:00
John Laterre (jol) 9fce02019d [FIX] tools: prevent errors when exporting Vendor Bills
This fix prevents the `/Annot` key from a PDF PageObject
to cause errors during its handling by PyPDF2.

opw-2811793

closes odoo/odoo#88182

X-original-commit: 1c0fc5b20efb9e5829447f97480d0813c6c9e367
Signed-off-by: William André (wan) <wan@odoo.com>
2022-04-06 21:58:02 +02:00
Romain Derie 5a8d6c351b [IMP] website, test_website: avoid a query on res_company_user_rel
Manual forward port, commit was lost from 15.2 to master. Either it
seemed not needed after the httpocalypse refactoring, or was simply
lost during the rebase.

-----

We can remove an useless SQL Query for public user on every single page
serve, if we directly set the website's company_id in the available
company_ids of the public user.

Indeed, the public user from a website always have the same company_id
as the website.

We can then do that directly and bypass the next line which will
always be true in the case of the public user, making a read for
nothing.

task-2774979

closes #85419

X-original-commit: c95ab6f

[1]: https://github.com/odoo/odoo/commit/728ade674cb12c64718efda56b0d5d542e319cba

closes odoo/odoo#87856

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-04-06 19:32:44 +02:00
Romain Derie aa1c1b0bcb [FIX] website, *: correct wrong query count after httpocalypse
*: test_website, website_blog (test perfs)

An error regarding tests was not catch during httpocalypse [1] review.
The test query counts were lowered in website by 2 everywhere, but it
shouldn't have as there were no SQL perf improvement from this
refactoring regarding website.
The query count actually decreased because the test-only SQL Savepoints
got divided by 2, probably thanks to a low level test improvement in
the PR.
But outside of tests, there were no SQL Query gained.
This should have been reflected in the `EXTRA_REQUEST` variable
instead.

Before:
Savepoint > Rollback > Savepoint > [Actual SQL Queries] > Rollback
After:
Savepoint > [Actual SQL Queries] > Rollback

It is important to fix it because:
1. (Minor) There is a de-sync between the query count in the test and
   the actual query count (in the logs outside of tests), making it
   hard to figure.
2. (Major) Some controller got then wrongly lowered to 0 query counts
   instead of 2. An incoming PR in master would then make those tests
   expects negative query counts, which doesn't make any sense.

[1]: https://github.com/odoo/odoo/pull/78857
Note that the exact commit can't be found by bisect as those don't work
on their own, DB can't be started due to circular import.

Part-of: odoo/odoo#87856
2022-04-06 19:32:44 +02:00
mafo-odoo ec1a7423d4 [FIX] sale,l10n_de_sale: Add the proforma in the title for din5008 sale report
Step to reproduce:
	- install sale, accounting and l10n_de
	- activate proforma in sale settings
	- set the template to external_layout_din5008 in the settings (use developer mod)
	- create sales order or quotation
	- print it as a proforma

Current behavior:
	- the proforma is missing from the title in the document

Behaviour after PR:
	- the proforma is in the document title

The l10n_de_sale module was missing the case scenario of a proforma sales report and the sale module only
gives the information of a proforma report in the xml context. Then we add the case scenario and propagate
the proforma info from the sale module also in the python context using the proforma variable.

opw-2796603

closes odoo/odoo#88153

X-original-commit: 14e0f84abeba8453930522047df3610940d6aa9a
Signed-off-by: William André (wan) <wan@odoo.com>
2022-04-06 18:37:49 +02:00
Pouya Malekinejad 9353f999f5 [FIX] tests: x2m modifiers not working in subviews in Form tests
closes odoo/odoo#88139

X-original-commit: 1d46b388aeeea3f87dff683d738c408496d958bd
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-04-06 18:37:46 +02:00
william 3155c3e425 [IMP] core,*: add helper for name_search
Most of the extensions of `_name_get` are very similar and only want to
search for the given string in multiple fields.
A lot of extensions also don't take into account the negative operators.
Some implementations were also really outdated and needlessly
complicated.

closes odoo/odoo#86588

Related: odoo/enterprise#25608
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-04-06 18:37:39 +02:00
Andrea Grazioso (agr-odoo) d5f303f84f [FIX] sale: undiscounted amount computation with tax included price
Enable discounts
Have a price included tax 10%
Have a product with sales price 100$
Make a SO adding the product, the price incl. tax and a 1% discount
Open the portal page of the quotation

In the left recap sidebar the price before discount is reported to be
100.10 while it should be 100.0

opw-2759804

closes odoo/odoo#87418

X-original-commit: db6994c2ac991822014d168022c854ba75f3095f
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-04-06 17:39:40 +02:00
Florian Damhaut 2ba4e04953 [FIX] hr_holidays: Only show time off of current company's employee
Step to reproduce (Traceback):
- Be in multi-company
- Create a time off type with duration in hour and no company_id
- Create an instance of this type on company A with a user linked
 to company A (need access to both)
- Switch to company B

Current Behaviour:
- Traceback
- Cannot fetch user's calendar if content of company A is not checked
 for convertion from Days to Hour

Behaviour after PR:
- We only fetch if the user related to the leave is in allowed_companies
 -> only fetch if the user data is available
- This is also true if duration is in Days/Half-Days (GMF Approved)

opw-2749258

closes odoo/odoo#88104

X-original-commit: cb5942e5461ec0fc1fa54cd249de23e4f28f8692
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-06 16:46:24 +02:00
Brieuc-brd 2c0a76b6ad [IMP] mail: DropZone, use the correct primary colors
This commit applies the correct primary colors to maintain consistency
with the overall design.

task-2817682

closes odoo/odoo#88088

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-06 16:46:11 +02:00
Brieuc-brd f20cef41e9 [REF] mail: DropZone, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2817682

Part-of: odoo/odoo#88088
2022-04-06 16:46:11 +02:00
tsm-odoo 95354538c0 [IMP] mail: remove beforeEach from test utils
task-2792108

closes odoo/odoo#88083

Related: odoo/enterprise#25928
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-06 16:45:59 +02:00
Ivàn Todorovich 98ad5ee893 [FIX] mrp: _compute_quantities_dict
``get`` default is a dict that gets evaluated to be sent as parameter,
causing an unnecessary read on the component's computed fields.

The read should only happen only if we don't have a value in ``res``.

closes odoo/odoo#88050

X-original-commit: 4d16869e5c0a627dfe32ad1c8f54e83373dc3c8b
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-04-06 16:45:55 +02:00
Ipsita Borisagar c622161c9a [FIX] mail: channel description modification
Before this commit:

For guests and portal users, a separator(differentiates channel name and
description) in the thread view topbar is displayed even if there is no description.
And when portal users are trying to write/edit channel description at that time
access error is generated.

After this commit:

A separator will only be displayed when there is a description and portal users
will not be able to write/edit channel description as they don't have rights.

Task-2664843

closes odoo/odoo#87999

X-original-commit: 84604910af931131fd10ad37787a803c8905d55c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-06 16:45:51 +02:00
Laurent Smet 5883f0a84c [IMP] account: foreign currency reconciliation (Exchange diff entries on partials)
* Previously, when reconciling  journal items in multi-currencies, the exchange difference entry was created only on the full reconciliation. It will now be created directly at each partial to ensure the ratio between amount_residual_currency and amount_residual is always kept identical.
* Also when reconciling two lines, one with a foreign currency and one expressed in company currency, the reconciliation is now made based on the foreign currency.

==== RATIONALE ====

This patch allows to fix the following use cases (among others)
1) When everything is expressed in foreign currency, the reconciliation is made in that currency:

Suppose EUR is the foreign currency and USD is the company currency. Reconciling:
L1: 120 EUR 60 USD (rate 2:1)
L2: 240 EUR 80 USD (rate 3:1)

..leads to a partial of 120 EUR and min(80, 60) = 60 USD

After the reconciliation, L1 is fully matched but L2 is still open with 120 EUR but only 20 USD.
This is the first problem is the current reconciliation because L2 is supposed to have a rate 3:1 so the residual amount should be 120 / 3 = 40 USD.
Since the rate is no longer consistent on L2, the user will probably close the reconciliation by using another line in EUR or will close manually the reconciliation with 20 USD but without any additional exchange difference journal items explaining where this unconsistency comes from.

2) When the current lines are mixing multiple currencies, the reconciliation is made using the company's currency.

In some countries like Mexico, Ethiopia or Costa Rica, the customer is free to pay an invoice using the company's currency instead of the foreign one.
So, suppose USD is the foreign currency and MXN is the company currency.
The invoice is expressed by:
L1: 120 USD 60 MXN (rate 2:1)
If the customer is paying at a date in which the rate is 3:1, he is free to pay
either L2: 120 USD 40 MXN (rate 3:1), either L2: 40 MXN.
In the second case, he is expecting the invoice to be fully paid because its paiement is equivalent to 120 USD at the payment date.

In Odoo, the second case led to an open balance of 20 MXN and the invoice was not completely paid.
Even this situation could be easily fixed by a manual write-off, this makes the Mexican payment EDI very complicated to fullfil correctly because the government is expecting a complete matching between the invoice and the payment.
When the customer is paying multiple invoices or the invoices are paid using multiple payments, the currently generated mexican EDI file in Odoo was wrong.

==== REFERENCES ====

Original idea suggested by hbto@vauxoo.com. Thanks for the contribution and patience of the many persons having, at some point, helped on that.

github issue: https://github.com/odoo/odoo/issues/37469

closes odoo/odoo#84201

Task: 2669371
Related: odoo/enterprise#24268
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-04-06 16:45:41 +02:00
Jigar Vaghela aa43799ed9 [ADD] l10n_in_edi: Send invoice to Indian Government
New module to send invoice to Indian Government using IAP service

Task 2179664

closes odoo/odoo#79995

Related: odoo/enterprise#25899
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-04-06 16:45:31 +02:00