Commit Graph
3866 Commits
Author SHA1 Message Date
Martin Trigaux 63289fa06a [FIX] *: typos, wording
Courtesy of translators

closes odoo/odoo#36984

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-17 08:39:02 +00:00
Martin Trigaux f4d5a7fe8b [IMP] base: improve test coverage
The forbidden cases were not tested, making it harder to detect

closes odoo/odoo#36846

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-18 08:40:12 +00:00
Raphael Collet a6ec6ca0e2 [FIX] models: do not prefetch forbidden fields in read()
closes odoo/odoo#36985

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-17 08:36:44 +00:00
Raphael Collet 4596734d60 [FIX] sale_coupon: missing sudo() in modified()
closes odoo/odoo#36909

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-16 08:31:23 +00:00
Adrien Dieudonne 8bef7af307 [REF] web: control_panel: breadcrumb and cp_searchview flexible width
1) The size of the left part of the control panel will take free
space left. Normally, the width is always fixed to 50/50 but
now the breadcrumb can take more or less space if needed.
It will be useful on mobile where the search bar is dynamically
sized.

2) Control panel elements are split into two divs;
- breadcrumb and search bar are grouped to be in the top.
- buttons (o_cp_left) and pager (o_cp_right) in the bottom.
Now we can easily add antoher elements in the top or bottom
part of the control panel.

3) Control panel template is likely the same on mobile so
they are now merged.

4) Before this commit, we always had an empty parent even if
the search bar wasn't rendered. Removing it makes the DOM cleaner.
Because of this, we are not able to expose this area used to add
custom elements. Some code need to be adapted.

Task ID : 1924760
2019-09-16 15:11:28 +00:00
Xavier-Do fc5934dc45 [FIX] base: fix rte translator timeout
In some cases, after installing a new language in rte_translator tour,
some query using ir_translation table will become very slow.

Identified query:
SELECT res_groups_users_rel.uid, res_groups_users_rel.gid
FROM res_groups_users_rel, "res_groups" LEFT JOIN "ir_translation" as "res_groups__name"
ON ("res_groups"."id" = "res_groups__name"."res_id"
AND "res_groups__name"."type" = 'model'
AND "res_groups__name"."name" = 'res.groups,name'
AND "res_groups__name"."lang" = 'en_US'
AND "res_groups__name"."value" ! '')
WHERE 1=1 AND res_groups_users_rel.uid IN (2) AND res_groups_users_rel.gid = res_groups.id
ORDER BY COALESE("res_groups__name"."value", "res_groups"."name")    OFFSET 0´

During post_install this query will become slower (between 0.7 and 2 seconds) ~50%
of the time, when this usually take less than 0.1 second.

For some tour step, this query is executed several times, making a simple
/web loading going from less than one second to more than 10 second, breaking the tour.

The main intuition behind that would be that the query plan completely fails,
mainly because postgress is to busy and doesn't have time to launch an analyse
when runbot load is high.

This commit proposes to execute a manual ANALYZE on ir_translation table
after a new language is installed. Tested with 40 builds, rte_translator never failed
with this fix.

closes odoo/odoo#36954

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-09-16 13:33:04 +00:00
Xavier-Do b57b194f6c [REV] core: revert 6a366b21
6a366b21 was aiming to uniquify translations, this is not usefull
anymore because of unique constraints added on ir_translation table.

Removing the subselect slightly improve performances.
2019-09-16 13:28:59 +00:00
Martin Trigaux be5d48ef1d [FIX] *: correct typos, improve wording
Courtesy of translators

closes odoo/odoo#36953

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-16 13:45:52 +00:00
Lucas Lefèvre ac00548b28 [IMP] web: Export list view as XLS file
Purpose
=======

Have a quick export feature.

The current export wizard is quite complex.
We want to be able to quickly export a tree view,
with the group by correctly represented, depending on the fields
visible in the list view.

Specification
=============

