Commit Graph
126256 Commits
Author SHA1 Message Date
Enric Tobella c16d2827bc [FIX] context on reports
closes odoo/odoo#31150

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-02-15 12:58:38 +00:00
Adrian Torres 073b7bb944 [FIX] stock: unlink move_lines in batch
Before this patch, cancelling a PO of 2000 lines would take a **very,
very** long time to process... so long that I terminated it before it
finished... yikes.

This was due to the call to `_do_unreserve` on every single move when
calling `_action_cancel`, this meant that n² calls to unlink where being
made (at least), which also meant n² calls to
`stock.move._recompute_state` were being made... that's a lot of
recomputes... = bad performance

The patch simply calls unlink once, which means `_recompute_state` is
called only once, saving a lot of time.

Cancel time for a PO containing 2000 lines:
        - Before patch: 1h30min+ (process terminated before finishing)
        - After patch: 7min

Other modules making use of stock and `_action_cancel` should also see
benefits from this patch

closes odoo/odoo#31787

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-03-12 15:35:19 +00:00
Adrian Torres 859586b641 [FIX] purchase: recompute in batch after confirmation
For every line in a RFQ, we create a stock.move upon confirmation of the
RFQ. This create, in turn, triggers a lot of recomputes that are not
needed for the creation of the next moves and thus should only be
triggered once.

This commit disables the recompute during the step that creates the
moves and then manually triggers the recompute **once**, after all the
moves have been created.

Confirmation time for a PO with 2000 lines:
        - Before patch: ~1h
        - After patch: ~9min

This patch is similar to the one introduced at [1], however the
previously mentioned patch uses batch create which is not available in
this version, so we manually emulate batch create's behavior.

[1] https://github.com/odoo/odoo/pull/31471
2019-03-12 13:15:40 +00:00
Nans Lefebvre 1be873d40d [FIX] purchase: do not overwrite vendor reference on vendor bills
The reference fields is supposed to contain the reference number in the vendor's
system. E.g. if the vendor is using Odoo, it could be SO0744.
Therefore this reference is not supposed to change once written by the user.
However there is the _onchange_origin that uses the origin purchase order lines
to populate the reference fields on invoice_line_ids changes.

We remove entirely this behaviour for reference,
essentially reverting 052a5702c5.
Instead we put a default for origin and reference in action_view_invoice
so that these values are initially used at create.

opw 1920747
opw 1944840

closes odoo/odoo#31757

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-12 09:05:42 +00:00
Suraj ShuklaandMohammed Shekha 587e90fe18 [FIX] web: reload form after failing save
Let's assume a form view with a clickable statusbar, in readonly.
When the user clicks on a status, the change is saved directly.
When the save fails (e.g. access rights), the statusbar widget
is in an inconsistent state and must be reloaded.

This rev. reloads the whole record and re-render the form when
this happens.

Related to Issue: #1915391
closes #29519

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>


Co-authored-by: Mohammed Shekha <msh@openerp.com>
2019-03-12 09:11:06 +00:00
Martin Trigaux 173401100f [FIX] mail: translate global variable
As the message was set globally in the file, a _lt was needed for a lazy
translation

Fixes odoo/odoo#26288

closes odoo/odoo#31761

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-03-12 07:46:03 +00:00
Lucas Perais (lpe) d8f8996424 [FIX] website_sale: search abandoned cart negated domain
Search for orders that are not abandoned

Before this commit, the same results for abandoned and not abandoned were returned
This was because the not abandoned domain was not negated with the '!' operator that
expression.distribute_not() relies on

After this commit, the abandoned domain is negated

OPW 1942311

closes odoo/odoo#31739

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-03-11 10:35:06 +00:00
Adrien Dieudonne 1cdf2bdaf6 [FIX] barcodes: let focus in number, password, tel, phone inputs
Before this commit, users wasn't able to input values in some
input elements like password, email and phone in mobile.

Steps to reproduce:
- Go to user
- Select Preferences
- Select Change password
- Try to input something
=> The focus was lost and the keyboard disappeared

In fact, a hidden input always have the focus when no other fields
need it. This input is used to intercept a value from a barcode
scanner.

So now, we added some input types to avoid to set the focus on the
barcode input.

It's quite difficult to test this feature because we aren't allow
to simultate a keyboard to write in a input field.
See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
Plus, we don't have the focus in mobile except if we have the cursor
inside the window.
So, we can't test focused elements or input values.

