Commit Graph
146057 Commits
Author SHA1 Message Date
Xavier BOL (xbo) 83fc2139a2 [IMP] base_setup,project: remove module_pad field in settings
Since the etherpad is removed from #76467, the module_pad field is
useless in the settings for Notes and Project apps.

This commit removes this field.

task-2643861

closes odoo/odoo#78830

Related: odoo/upgrade#2958
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-22 17:34:36 +00:00
Jeremy Kersten 300954d8c4 [IMP] base: auto resize attachment to 1080p
After some analyze on a lot of customer databases, seems like most of the time
their are performance probleme, and big store, it is due to  a lot of big file
uploaded without reason. E.g. barcode, photo, ... a small one will be enough.

Now, we decided (in stable) to auto resize these pictures to 1920x1920px
by default and compress it with a quality of 80 when the source is bigger.

You can bypass this behaviour in your specific use case,
using a context key: 'image_no_postprocess' set to True.

You can disable the resize (and quality implicitely)
using an icp: 'base.image_autoresize_max_px' set to '0'.

You can change the default resize (1920x1920) format using an icp:
'base.image_autoresize_max_px' set to '<width>x<height>' (e.g. '1024x768')

You can change the default quality (80) using an icp:
'base.image_autoresize_quality' with a value between 0 and 100 where 0 skip it.

You can change the type of file that will be post process using icp:
'base.image_autoresize_extensions' (subtype of the mimetype comma separated).

Api of image has not be changed in this commit, only refactored to allow to
work with image directly without the need to encode/Decode in base64 the raw.

We decide to keep 1920x1920 by default instead of 1080p to avoid to resize
portrait picture in 1080px and stay consistent with field image_1920 that
return a 1920px image for width or height whatever the orientation.

+ fix some lint diff for ci style in master

closes odoo/odoo#78556

X-original-commit: d9ce0507960f247e1187baf7bd8399f90be237aa
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-10-22 17:34:29 +00:00
Xavier-Do 74ff542278 [IMP] base: avoid setup_models() when creating custom selection
There exists an optimization when creating fields to avoid calling
`setup_models()` for fields when creating a custom model, since the
latter already calls `setup_models()`.

We add the same optimization for field selections, so that creating a
custom field with selections only calls `setup_models()` once.  Note
that both optimizations are combined when creating custom models with
selection fields: `setup_models()` will be called once for all.

closes odoo/odoo#78514

Related: odoo/enterprise#21746
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-10-22 17:34:19 +00:00
Xavier-Do a6c40de0f9 [IMP] base: batch creation of custom models
Part-of: odoo/odoo#78514
2021-10-22 17:34:19 +00:00
Raphael Collet 76f699ca0b [IMP] base: batch creation of custom related fields
Before this commit, trying to create a field related to another field in
the same batch raises an error, because the computation of the field
'related_field_id' cannot find the target field in the registry.

The new approach consists in getting the target field from the database
instead.  It works when creating fields in batch, because all records
are inserted into the database before the field is computated.