Add an "EXPORT (XLS)" button in the list view (a little download icon)
- export only columns visible in list view
- export all the records
- while respecting the group by

This should be a generic feature but should be applied to all
the account.move.lines list views.
account.view_move_line_tree_grouped_sales_purchases
account.view_move_line_tree_grouped_bank_cash
account.view_move_line_tree_grouped_misc

Task 2031835

closes odoo/odoo#36943

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-16 13:57:40 +00:00
fja-odoo e33172e832 [IMP] website_sale, *: keep track of products viewed
*= website, website_livechat, website_rating

///// Tracking Product /////

Now when a user browse products in eCommerce, we keep track of the
products he looked at. We use the website_visitor
to store the products viewed. A cookie is added with a TTl of 30 min it
will prevent the RPC for that time. We track the page only if the
product view is tracked.

The recently viewed products are displayed as a snippet but also
with the customize option in product pages of website_sale.

Products that are in cart will not be returned as recently viewed.

It is possible to add a recently viewed product to the cart directly
from the carousel, it will not redirect to the cart. If we are on the
cart page, the product is displayed in the cart.

The Visitor page in website now references products viewed

///// Tracking Page /////

Feature to track a view was remove in: https://github.com/odoo/enterprise/pull/4834

That feature is now reintroduced and will use website_track instead of
leads to be stored.

The track field is now on the view instead of the page.

url field is added to website.track, it will store the url for pages and
views

The Visitor page in website now references urls viewed

Add some tests

task-1984575

closes odoo/odoo#35810

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-16 09:38:53 +00:00
Julien Castiaux 7c47eb1854 [IMP] module.py: deprecate openerp
[PEP-594] is deprecating the `imp` module, that module is used in
`module.py` in order to dynamically import addons using any of the
`odoo.addons` or `openerp.addons` import anchor.

We are deprecating `openerp` module/addons imports in v13 in order to
remove the support in v14 and greatly simplify how modules/addons are
loaded. If you are still using the old `import openerp` or `import
openerp.addons`, `import odoo` and `import odoo.addons` are drop-in
replacements.

The `odoo.modules.module.ad_paths` addon paths list has been deprecated
too. The list is now accessible on `odoo.addons.__path__` where they
are now directly loaded [2].

See also:

[PEP-594]: https://python.org/dev/peps/pep-0594/
[2]: https://packaging.python.org/guides/packaging-namespace-packages/

closes odoo/odoo#36597

Task: 2003936
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-16 09:31:38 +00:00
Julien Castiaux 760ab74f83 [FIX] *: replace openerp addons import by odoo
Importing addons using the `openerp` anchor is depreciated by #36597
2019-09-16 09:31:38 +00:00
Raphael Collet b318dda826 [FIX] models: create with company-dependent fields
This fixes 957c78b98f to make it
compatible with 55e1b44492.

Upon record creation, we do not set a company-dependent field when its
value is the same as its default in `ir.property`.  Here we take into
account that `field.default` does not necessarily return that value.

closes odoo/odoo#36905

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-16 08:18:42 +00:00
Odoo Translation Bot e80b81dca1 [I18N] Update translation terms from Transifex 2019-09-15 01:30:37 +02:00
Sébastien Theys f6d56afba0 [IMP] http: rollback from checked_call only if necessary
The rollback clears the cache, which lose all data that have been fetched before
arriving in the route method.

This lost cache includes some website data that was used during the dispatch and
that will be used again in the route.

By keeping it we reduce the number of queries on every request by at least 2.

Part of task-2061122

closes odoo/odoo#36245

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-13 14:30:13 +00:00
Martin Trigaux 73e70673e7 [I18N] *: export saas-12.5 source terms
closes odoo/odoo#36853

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-13 11:38:37 +00:00
Yannick Tivisse 3eb06a27da [IMP] res_config: Apply groups to users accross companies
Purpose
=======