opw-1936712
opw-1948266

closes odoo/odoo#31566

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-03-11 09:57:56 +00:00
Odoo Translation Bot 07e89c5c8d [I18N] Update translation terms from Transifex 2019-03-10 03:14:20 +01:00
Sébastien Theys 188ddec890 [FIX] website_sale: prevent compute_image on /shop
On /shop, we access the image field to generate the image widget, but we don't
actually need the image content, we just need its url. When `bin_size` is added
we don't compute all the resize for nothing.

opw-1923999
task-1922055
PR: #30274

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-02-15 10:17:04 +00:00
Sébastien Theys 15adbcab1b [FIX] sale,website_sale_stock: prevent compute stock from /shop
The `_get_combination_info` override in website_sale_stock is only necessary
when we want to get the stock, which is on the product page RPC.

Before this commit, the stock would be computed all the time, which slowed down
the requests for no reason.

opw-1923999
task-1922055
PR: #30274
2019-02-15 10:17:03 +00:00
Sébastien Theys 956b5cafdb [FIX] product, website_sale(_*): show only template data on /shop
In order to increase performance, it was decided to avoid computing the first
combination on the /shop page, because it has to be done for many products in a
loop. Instead, we only display the template data, which is faster to get.

This implies that when using only one variant, we need to always write on the
template image instead of the variant image. This is needed because when there
is only one variant, the user doesn't know there is a difference between
template and variant, he expects both images to be the same.

To achieve this, we also had to change how the quick buttons work on the /shop
page ("add to cart", "add to wishlist" and "add to compare"). Indeed it was
decided that their behavior should be the same, no matter how many combinations
existed or not on the template. Therefore, the standard behavior of those
buttons is to always do their action on the first possible variant, that is
cached so we can use this logic without ever needing to read anything else than
the template data (and the cache).

opw-1923999
task-1922055
PR: #30274
2019-02-15 10:17:03 +00:00
Juhil Somaiya 02eebe15cd [IMP] mail_bot: Blocked notification alert to User
If user has blocked odoo push notifications
then there's no way to enable via the OdooBot notification in the systray as it depends on the navigator
so display the alert message under users preference section.

Related Task ID: 1929547

closes odoo/odoo#30496
2019-02-15 09:05:54 +00:00
svs-odoo b35d103cc0 [IMP] web: reload currencies when activating one
Active currencies are given in session_info, in the page source.
When the user activated a new currency, he had to reload the page
to make the browser aware of that new currency (without reloading,
there was no currency symbol displayed next to the amounts).

This rev. forces a reload of the currencies each time a currency is
edited.

Task #1838654

closes odoo/odoo#31192
2019-02-18 12:56:05 +00:00
Robot Odoo aa8aadd2ad [IMP] web,website_sale: add tests for product image and mixin
This commit add tests for new mixin product.image and resizing.
Purpose is to test feature merged by commit: 413c63556f

closes odoo/odoo#31181
2019-02-18 14:26:01 +01:00
Sébastien Theys 1302654646 [IMP] base,web,website_sale: add tests for product image and mixin
This commit will add tests for the PR #30656 which added the following commit:
7daa85dd12

The tests in the current commit achieve 100% code coverage for:
- the `image.mixin`
- the overridden `image.mixin` methods in `product.product`
- the `_get_images` methods of ecommerce
- the size logic in method `content_image` (route `/web/image`)

PR: #31181
2019-02-18 09:43:06 +00:00
Sébastien Theys 539fb375e1 [MOV] website_sale: rename zoom test to image test 2019-02-18 09:30:42 +00:00
Sébastien Theys 5b32f1b5cd [FIX] product,(website_)sale: speed up _get_variant_for_combination
Change the domain to not include `.id` and to use `in` to prevent subqueries
to be ran by the ORM for each attribute value.

On the filter, directly use `attribute_value_ids` instead of the computed field
`product_template_attribute_value_ids` that leads to the same result, to prevent
unnecessary compute of that non-stored field.

Cache the result of the method. The cache is invalidated when the configuration
of attributes and values change.

We can remove all cache invalidation from the tests since it is done at the
appropriate times in the business code now.

