Commit Graph
126133 Commits
Author SHA1 Message Date
David Beguin 2c01452d4b [IMP] website(_profile,_forum,_survey) : redesign website all_users page
As the eLearning (website_slides) is also using website_profile users,
the All Users page is moved from website_forum to website_profile, to be
useable in both forum and eLearning.

This page displays also the number of karma point, badges and certificates
of each user.

The users are sorted by their karma points and the first 3 users are
promoted on a podium.

Use span instead of b tag in profile page

Task ID : 1922159
PR #31109
2019-02-18 15:15:06 +00:00
David Beguin 5125eecce5 [IMP] website_slides_survey : add certifications in website profile page
For users viewing their own profile page on the website,
a new section 'Certifications' is added to the about tab.
Thoses certifications are the survey that activated certificate.

Task ID : 1922159
PR #31109
2019-02-18 15:15:06 +00:00
David Beguin 3ab9f1d8ab [IMP] website_slides_forum : set communication on slide.channel at creation - frontend side
Since 556b6454dab07cdf716d404ec0db9aa51a09b165, channel can be linked to a dedicated forum.
But the link could only be done in backend, in the slide.channel configuration
For now on, website_publishers can create a new dedicated forum when they create
a new slide.channel.

Link buttons have been added in both forum and slide.channel headers to navigate easily
between them.

Fix the relation between course and forum in a model point of view.

Task ID : 1922159
PR #31109
2019-02-18 15:15:02 +00:00
David Beguin 705376a982 [IMP] website_slides : add karma gain rules
To gamify the new elearning, karma can be gained on various actions
- rank a slide_channel (course)
- vote for a slide
- finish a course

This commit also fix the 'completed' computation on slide.channel.partner

Task ID : 1922159
PR #31109
2019-02-18 15:01:40 +00:00
Thibault Delavallée 0fe26b382c [FIX] website_slides: fix computation of completed courses 2019-02-18 14:53:10 +00:00
David Beguin 16b0b18361 [IMP] website_slides : show completed and ongoing course on profile
Two new sections are added in the profile page : Completed courses and Followed courses
Thoses sections replace the former 'Courses' section.

Use span instead of b tag in profile page

Task ID : 1922159
PR #31109
2019-02-18 12:16:08 +00:00
Xavier Morel f7e1f0645e [IMP] doc: PYTHONPATH configuration
Previously we'd `append` the extensions and odoo parent directories to
sys.path, however this means if an `odoo` is already installed in a
sys.path (e.g. global installation, or setup.py develop in a venv,
...) *that* will be used as the source of Python code (for autodoc)
instead of the Python source being synchronised with the rst, which
can lead to very odd behaviour.

Prepend the doc's stuff to the PYTHONPATH instead, to ensure they get
priority and the code matching the rst gets loaded.
2019-02-18 08:56:07 +00:00
Xavier Morel 7065ea520c [FIX] *: various docstring formatting issues
Would yield block quotes instead of code blocks or lists or whatnot.
2019-02-18 08:56:07 +00:00
Xavier Morel 3f8d20b778 [FIX] web_editor: various levels of broken in docstrings 2019-02-18 08:55:57 +00:00
Xavier Morel cca26f7952 [FIX] doc: workarounds for weirdo code & refs
Make UnknownNS more capable (of giving no fucks) so the documentation
builder blows up less on weird-ass code at module toplevels.

UnknownNS should probably be split out from NSDoc though, that requires
odd workarounds in `__getitem__`.
2019-02-18 08:55:57 +00:00
Arnaud Baes dba97a2689 [FIX] stock: Scrap button.
The 'scrap button' should be visible only if:
- The picking is a done receipt
- The picking is a not done delivery
- The picking is internal

TaskID: 1930221

closes odoo/odoo#30466
2019-02-18 08:37:36 +00:00
Hugo Adan ef618df9e9 [REF] account: Performance improve unreconcile process (_reverse_move):
_reverse_move presents a critical performance issue when
unreconcile moves with a lot of account_move_line.