When enabling/disabling a group, the modification is only applied
to the users from the enabled companies.

It should be applied to all the users.

closes odoo/odoo#36744

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-13 11:34:50 +00:00
fja-odoo 424adb63e3 [IMP] gamification, *: remove KarmaError
* = stock, test_website, web, website_forum, website_slides, base

Replace KarmaError with AccessError and remove the related override made
on crash_manager and ir_http.

task-2069890

closes odoo/odoo#36655

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-12 13:49:02 +00:00
Christophe Simonis 5a273e74f0 [MERGE] forward port branch saas-12.4 up to fe59754c52
closes odoo/odoo#36721

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-13 13:32:51 +00:00
Xavier Morel f58368210c [ADD] base_import: batching (& some other features)
various UI changes
------------------

* renamed "test import" button to "test"
* move relation fields thing to debug mode
* remove "Defer parent/child computation" option as it was deprecated
  / removed from the backend in
  80f1ac3599, turns out this checkbox
  existed inactive for longer than it's been of any use (added in
  68cb2ade09 on 2017-11-29, made
  non-operating on 2018-01-24, that's so sad)

batching
--------

* add support for batching imports (skip & limit parameters)
* modify client to use batched imports & properly adapt responses so
  it still looks like a single import for the client (more or less)
  e.g. update row numbers in error messages, etc...