opw-1923999
task-1922055
PR: #30274
2019-02-15 08:52:26 +00:00
Sébastien Theys cc985a2bc4 [FIX] product: fix product configurator speed using prefetch/compute
Take advantage of prefetch and api.multi, instead of calling plenty of methods
that didn't cache their result and did separate queries for each record.

opw-1923999
task-1922055
PR: #30274
2019-02-15 08:52:26 +00:00
Sébastien Theys b87a07c501 [FIX] product: fix speed of _set_product_template_value_ids compute
The method was doing an unnecessary sort since the _order has been fixed in
f8dad1bb4b

Moreover, it tried to find the ptav through the attribute_id related field and
a map on the other side, instead of directly relying on the ids of the ptv.

opw-1923999
task-1922055
PR: #30274
2019-02-15 08:52:26 +00:00
Sébastien Theys 26a35b6931 [FIX] product,website_sale: add generator for possible combinations
We replace `_get_first_possible_combination` by a generator. By iterating it, we
can find as many possible combinations as we want, as suggested in task 1936680.

So if we need to get or to know if any arbitrary number of combinations exists,
we can just iterate on the generator multiple times, without having to start
over from the start every time.

opw-1923999
task-1922055
PR: #30274
2019-02-15 08:52:26 +00:00
Sébastien Theys f2d4b118d0 [FIX] sale,website_sale: fix list view of variants price compute
Before this commit, the list view of variant didn't use `_get_combination_info`
so the displayed price was not taking into account important settings such as
B2B/B2C and currency convert.
2019-02-15 08:52:26 +00:00
Christophe Simonis 6cf4f4924b [FIX] stock: remove domain on stock.location of picking types
There is no `company_id` field on `stock.picking.type`.