This costs extra queries, but it allows to batch field creation and
avoids multiple calls to setup_models() when creating a model with
partner field in Studio. (see odoo/enterprise#21746)

The creation of a simple custom related field (related="x.y") costs 3
additional queries to determine the target field:
 - 2 queries to get a given field on a given model
 - 1 query to get the first field's comodel

Part-of: odoo/odoo#78514
2021-10-22 17:34:18 +00:00
Xavier-Do e966beb3ca [FIX] base: testing overhead of related field creation
The real overhead of creating a related field is actually two queries:
- one query in update_db_related, the purpose of this test
- one more query for _compute_related_field_id in flush()

With the previous version of this test, one prefetching done in the
first create was not present in the second create since it was in cache.

The fix clears the caches to make the creation of both fields in the
same situation, such that query counts are compared in a fair way.

Part-of: odoo/odoo#78514
2021-10-22 17:34:18 +00:00
Xavier Morel b4b260b916 [IMP] base: batch creation of custom fields
Registry updates can be quite expensive (on the order of a second).
When creating new fields, this update is performed *for each field*,
leading to sub-par performances when bulk-creating fields.

Also remove `_existing_field_data` which has been unused since
9afce4805f, and the `clear_caches`
set up for that purpose.

Part-of: odoo/odoo#78514
2021-10-22 17:34:17 +00:00
Xavier-Do 4f3b1653de [FIX] profiling: avoid crash with thread pools
When using a profiler manually inside the code, and longpolling uses
this part of the code, an error will appear on runbot since gevent
server cannot be profiled properly.
This fix mitigate the issue by disabling the profiler automatically in
this case.

Part-of: odoo/odoo#78514
2021-10-22 17:34:17 +00:00
Xavier-Do 0e2b2c9c8a [FIX] core: avoid useless setup_models at install
When installing a database with all modules in enterprise,
install take around 20 minutes and almost half of that is spent in the
`setup_model` method.

There is actually two calls to `setup_models` for each module.

One of them was introduced in b5c50fa824
and only looks useful when upgrading a module with migration scripts.

This first fix proposes to skip `setup_models` if the module state is
`to install`.

closes odoo/odoo#78808

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-10-22 15:04:43 +00:00
Alexandre Kühn e8f1d86c95 [REV] mail: memleak model manager in tests
This reverts commit 4c18e2d09a372e975c2133516cc9bdd1880b2c1b.

This commit makes a barcode qunit test crash non-deterministically,
but quite frequently (50% of the time).
At the time of reverting this commit, we still don't know how this
commit affects this barcode test, but it's urgent to resolve by
revert and understand more in depth what are the causes.

closes odoo/odoo#78827

X-original-commit: 29eb6d3e5ea859955290a2c3f53908b80e16f03e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-22 13:07:46 +00:00
Odoo's Mergebot b45dfa143b [MERGE] website_slides(_*): globally improve usage of eLearning, notably in backend
Purpose
=======
This commit is enhancing the website_slides module.

Specifications
==============
It changes placeholders for certain fields, it changes helpers in some
of the views.

It updates some of the main views of the menus and corrects wordings
inside of them.

It activates the Graph and Pivot views for the reporting of
Courses, Reviews and Quizzes.

It cleans up some of the measures inside of the Pivot and Graph views
of each menus where it is available.

It also merges 2 models: slide.slide.link and slide.slide.resource into
slide.slide.resource with a type Selection field.
This is done in order to create a single table for the additional
resources of a Content.

It also improves the front-end of the module with minor changes.
It fixes the problem of long names inside of breadcrumbs.
It also adds a message when there is no leaderboard in /profile/users.

task-2597345

closes odoo/odoo#75646

Related: odoo/upgrade#2784
Related: odoo/enterprise#20480
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-22 13:09:18 +02:00
Thomas Josse 63285ce026 [ADD] website_slides: merging slide.slide.link into resource
Purpose
=======
This commit is used to merge 2 models into 1: `slide.slide.resource`
and `slide.slide.link`

Specifications
==============
These models are merged in order to create a unique table for the
*Additional Resources* of a Content.

In order to do that, we merged the models into `slide.slide.resource`
that will contain either a link or a file.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Thomas Josse 255cdfe4f6 [IMP] website_profile: improve profile display when no leaderboard
Purpose
=======

This commit improves the front-end when we have no leaderboard yet

Specifications
==============

It hides the `Show All` button when we have no leaderboard.
It also modifies the leaderboard view if a user manages to get to it.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Thomas Josse ef4ad5a9d4 [IMP] rating: changes the conversion of the ratings
Purpose
=======

This commit changes a conversion variable
`RATING_LIMIT_SATISFIED` in order to follow a new conversion:
> 5/4 := Satisfied
> 3 := Okay
> 2/1 := Dissatisfied

Specifications
==============

This commit only changes the variable in order to limit the
modifications made to the `rating` module/models.

This is done in order to change the faces displayed for each review/rating
without impacting the statistics. The ratings/reviews will have the same values
as before but will only get a different conversion if higher than 4.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Thomas Josse 91db19c187 [IMP] mass_mailing_slides / survey / website_forum / website_[sale_]slides_* : enhancing the views in eLearning
Purpose
=======
This commit is enhancing the website_slides module.

Specifications
==============
It changes placeholders for certain fields, it changes helpers in some
of the views.

It updates some of the main views of the menus and corrects wordings
inside of them.

It activates the Graph and Pivot views for the reporting of
Courses, Reviews and Quizzes.

It cleans up some of the measures inside of the Pivot and Graph views
of each menus where it is available.

It also merges 2 models: slide.slide.link and slide.slide.resource into
slide.slide.resource with a type Selection field.
This is done in order to create a single table for the additional
resources of a Content.

It also improves the front-end of the module with minor changes.
It fixes the problem of long names inside of breadcrumbs.
It also adds a message when there is no leaderboard in /profile/users.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:16 +00:00
Bruno Boi 6fe52c9012 [FIX] web: adjust FullCalendar for luxon v2
See preceding commit

closes odoo/odoo#78797

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-22 09:52:44 +00:00
Bruno Boi d2cdcd9058 [IMP] web: update luxon from 1.25.0 to 2.0.2
See [upgrade guide](https://moment.github.io/luxon/#/upgrading?id=_1x-to-20)

Part-of: odoo/odoo#78797
2021-10-22 09:52:43 +00:00
Jeremy Kersten c9fb92f996 [FIX] base: support tail text after a comment
This commit fixes the case where you have some text after a comment.
Until know, we miss it. Now we render the tail part.

```
<t>
        <!-- HIDE Text 1 -->
        Text 1
        <p>SHOW Text 2</p>
</t>
```

After the fix, Text 1 is correctly rendered

This commit fixes #76628

closes odoo/odoo#78782

X-original-commit: 566360b07b4ff6c7290f264d9064400df2b06ca5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-10-22 08:38:37 +00:00
Rémy Voet (ryv) de09253d53 [REF] stock,mrp: move assets to be lazier
Move some file to other asset bundle to be load
less.

task-2643681

closes odoo/odoo#77174

Related: odoo/enterprise#21172
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-10-22 08:38:33 +00:00
Rémy Voet (ryv) 068dadcd09 [REM] mrp: remove unused widget bullet_state
During the refactor for v14 the bullet_state was not used
anymore (used for product_availability of workorder).

task-2643681

Part-of: odoo/odoo#77174
2021-10-22 08:38:33 +00:00
Krunal Trivedi b39a2ca3a8 [FIX] mail: fix attachment removed when editing message
when a message or logenote with attachment(s) is edited attachment gets removed
even if user does not want to delete attachment.

after this commit,
editing message text will update only message and attachment will not be removed.
attachment will be deleted only when user wants to delete it

closes odoo/odoo#78785

X-original-commit: dbd6cf34d3fcf9d66657b68766d2a25ee0d2515b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-21 22:18:44 +00:00
Kishan Gajjar 27e0307c07 [FIX] web_editor: link widget should respect native bootstrap class
Before this commit, When you try to edit the link then the link widget is
removing 'btn-block' class from the class list of the link node.

After this commit, the link widget will allow using 'btn-block' class.

closes #78511

closes odoo/odoo#78783

X-original-commit: 888687b487e95b4bf4fb080118b5eb945c8ab724
Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
2021-10-21 19:09:52 +00:00
Christophe Monniez 01949f9419 [FIX] packaging: remove mako
Mako is not used anymore for a long time.

closes odoo/odoo#78781

X-original-commit: fb9f89afbc7a22e82309150617e8b5de5c995ff9
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-10-21 19:09:48 +00:00
Christophe Monniez f446e2fa19 [IMP] packaging: sort requirements
X-original-commit: 32f3e358853c24f4bb94d464bcf10629f8613380
Part-of: odoo/odoo#78781
2021-10-21 19:09:47 +00:00
Christophe Monniez 38deea6730 [IMP] requirements: adapt to latest focal versions
With the release of Debian Bullseye the time has come for the balancing
act by trying to update the requirements.

The constraints are the following:
    * Stick as close as possible to python3-* Debian packages versions
      of the current Debian stable.
    * Same but for the Ubuntu LTS version.
    * When one of the above package is patched by Debian or Ubuntu
      maintainers, set the upstream version that includes the patch if any.

Also, as support for python < 3.7 is dropped, some cleanup can be done.

The `reportlab / pillow` combo is a special case:
    * Pillow has to be updated to 8.1.2 as this version includes the
      security patches that were added to Ubuntu package 7.0.0 (Focal).
    * Reportlab crashes with 8.1.2 with version prior to 3.5.54 [0].
      The problem does not occur on Ubuntu Focal as both versions from
      the Ubuntu packaging are compatible.

So the reportlab 3.5.59 is chosen as it's the Debian Bullseye version
and to avoid multiple lines for a few minor versions.

[0] https://hg.reportlab.com/hg-public/reportlab/rev/0cf382dab63b

X-original-commit: 794677fb6a3391379200eb2144a6ed372e89c17a
Part-of: odoo/odoo#78781
2021-10-21 19:09:47 +00:00
Louis Wicket (wil) 7c76f29111 [FIX] mail, web: properly add messaging menu to the systray
This commit intends to fix two strange bugs encountered while trying to
push a new component into the systray menu:
- MessagingMenuWidget and RtcActivityNoticeWidget were removing their
parent node via DOM manipulations when attached in the DOM. This caused
a crash when adding other items to the systray menu since the deleted
nodes were actually managed by OWL.
- The t-foreach directive in the navbar used indexes as the t-key, which
led mapping items subsequently added to wrong templates.

closes odoo/odoo#78784

X-original-commit: 5f0f80da4fc951954d253c9e45defd591605f556
Related: odoo/enterprise#21829
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Ooming <oomsveta@users.noreply.github.com>
2021-10-21 18:02:06 +00:00
Kamen Zhekov 3739d74afe [IMP] website - add noindex when not browsing configured domain
Description of the issue/feature this PR addresses:
Currently, search engines index a SAAS-hosted website twice
(once for the actual domain, and once for the .odoo.com domain)
which is something that should be preventable.

Desired behavior after PR is merged:
If a domain name is configured, and the website is accessed
through a different domain than the configured one, the noindex
tag appears, preventing crawlers from indexing it..

task-2418904

closes odoo/odoo#78425

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2021-10-21 16:54:43 +00:00
Nasreddin Boulif (bon) ab523354fa [FIX] website_sale: Display pricelist price if no price_unit
Steps to reproduce:

  - Install website_sale module
  - Enable discount and advanced pricelist in settings
  - Create product with sale price 0$ and set a website in
  - eCommerce + publish the product
  - Create pricelist PPP with Discount Policy as
  - "Show public price & discount to the customer" and selectable in the website
  - Go to the product and set an extra price of 10$ for the new pricelist
  - Go to the product in the eshop and select the pricelist PPP
  - Add the product to the shop cart

Issue:

  The price displayed is 0$ instead of 10$.

Cause:

  Since price_unit equal 0$, not possible to calculate the discount and
  therefore using the 0$ value.

Solution:

  Use price of pricelist in case 'discount_policy' is 'without_discount'
  and price_unit equal 0$.

opw-2652192
Forward-Port-Of: #78570

Cherry pick of 32d34ffb04b3c6a8397c8ff7eb4e8a3dd9fb8a95

closes odoo/odoo#78778

X-original-commit: f34e441578bd2ba93dff1feffe6cafee633b9d32
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-10-21 15:47:31 +00:00
Jerome (jev) 43ccf2e12f [FIX] point_of_sale: Show warning when pricelist company missmatches
This commit ensure the pricelists are properly configured before launching a pos session.

Steps to reproduce:
- Have a V13 with point_of_sale
- Have minimum 2 companies A & B
- Select both companies in the company selector
- Go to Settings / General Settings
  - Point of Sale
    - Check Pricelists
- Go to Point of Sale
  - Open a pos.config PC
    - Set a Pricelist PL as Default Pricelist
- Go to Point of Sale / Products / Pricelists
  - Open PL
    - Set a company (must be different than PC)
- Go to Point of Sale
  - Click "New session" on PC
--> Traceback

In V13, the traceback shows as "Traceback not available"
As from V14, the traceback is shown properly

A variant would be to start the session before changing
the pricelist company then click on "Resume" on PC

closes odoo/odoo#78767

X-original-commit: 86381c60214d210a42f736261a54e32042eedaba
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-10-21 15:47:27 +00:00
Romain Derie 7d8a8ddea0 [IMP] website(_forum/_profile): remove _get_http_domain method
Before Odoo saas-14.4, one should call `_get_http_domain()` on website to get
its domain. Indeed, that method was in charge of cleaning that domain, as it
was done with commit [1].

Since Odoo saas-14.4, that cleaning is automatically performed on domain before
saving it into database, thanks to commit [2].

Thus, we can now remove the `_get_http_domain()` and use directly the domain as
it is considered clean.

Note that migrated databases coming from version older than Odoo saas-14.4
could still have an incorrect domain (trailing slash, no scheme..).
This will be handled during migration with [3].

[1]: https://github.com/odoo/odoo/commit/3ad775aab717b395a5d11527aeb3596af66afa99
[2]: https://github.com/odoo/odoo/commit/042c95b0219bb0aa13e73385e092fa76ff1a1b0a
[3]: https://github.com/odoo/upgrade/pull/2951

closes odoo/odoo#78766

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-21 15:47:22 +00:00
Nidhi Patel f5db920f0b [FIX] project,web: fix project status color in kanban progress bar
Currently, projects that are 'on hold'  stage are represented in grey in
the kanban progress bar while the colored dot on their card is in blue.

In this commit, we change the color of the 'on hold' stage into 'info'
instead of 'muted'. After this projects that are 'on hold' are display
blue in the kanban progress bar as well.

Task-Id:2633273

closes odoo/odoo#78761

X-original-commit: 0886c10d5f276aca2539060ffaa047780a408354
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-21 15:47:14 +00:00
Kevin Baptiste 497c2b9ab8 [IMP] hr: show employees on Department form
Show an "Employee" stat button on the department form view.

closes odoo/odoo#78680

Taskid: 2672986
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-21 15:47:10 +00:00
Aurélien (avd) a0ea00c8dd [FIX] stock_valuation_layer: auto_join product_id to avoid bloating queries
The active field of stock_valuation_layer is related to product_id.active.
Adding auto_join = True avoids bloating search/read_group queries in
expression.parse().

closes odoo/odoo#69207

X-original-commit: 2526c640969f462c18ab8a3da7aa0a4e8ed871f8
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-10-21 15:47:00 +00:00
Hardik Prajapati 11228a2c7c [FIX] project: align the project and task name to the right in the activity view
purpose of this commit is to display the project name and task
to the right of the div in the activity view.

before this commit, the project name and task displays next to
the many2many_tags div in the activity view.

closes odoo/odoo#78738

Taskid: 2646204
X-original-commit: bb9734fbf761c3c11be0226cbe4da9d764ccbf74
Related: odoo/enterprise#21817
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-21 11:09:04 +00:00
Leonardo Pavan Rocha 5664bda0f7 [FIX] base: use address_format in layout designer
In task-2355704 changes were made to the pdf layout designer to allow more
flexibility when setting company data. However, for the default values of both
company_details and report_footer, the data wasn't being escaped, therefore
offering security risks. Also, they didn't take into account the address_format
when computing the default value. This PR implements Markup usage in the html
fields and fixes _default_company_details to use the set address_format.

closes odoo/odoo#78725

X-original-commit: 83aeb8fbc3b2a4b39123f756232e34c1ce603299
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-10-21 11:09:00 +00:00
William Braeckman 33f9e1e289 [IMP] hr_skills: update hr_skills wording
Updating menuitem names to avoid mismatches between the menuitem and the
action title.

TaskId-2664863

closes odoo/odoo#78148

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-21 11:08:55 +00:00
William Braeckman c4621c4099 [IMP] hr: update hr plans wording
To avoid mixing both plan and planning in hr plan options it was decided
to reword menus to plan instead of planning.

TaskId-2664863

Part-of: odoo/odoo#78148
2021-10-21 11:08:54 +00:00
Louis Wicket (wil) 92c47e5fbb [IMP] mail: enforce the definition of identifying fields in models
Ensure that all models have their own explicit definition of identifying
fields. Prior to this commit, if a model did not have identifying fields,
the ones in mail.model were used implicitly because of the inheritance.

closes odoo/odoo#78722

X-original-commit: 02fb0c7caaa8a9813e7e78b464710eb772091e44
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-21 09:56:51 +00:00
Tom De Caluwé f81f2a124c [IMP] website: prevent clicking while starting the editor
When visiting a page with enable_editor set to true, the web editor
will be automatically started. However, while the editor is loading,
the end user can still click other buttons in the navbar.

For example, some changes in the web editor require a save and reload
of the current page being edited. After saving, the same page will be
reloaded with enable_editor.

This commit blocks any clicks while the editor is being loaded.

task-2607755

closes odoo/odoo#78721

X-original-commit: 89bdfcd16828e1432900ea46118fd6ddadf96f2d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-21 09:56:47 +00:00
Alexandre Kühn 6f56216533 [FIX] mail: memleak model manager in tests
closes odoo/odoo#78726

X-original-commit: 4c18e2d09a372e975c2133516cc9bdd1880b2c1b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-10-21 08:39:48 +00:00
svs-odoo b60d53fe38 [IMP] stock: inventory_quantity_set own compute
Sets the `inventory_quantity_set` as an editable field (not readonly)
and creates its own compute to avoid to override it each time the
`inventory_quantity` is modify and we set the `inventory_quantity_set`
aside (before this commit, this field new value was always overrided by
the `inventory_diff_quantity` compute).
This is useful when we want to write on the quants from the Barcode App
as we can write on `inventory_quantity` and `inventory_quantity_set` at
the same time.

task-2632818

closes odoo/odoo#78719

X-original-commit: 489e76ade600f7983a9a1976c04529ac542fdd44
Related: odoo/enterprise#21810
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-10-21 07:32:54 +00:00
Florian DamhautandThibault Libioulle 93f529c853 [FIX] sale_timesheet : test fixed price invoiced accounted for twice
Description of the issue/feature this PR addresses:

When using analytical account and invoicing a fixed price sales order
item, which is linked to a project task, where timesheet has been
recorded, the invoice gets double counted into the project revenues -
both as Invoiced and as Other revenues on the project overview
profitability.

Current behavior before PR:

The invoice gets double counted into the project revenues - both as
Invoiced and as Other revenues on the project overview profitability.

Desired behavior after PR is merged:

The invoice gets counted only in the project revenues as invoiced/to
invoice on the project overview profitability.

This commit adds tests to assess this use case is covered.

PR : #78230

opw-2631163

closes odoo/odoo#78646

X-original-commit: ddab279813a71caa2fa7ea081e9cbf0c56ae3613
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Co-authored-by: Thibault Libioulle <tle@odoo.com>
2021-10-21 06:28:51 +00:00
Thibault Libioulle 16ac647544 [FIX] sale_timesheet: fix multiple issues in project profitability
This commit fixes multiple issues in project profitability report.

Steps to reproduce opw-2596224:
- Go to sale
- Make a RFQ for a service product with service_policy set at
delivered_timesheet (Timesheets on tasks), set quantity as 10
- Confirm order and create two invoices for 15%, confirm the two
invoices
- Create a credit note for one of the invoice and confirm it
- Go back to the Sale Order and click on Project Overview
=> Inconsistencies (Downpayment reported twice)
- Add an expense
=> Inconsistencies in expense amount untaxed invoiced
- Add timesheets
- Create an invoice from the SOL
=> Inconsistencies in Other costs, counting the downpayment.

This issue is fixed by :
- Excluding downpayments which are linked to a reversed invoice line
- Use expense amount to invoice and expense amount invoiced separetely
in the project overview.
- Do not report not invoiced SOLs in the expense amount invoiced.
- Exclude negative amounts in analytic account which are linked to
credit notes.
- Include all services and not timesheetes  SOLs linked to project,
project task or project's analytic account in the invoice/invoiced
subquery.
- Remove the unused downpayment column in the subqueries
- Remove unused subquery (relative to downpayment)

PR : #78230

opw-2596224
opw-2631163

X-original-commit: 69c5a55887d67b8852c7c45a52def38f3c742e7d
Part-of: odoo/odoo#78646
2021-10-21 06:28:51 +00:00
Benoit Socias 9b854f5d39 [FIX] web_editor: make class-based colors selectable for custom buttons
Before this commit selecting a class-based color (gray scale,
o-color-1~5) was ignored when configuring a custom button colors.

After this commit the color's class is applied.
Additionally, upon switching between Custom and other types, the custom
UI is now cleaned up.

task-2653874

closes odoo/odoo#78720

X-original-commit: 26d37812f0217ae913c8ddf761bcb26b5c44bff5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-20 17:53:40 +00:00
Benoit Socias 6087585f3b [IMP] web_editor: reset button text styles when customizing button
Before this commit if button text had styles, they would override the
color set by customizing the button.

After this commit button text styles are removed when applying custom
button colors.

task-2653874

X-original-commit: 03c02639f1e92b58a38d8efb620b17761ae2d81d
Part-of: odoo/odoo#78720
2021-10-20 17:53:40 +00:00
Aaron Bohy 9c5fecdf90 [FIX] web: ActionContainer: properly unbind handler
This isn't a problem in production, because the ActionContainer is
never destroyed, but it caused a small memory leak in the test
environment.

closes odoo/odoo#78698

X-original-commit: d01c89d80d58763e45309dbcfbf83f852866982e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-20 15:15:24 +00:00
Aaron Bohy 3feba2da91 [FIX] web: ui service: remove leak in tests
Before this commit, the ui service listened to the "change" event
on several MediaQueryList corresponding to specific window sizes.
However, those event handlers were never removed. Whereas this
isn't an issue in production (services are started once and live
forever), this caused a memory leak in tests, where services are
deployed on demand, test by test.

There is no cleanup function for services (since they live forever
by nature). In the test environment, we have a solution for handlers
bound on window (i.e. window.addEventListener), by monkey patching
the function (thanks to the browser object), and automatically
removing all handlers bound during a test, at the end of that test.

This commit fixes the memory leak by no longer using addEventListener
on MediaQueryList (as this is a deprecated feature anyway [1]), and
simply using window (or browser)'s addEventListener instead. This
leak sometimes produced a timeout in the QUnit test suite [2].

[1] https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener
[2] https://runbot.odoo.com/web#id=2374&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: d86cc5c016cf4eff9a7e4f8b35a9ed38ddc24636
Part-of: odoo/odoo#78698
2021-10-20 15:15:24 +00:00
Aaron Bohy 3459aa9061 [FIX] crm: properly call super in forecast tests
Before this commit, those tests sometimes failed because we didn't
correctly wait for the load and reload promises.

X-original-commit: f62503a56c4ec5c3de6638c5fe2138330d217eac
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy 7bd4ae9566 [FIX] web: prevent some tests from failing undeterministically
This is a tricky one. The problematic tests involve the quick edit
feature. Before this commit, those tests sometimes failed [1],
because there was no guarantee that we waited enough in the test
before doing assertions.

[1] https://runbot.odoo.com/web#id=2012&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: 78762d0a0017e02f2df00d60140a2709fafaa0d5
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy 0c8b5c5da8 [FIX] web: attempt to fix non deterministic issue in tests
This commit *could* prevent a test from failing randomly. The
important part in the diff is the switch from $.Deferred to native
Promise. JQuery Deferred behave differently upon resolution (it is
sync if the deferred is resolved directly, whereas it is not the
case for native Promise). I couldn't find any other reason to
explain why the test was sometimes failing. There is no reason to
use Deferred anyway.

The issue didn't occur after this commit in more than 600 builds.

[1] https://runbot.odoo.com/web#id=2297&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: ed0761dce44bd37cdd9d40ddd6e021517f466f97
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00