The issue is that `account.move` and `account.move.line` models are triggering computed fields/methods for each new
`account.move.line` added, computing all lines again and again.

Making a factorial performance issue.

For each line the function try create cash basis entries for tax/base lines and this is combined with all the
fields compute that exists on the model so this introduce a performance problem

The issue is that `account.move` and `account.move.line` models are triggering
computed fields/methods for each new `account.move.line` created isolated,
computing all lines again and again.

e.g.
 _compute_matched_percentage at
https://github.com/odoo/odoo/blob/5e8289cfeaf52a1eac64bcc975b186f0b5f9594b/addons/account/models/account_move.py#L44-L62

Then for each line modified/created this compute is executed for all lines (not just the last one).

Now by using self.env.norecompute() and self.recompute() the problem was reduced.

Unreconciling an 'account.move' with 1576 lines with a payment takes almost 4
minutes when before this changes, the conciliation process seemed not to never
end.

Fix https://github.com/odoo/odoo/issues/30934

closes odoo/odoo#31014
2019-02-17 10:28:21 +00:00
Hugo Adan ce93a949a7 [REF] account: Performance improve for create_tax_cash_basis_entry
create_tax_cash_basis_entry presents a critical performance issue when
reconciling moves with a lot of account_move_line.

The issue is that `account.move` and `account.move.line` models are triggering computed fields/methods for each new
`account.move.line` added, computing all lines again and again.

Making a factorial performance issue.

For each line the function try create cash basis entries for tax/base lines and this is combined with all the
fields compute that exists on the model so this introduce a performance problem

The issue is that `account.move` and `account.move.line` models are triggering
computed fields/methods for each new `account.move.line` created isolated,
computing all lines again and again.

e.g.
 _compute_matched_percentage at
https://github.com/odoo/odoo/blob/5e8289cfeaf52a1eac64bcc975b186f0b5f9594b/addons/account/models/account_move.py#L44-L62

Then for each line created this compute is executed for all lines (not just the last created one).

Now by using self.env.norecompute() and self.recompute() the problem was reduced.

Reconciling an 'account.move' with 1576 lines with a payment takes almost 4
minutes when before this changes, the conciliation process seemed not to never
end.

Fix https://github.com/odoo/odoo/issues/30934
2019-02-17 10:27:50 +00:00
Christophe Simonis 1cb3e7c522 [MERGE] forward port branch saas-15 up to c6c3d73391 2019-02-19 19:14:16 +01:00
Nicolas Martinelli bddd53881c [FIX] hr_holidays: numerical error
In some exceptional circumstances, the computation of the remaining
leaves might lead to numerical errors, e.g. a very small but non-zero
number (e.g. 10^-17)

This value will be displayed in the name of the leave type because of
the `%g` used in the string format. To avoid breaking the translation,
we round the value.

opw-1935232

closes odoo/odoo#31245
2019-02-19 12:43:07 +00:00
Nicolas Martinelli 29a3634c1a [FIX] l10n_us: ABA/Routing
When defining an ABA routing number with leading zeros (which is
possible), the value will always be displayed without them.

This is because the field is an integer. Since the ABA routing transit
number must be a nine-digit code, we automatically fill it with leading
zeros.

opw-1940138

closes odoo/odoo#31223
2019-02-19 07:59:25 +00:00
Nicolas Martinelli 3e147220fd [FIX] account_voucher: round globally
- Enable multi-currency. Company currency = USD, another currency = SGD
- Update the exchange rate
- Create a purchase journal. Assign SGD to this journal
- Create a purchase tax of 7.00 %
- Enable tax rounding globally
- Create a purchase receipt with the following values
  62.04 @ 7% tax
  7.29 @ 7% tax

An error occurs: 'Cannot create unbalanced journal entry.'

Each line of the receipt creates its own tax line, which is therefore
rounded => the total of the receipt is computed with a 'round globally'
configuration, while the taxes are computed with a 'round per line'
configuration.

This is because `apply_taxes=True` is set in the context. This creates
the tax line by forcing the rounding. Therefore, we call the method
`_apply_taxes` explicitly in this specific case, and manually round the
taxes once they are merged.