Partially revert f221936f8b (#30952)

closes odoo/odoo#31121
2019-02-14 20:25:55 +00:00
Christophe Simonis c0f24d54cf [MERGE] forward port branch saas-14 up to c1fe9f18d5 2019-02-14 18:14:08 +01:00
Christophe Simonis c1fe9f18d5 [MERGE] forward port branch 10.0 up to 69719f598a 2019-02-14 18:09:24 +01:00
Denis Ledoux 69719f598a [FIX] google_calendar: case insensitive attendee sync
In Odoo, create a user John@example.com (the cap is on purpose)
In Google Calendar, create an event and invite john@example.com

Sync your Google calendar.

Before this revision,
the event created in Odoo did not add John@example.com,
but created a new attendee, john@example.com, because
of the sensitive casing.

Besides, give the priority to partners having
users, so if there are two partners with the same email,
one of them having a user,
e.g. John@example.com (with user) & john@example.com (without user),
set the partner having the user as attendee,
as its the one with the user who use the Odoo calendar,
and potentially the Google sync as well.

opw-1925592

closes odoo/odoo#31111
2019-02-14 11:07:25 +00:00
qdp-odoo 10551f25ab [FIX] account: don't mess the invoice status
Since the invoice validation is well separated from the account entries creation (and made before), the chatter was showing too much status change upon an invoice validation.
This commit makes sure we never consider an invoice paid when its move hasn't been created yet.

closes odoo/odoo#31100
2019-02-14 10:13:38 +00:00
Nathan de Pryck db691dbebf [FIX] account: reverse entry when account move line contains 0 in credit or debit
In some case, when the user enter by mistake an account move line
 with an amount of 0,the reverse operation does not works properly.
The issue happenned during the reverse operation because it tries to
reconcile a 0 account move line with no matches (credit or debit).

See opw-1931961
2019-02-14 09:13:24 +01:00
Nicolas Seinlet bae95e303c [IMP] base: avoid name_get when possible
When search on partner_id return thousands of records, thousands of
_name_get are performed, and there's a great chance to not use them at 
all. Using the lazy_name_get seems more efficient in terms of memory and 
cpu.

closes odoo/odoo#31075

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-02-13 15:22:37 +00:00
Christophe Simonis fe83f0de24 [IMP] hr_holidays: unmute test logger
ince 8da3750cee, logger does not need to
be muted anymore.

This reverts commit f5889303ef.

closes odoo/odoo#31748

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-11 13:48:12 +00:00
Romain Derie c78da8a80d [FIX] website_links: fix multiple bugs + add tests
Commit 6d67ce5b7c refactored the JS from multiple website modules including
`website_links`.
A few error needed to be fixed:
  - recent links would not appear anymore
  - graphs would not be displayed anymore
  - graph resize on tab change would not be fired

This commit fixes it and also add some tests to be sure this module is now
strongly tested.

Note: tests are skipped for now as there is a race condition happening only
      with docker and this fix is getting urgent for Odoo.com

closes odoo/odoo#31507

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-03-11 12:40:32 +00:00
Raphael Collet 716a272480 [FIX] models: check groups on inverse fields
Before this, groups on non-stored inverse fields were not checked upon write.
The impact on existing fields is pretty small, since the inverse methods of
those fields are subject to access rights on the records they use.

closes odoo/odoo#30357
2019-02-13 10:45:04 +00:00
Lucas Perais (lpe) cbdc8d864b [FIX] fields: read/write company-dependent fields without ir.property access
This is the first step to a more comprehensive handling of company-dependent
fields which are ir_properties.

With model-specific access rights, users should be able to read/update a
company-dependent field no matter their access rights on ir_property.

Before this commit, a user having access to res.partner, but not to ir.property
couldn't write on property_account_receivable/payable just because he couldn't
write the corresponding ir.property.  After this commit, he can.

OPW 1923345
2019-02-13 10:43:50 +00:00
Raphael Collet cd3790c4ea [FIX] models: check groups on inverse fields
Before this, groups on non-stored inverse fields were not checked upon write.
The impact on existing fields is pretty small, since the inverse methods of
those fields are subject to access rights on the records they use.

closes odoo/odoo#30356
2019-02-13 10:35:09 +00:00
Lucas Perais (lpe) 61623bd17c [FIX] fields: read/write company-dependent fields without ir.property access
This is the first step to a more comprehensive handling of company-dependent
fields which are ir_properties.

With model-specific access rights, users should be able to read/update a
company-dependent field no matter their access rights on ir_property.

Before this commit, a user having access to res.partner, but not to ir.property
couldn't write on property_account_receivable/payable just because he couldn't
write the corresponding ir.property.  After this commit, he can.

OPW 1923345
2019-02-13 09:34:08 +00:00
Lucas Perais (lpe) b62d720c85 [FIX] l10n_it: change website in manifest
openerp-italia.org or odoo-italia.org are not valid websites

changing it to odoo.com

OPW 1940848

closes odoo/odoo#31110
2019-02-14 10:55:36 +00:00
Nicolas Lempereur 0857737f8c [FIX] web_editor: focus lost with inline editor
When an inline editor is eg. in a form view, the focus is always stolen
by it.

This is because we trigger a mouseup on the editor to update its
toolbars values and informations.

note: backport of 11.0's 7a453b0b7a

In 10.0 this trigger could cause a "blur" which in some instance is not
wanted (eg. inside a newline of a list view).

opw-1906581
closes #31078
2019-02-13 17:21:19 +00:00
Nicolas Lempereur 1e43c73a99 [FIX] web_editor: html widget empty value stay empty
The html widget automatically replace an empty field value by
`<p><br></p>` to be able to add content.

But this may cause unintended "onchange", since the value has "changed"
and the onchange themself could cause error when triggered at the wrong
time (eg. inside a list view with required fields).

With this changeset, the onchange is averted when the value was false
and is now `<p><br></p>`.

opw-1906581
closes #31078
2019-02-13 17:11:13 +00:00
Lucas Perais (lpe) 5b37c40cac [FIX] point_of_sale: reconcile cash returns rather than freight returns
Revert commit 296c5a2106
which was half-right: the accounting logic is correct but it overlooked
that it broke the reconciliation of cash returns
i.e. the client gives more money, and you return the change

Given that this latter use case may occur more frequently we focus on that
while we break freight returns
i.e. the client returns a product, and you give the money back

It is not possible to support both use cases because
ultimately we don't know from which order an account.move.line comes

the related PR #23356 should support both use cases
but adds a field on account.move.line

OPW 1925607

closes odoo/odoo#31037
2019-02-12 16:27:51 +00:00
Moens Alexandre 7dea5c418b [IMP] base_import_module: tell user what they actually can import
This commits adds a message to the module import wizard to make it more
clear what kind of modules can be imported through the front end.

project : RD feedback
task : [base_import_module] what it is not for.
opw-1939967

closes odoo/odoo#31057
2019-02-13 11:50:51 +00:00
Denis Ledoux 5ebcd188f3 [FIX] stock: improve performance of product quantity search
Calling `search` on `product.product` without specifying an order
will sort the products by name.

As the product name is a translatable field,
it requires to make a join on the translation table to sort
the product by their translated name.

This join is costly, and in this case it was completely
irelevant to do it, as the goal was simply to compute
a domain with only a list of product ids, for which
the order simply did not matter.

By forcing the order on the id,
we avoid the sort on the product name,
and therefore the join on the translation.
The performance is therefore improved.

opw-1930010

closes odoo/odoo#31066
2019-02-13 12:52:48 +00:00
Alexandre Kühn 2f1688868a [FIX] mail: correctly compute direct_partner_id for dm_chat
Revision on https://github.com/odoo/odoo/commit/975164473ccd51c00eee5917dddbd8be71b5aefc

The commit above improves the channel_info, so that there
are less DB queries.

However, the computation was wrong for partners on dm chat,
which resulted in omitting the name and email of the partner.

closes odoo/odoo#31033
2019-02-12 15:55:01 +00:00
David Monjoie 867df179ca [IMP] base,doc: re-add consolidation feature to gantt view
closes odoo/odoo#31159
2019-02-18 07:23:32 +00:00
David Monjoie e154d2c17b [FIX] hr_payroll: use calendar as default view
The webclient doesn't handle a non-existing view as the default
view. However, it must handle it correctly if it is not the
default one since it does it for mrp.production already.

closes odoo/odoo#31161
2019-02-15 18:01:31 +00:00
Robot Odoo f34a7eddde [MERGE][IMP] website_slides: improve inclusion of gamification and ranks
Purpose of this merge is to improve inclusion of gamification and ranking
in elearning new main pages [1][2]. Ranking and profile information, links
and templates are added.

Some fixes are included in this merge, notably statistics computation, better
slide image fetch and demo data. See sub commits for more details.

Commit linked to task ID 1941250.

closes odoo/odoo#31133
2019-02-15 19:52:20 +01:00
Thibault Delavallée 5822e3098c [FIX] website_slides: fix text / html mismatch in demo data
Slide description is actually a text field, no need to put html tags that
are displayed raw.

Commit linked to task ID 1941250 and PR #31133.
2019-02-15 17:46:03 +00:00
Thibault Delavallée bd2dae4f6d [IMP] website_profile, website_slides: add user ranking and karma on elearning main pages
Purpose of this commit is to improve karma and gamification inclusion in
elearning [1].

 * remove a border, replaced by a standard hr, in rank template. It allows to
   reuse it easier as we don't necessarily want that border in other templates
   using it;

Commit linked to task ID 1941250 and PR #31133.

[1] task ID 1922159 (landed at 5fa651cb01)
2019-02-15 17:45:55 +00:00
Thibault Delavallée 1bb7b242c0 [FIX] website_profile, website_slides: clean user avatar controller and add one for slides
Purpose of this commit is to

 * clean user avatar controller and its calls;
 * extract default image computation;
 * add a controller to get slide image even when not having access to the slide
   as all slide name and images are displayed even if not available to the
   current user;

Commit linked to task ID 1941250 and PR #31133.
2019-02-15 17:45:41 +00:00
Thibault Delavallée e7b3535884 [REF] gamification: clean next rank motivational implementation
Purpose of this commit is to clean motivational capabilities of gamification
ranks[1]. It makes more sense to store a motivational to achieve on next rank
itself. We therefore rename the field and provide nice demo data that will be
used in elearning use of gamification ranks.

Commit linked to task ID 1941250 and PR #31133.

[1] task ID 1922159 (landed at 91ee6ba5a7)
2019-02-15 17:45:11 +00:00
Thibault Delavallée 6a9f6876c1 [FIX] website_slides: fix some statistics and publication issues
This commit fixes various issues introduced by recent commits in slides

 * fix slide type computation: using a dict in a fromkeys makes a shared
   object for all keys. It is better to fix that behavior;
 * correctly display number of course steps in elearning homepage. Currently
   number of steps of a course is simply the length of its one2many;
   holding slides. However this one depends on access rights which give funny
   results like a course with 2 steps for public users and 7 for admin;
   Right computation is: number of published lessons, whatever your access
   rights are. This is already computed as total_slides;
 * people that cannot publish should not be able to unpublish;

Commit linked to task ID 1941250 and PR #31133.
2019-02-15 17:44:02 +00:00