* properly handle partial imports though
* disable usual loading throbber to have a single progress
  notification displayed continuously throughout all the batches: the
  normal throbber only shows after 3s of waiting for an RPC response,
  so it would keep flashing in and out (appear 3s into a batch's
  import then disappear at the end only to reappear 3s into the next
  batch's loading)

NOTE: the limit is row-wise. If a record straddles the limit (because
of nested O2M records), the record is imported in full and the "next
row" is whatever row follows the record. This means a limit of 10 can
lead to an import of 17 lines, and as the progress indicator is in
records# the increments can jump around.

Task 2059448
2019-09-13 09:45:29 +00:00
Martin Trigaux 19e50ea374 [FIX] tools: do not translate selections with _translate=False
If a model is tagged with _translate=False, it should not be translated.
A special case was made for ir.model.fields but not ir.model.fields.selection

Before this commit, the selections of web_editor.converter.test were translated

closes odoo/odoo#36576

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-09 14:57:15 +00:00
Raphael Collet 492e4cc5a1 [REF] fields: setup and use of depends_context
closes odoo/odoo#36795

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-12 14:24:58 +00:00
Yannick Tivisse 1b454088e6 [FIX] models: warn on ignored fields in "order by" 2019-09-12 13:53:12 +00:00
Raphael Collet 44ea2adda7 [FIX] fields: conversion of Many2oneReference value
The value of that field can be given as a dict containing the fields of
the corresponding record.

Co-authored with Michael Mattiello <mcm@odoo.com>

closes odoo/odoo#36779

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-12 12:23:55 +00:00
Xavier ALT 21fa7ca76f [ADD] base: add Luxembourgish language
Add luxembourgish language code in order to be able to translate terms
for that language in Odoo.

closes odoo/odoo#36757

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-12 12:12:17 +00:00
Raphael Collet bf8d288d04 [FIX] base: simplify computation of commercial_partner_id
The computation was using an SQL query to speed it up, but the recent
changes in the ORM have made this optimization useless.

We have benchmarked an import of 10000 partners linked to the same
parent, in a database with Sales and Stock installed.  The import is
slightly faster without the SQL query (7 min vs 8 min).

closes odoo/odoo#36768

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-12 10:28:55 +00:00
Mitali PatelandMohammed Shekha a3845ae3f0 [FIX] base: ask to discard before leaving settings
In a settings form view, do some changes, then click on a button
or link in the form (e.g. 'Manage Users' in General Settings).
We now ask if the user wants to discard the changes before leaving
the page.

Task 1921574

closes odoo/odoo#34799

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-09-12 06:21:41 +00:00
Jairo Llopis 4497077f55 [IMP] base: allow private addresses for contacts
For contacts without company, it was not possible to modify the type
and set a private address

opw-1944234

Closes odoo/odoo#31491

closes odoo/odoo#36701

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-11 12:51:42 +00:00
Yannick Tivisse 1a0a437855 [FIX] models.py: Don't commit after fetching a translation
Purpose
=======

When trying the translate a sql_contraint message after an integrity error
we use the current cursor in a 'with', just to make a SELECT query.

That way, the cursor is commited at the end of the with statement, trying
to commit the inconsitent state of the cursor that was the reason of the
integrity error.

Just close the cursor, as we only fetch translations from the database.

closes odoo/odoo#36458

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-11 09:50:09 +00:00
Yannick Tivisse a581656b00 [FIX] models.py: Raise user friendly error message on sql constraints
Purpose
=======

On a record creation, a valid and user friendly error message is raised
when a sql constraint is violated. (Eg: 'The start date must be anterior
to the end date').

On a record modification, this is not always the case anymore, since the
latest ORM modifications.

Eg: Write on a leave with a date_from > date_to, you got the postgreSQL
error, which is not understable by a classic human.

This is due to the fact that the error is correctly catched and logged,
but the result is set into the cache, triggering the execution of computation
methods, and calling _validate_fields. It is highly probable that a flush
is done in the constraint method (search, read, ...). In that case the
postgreSQL error is converted into a ValidationError, with a stringified
version of the IntegrityError, and thus is not catched by the check wrapper.
2019-09-11 09:27:42 +00:00
Denis Ledoux 5cac9c54ff [IMP] fields: avoid __set__ multiple loops on record, and new browse records
This patch avoids to create new browse records for nothing,
(as creating new browse (__new__) is costly),
and to avoid to loop multiple times on the records
(with multiple different filtered, etc.)

This brings performance gain to __set__,
which is used when setting the value of a compute field

e.g. This improves the performances of
`env['product.product'].search_read([])`

closes odoo/odoo#36006

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-11 07:55:17 +00:00
Denis Ledoux 3d1c924cff [FIX] fields.py: improve computation time of records having a different value in cache
Instead of using a filtered with `cache.get`,
use a dedicated method in the Cache class to get
the records having a different value in cache then asked.

This is mainly to avoid the creation of intermediate
`browse` of 1 record, when doing `for rec in self`
in `filtered`.

Creating browses is costly, and avoiding it leads
to performance gains.

The dedicated method `get_records_different_from`
loops on the record ids, instead of on browse records
2019-09-11 07:55:17 +00:00
Denis Ledoux 0e028de72e [IMP] api: lazy_property for user, company, companies
These variable are not supposed to change within a same
environment.

The lazy property will compute these variables only
once, then store the result,
while the property were computing these variables
each time they were called.

e.g. for a 1000 iteration loop,
with `env.company`,
the company was computed 1000 times.
With a lazy property, the company will be computed one time only.
2019-09-11 07:55:17 +00:00
Raphael Collet 1315a1a82c [FIX] fields: clash with automatic fields and inheritance
Consider a model M that defines `display_name` as a computed stored
field, then an extension of M that introduces a mixin model A before
that definition in the MRO of M's class.  The model A is expected to
have an automatic, non stored field `display_name`, while M must have
its non-automatic, stored field `display_name`.

closes odoo/odoo#36427

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-10 13:29:15 +00:00
Martin Trigaux 68c753af55 [I18N] *: export saas-12.5 source terms
Still without demo data

closes odoo/odoo#36559

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-09-10 08:58:33 +00:00
Raphael Collet 36346afd96 [FIX] models: callable in api.depends() sees valid _rec_name
Determine `model._rec_name` before the dependencies of the fields.  The
compute method of the automatic field `display_name` uses a callable
depends that retrieves `model._rec_name`.

closes odoo/odoo#36484

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-09 13:42:45 +00:00
Raphael Collet 263849c336 [FIX] models: optimize modified() in the context of record creation
This prevents a bunch of queries that are useless when creating a
record.  Indeed, right after a record has been created, no other record
has a many2one reference to it.  In other words, inversing a many2one
field from the record just created always gives an empty recordset.
Those useless inversions generate about a dozen queries when creating a
`res.partner`, for instance.

This saves queries, but not much time.

closes odoo/odoo#36566

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-09 13:18:53 +00:00
Raphael Collet cfb08e87b0 [FIX] models: use transitive triggers instead of recursion
On average, this reduces the total time spent in method `modified` by
half (times measured on invoice creation and post).
2019-09-09 13:18:48 +00:00
Raphael Collet 55e1b44492 [FIX] fields: enable default on company-dependent field
The ORM overrides the default defined programmatically on the field, and
set a default function that retrieves the value in `ir.property`.

closes odoo/odoo#36545

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-09 09:35:19 +00:00
Josse Colpaert cc505b4b57 [FIX] base: partner of company should be shared in multi-company
We got an error before e.g. when we changed the address
of a created company because the company created is not yet
in the allowed_companies in the environment.

Also, it does not make sense that the company of the partner
of a company is that company. When you create a new partner,
partners are shared by default between companies (company_id False).
And in most multi-company situations, operations are made between
them, so it makes extra sense to share their partners.

So, we don't set the company of the partner of a company anymore.

closes odoo/odoo#36510

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-09-06 08:11:59 +00:00
Odoo Translation Bot 0d51520083 [I18N] Update translation terms from Transifex 2019-09-08 01:29:12 +02:00
Jeremy Kersten 34db511c8d [FIX] base: compute name for all ir_attachments
Before this commit, and since the new orm, we cannot open a record that have
no res_model and res_id.

With new orm, we should return a value for all records.
Now, we can open attachement form view without the error:

    ir.attachement(<id>).res_name traceback

closes odoo/odoo#36446

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-05 07:52:15 +00:00
jem-odoo 1b24f60a5c [FIX] tools: format_datetime with inactive lang
When selecting the lang browse record, it can be empty when language is not
activated. As we don't need that lang to be active to translate the
format datetime (lang code is enough for Bable lib), we simply
need to fallback to prevent error.
2019-09-05 20:11:18 +00:00
wan 737eaf9333 [IMP] account: add searchpanel on account.account and account.move.line
Task 2008956

* Add the root of an account (first 2 digits/char) as a searchable model.
* Create a custom searchpanel for this account root on account.move.line
* Add the account_root searchpanel to the account.account view too.
2019-09-04 09:00:03 +00:00
Christophe Simonis 51354fadb0 [MERGE] forward port branch saas-12.3 up to 50e571acf7
closes odoo/odoo#36491

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-11 09:39:33 +00:00
Raphael Collet eef48811ff [FIX] models: callable in api.depends() sees valid _rec_name
Determine `model._rec_name` before the dependencies of the fields.  The
compute method of the automatic field `display_name` uses a callable
depends that retrieves `model._rec_name`.

closes odoo/odoo#36476

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-09 10:07:06 +00:00
Odoo Translation Bot 71cc792c94 [I18N] Update translation terms from Transifex 2019-09-08 06:21:59 +02:00
Odoo Translation Bot 4af010bdec [I18N] Update translation terms from Transifex 2019-09-01 06:24:20 +02:00
Raphael Collet 63b3297af3 [FIX] models: _rec_name when field x_name is discarded
closes odoo/odoo#36617

X-original-commit: 32ca79940b1608495cb08c2272add5216685af71
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-10 10:38:12 +00:00
Christophe Simonis 9bf0b04adb [MERGE] forward port branch 12.0 up to 82a8cdd6f2 2019-09-06 17:52:48 +02:00