opw-1938623

closes odoo/odoo#31194
2019-02-18 12:55:35 +00:00
Nicolas Martinelli cece8834f9 [IMP] account: apply taxes
We extract the tax creation from the AML creation in an external method,
in order to be able to call it separately.

This is necessary for the subsequent commit.

opw-1938623
2019-02-18 12:53:58 +00:00
Nicolas Martinelli 3a5c50e5c6 [FIX] account: TaxCloud multi-company
The TaxCloud settings are not company-specific.

opw-1933774

closes odoo/odoo#31198
2019-02-18 13:10:22 +00:00
Alexandre Kühn fa2a5055e7 [FIX] im_livechat: instantly receive messages from new livechat
Before this commit, when new messages were posted in a new
livechat, the operator received them after a delay. This
may take up to a minute before receiving the notification.

This behaviour was causing a bigger issue: those notifications
may never be received by the operator. This case happened when
the operator was receiving more recent notifications while
notifications from new livechats were pending.

The delay was caused by the operator not yet subscribed to
notifications on the newly created livechat. It is only on
the next poll of longpolling that the subscription occurred,
then followed by dispatching the notifications to the operator.

This commit fixes the issue by dispatching new messages of new
livechats directly to the operator. This is done by enforcing
the operator to make another polling when a new livechat is created,
so that he is always subscribed to those livechats. As a result,
new messages are received instantaneously.

opw-1933951

closes odoo/odoo#31191
2019-02-18 12:20:40 +00:00
Odoo Translation Bot 5a3d4e4c80 [I18N] Update translation terms from Transifex 2019-02-17 06:02:37 +01:00
mreficent e74f96ba06 [FIX] hr_holidays: leave_type_request_unit field was declared twice
closes odoo/odoo#31162

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-02-15 18:36:37 +00:00
Martin Trigaux 62a29dba2c [REV] models: do not erase master version
This commit has been backported in 11.0 [1] and then reverted [2],
because it introduced a regression in web_studio, discovered at opw-1947380

As no forward-port has been done between the backport and the revert,
the forward-port of the revert also contains the patch itself, resulting
in a noop.

Actually revert 06d73eab62 in branch `12.0`.

[1] d855e3911f
[2] 1748b46718

closes odoo/odoo#31637

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06 14:45:21 +00:00
Lucas Perais (lpe) 1a9393c8d7 [FIX] account: invoice compute tax group amount correctly grouped
Before this commit, when printing an invoice, the taxes were grouped
by their tax group (NOT by their parent tax)
Summing the base of each tax in the process.

This was largely insufficient, as tax groups can have taxes
with different rates or computation method within them

The summing of the base of each tax for reach tax group was in this case plain wrong

This commit aims at grouping by
group > computation method > amount

Which makes more sense

OPW 1947202
OPW 1945353

closes odoo/odoo#31617

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-03-06 08:58:52 +00:00
Julien (juc) Castiaux c0847a7bd7 [FIX] project: subtask of duplicate project are linked to original
When duplicating a project, every task linked to the project is
duplicated too but the link between sub-tasks and their parent
task is not updated thus they are left linked to the task of
the original project.

opw-1937371

closes odoo/odoo#31154
2019-02-15 15:03:16 +00:00
Nicolas Martinelli e632e6c5e2 [FIX] account: do not copy alias
When duplicating a journal, the alias is kept. Therefore, when the user
tries to change it, it updates the value on both records.

opw-1941717

closes odoo/odoo#31242
2019-02-19 12:13:28 +00:00
Nicolas Lempereur 4b977f3b7d [FIX] website_crm_partner_assign: stage breadcrumb in order
If the stage breadcrumb on the portal view is too long, it could get on
two lines but since they are righ-aligned in inversed order, the second
line (or more) will be the first stages.

With this fix, the breadcrumbs are left-aligned so on two line the
second line are the last breadcrumbs.

Also there was possibly a different order than backend since the order
is on "sequence, name, id" in backend but was just "sequence" here.

opw-1934497
closes #31237
2019-02-19 11:11:15 +00:00
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