Commit Graph
4404 Commits
Author SHA1 Message Date
Moisés López a13bfacb0b [FIX] base: correct es_PE and es_CR locales
Change the decimal point and thousands separator for es_PE and es_CR
Set the currency symbol and position for Colon CRC

closes odoo/odoo#48535

X-original-commit: 88f420f37c305a7451be31ee36c479c2dffd4db8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-27 16:31:36 +00:00
Raphael Collet 8e44b39570 [FIX] core: do not flush() with an environment using RequestUID
When routing an HTTP request, the dispatcher uses an environment with a
placeholder for the user (the object `RequestUID`).  This environment is
not supposed to be used after routing has been done.  However, the
flushing function takes any environment with a given cursor, and it
crashes when this environment is chosen (`psycopg2` cannot adapt the
type `RequestUID` for `write_uid`), and simply does not make sense.

closes odoo/odoo#48495

X-original-commit: da61a64bf6731a08557d23680eabf4d910035ebd
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-27 11:48:43 +00:00
Raphael Collet aab23e2d31 [FIX] http: don't flush() outside of a checked call
When a serialization error occurs in a given code context, the call is
retried.  However, currently the environment is flushed outside this
context, which may cause a serialization error that is not handled by a
retry.  Move the flush inside the checked call to catch all
serialization errors, and handle them properly.

X-original-commit: 6197bfb3b2d51873416780c96cd4cb538a1f219c
2020-03-27 11:48:34 +00:00
Jeremy Kersten 26c4de2f18 [IMP] http_routing: use cached code from lang
In case of short controller that don't use qweb template, we don't need
anyhting else that this url code that don't change frequently.

It make only sense for model like lang, website, ... that will not change
frequently. And are called on each call by the dispatcher.

In case of a website page, we will btw browse lang later, but in case of
small controller like /favicon.ico, or page without qweb, ... we can just
use the same from last query.
2020-03-26 18:12:47 +00:00
Jeremy Kersten 1606d22d40 [FIX] base: perf - binary_record, don't rebrowse ir.attachment
If model is already an ir.attachment we don't need to do a new search_read.
We can use it record directly.

After this commit, we don't do extra request if we already have the info,
else we don't change the behavior.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie bd4a44cece [IMP] base: perf - try/except instead of exists
Most of the time, the record exists, but we still ensure it does, every single
time, making an SQL query.
Doing a try catch will result in the same behavior, but won't make that query
most of the time.

task-2211013
2020-03-26 18:12:47 +00:00
Romain Derie d52c2bbe19 [IMP] website: perf - clear cache only when needed
Before this commit, the cache would always been cleared even if not needed.
Now, we only clear cache when needed.

Util:
Introduced with https://github.com/odoo/odoo/commit/9920f20e4c7753bc17bea71dea3a90f7de687196#diff-1407a8ce197a04eefaefa26c127a4418R327
Changed with 0d5fcdc1c7

task-2211013
2020-03-26 18:12:47 +00:00
Adrian Torres 975ba27723 [FIX] core: enable logger.runbot() when importing odoo as a library
Before this commit, trying to use Odoo as a library without initializing
the logging features would result in a crash because `Logger.runbot()`
is monkey-patched inside the function `init_logger()`, which is de facto
necessary for using Odoo as a lib.

With this commit, we do the monkey-patch at the module-level so whenever
the `netsvc` package is imported the patch is applied, which should be
well before the loading of the registry starts.

closes odoo/odoo#48396

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-26 09:25:15 +00:00
Nicolas Lempereur 71e163be9b [FIX] base: cut multipage multi-documents on top heading
When we print a report for multiple records, we call wkhtmltopdf one
time and to save each document separately, we will split the PDF based
on its outline if it is available.

The outline is generated by wkhtmltopdf based on headings
(H1,H2,H3,H4,H5,H6,H7,H8,H9 elements) for example this document:

```
<h1>hello</h1>
<h2>world</h2>
<h1>!</h1>
```

has this abbreviated outline structure:

```
/Outlines: {
    '/First': {
        '/Title': 'hello'
        '/First': {
            '/Title': 'world'
        },
        '/Next': {
            '/Title': '!'
        }
    }
}
```

But the current heuristic did not take into account level of headings,
so if the document had a lower-level headings this could break the
multi-printing of these reports.

So for the example above, the document would be cut in 3 when in reality
we only want to cut it twice over the top level heading (`<h1/>` here).

An existing issue in Odoo is in l10n_in_sale, `<h6/>` element are added
to the report invoice line so instead of only one `<h2/>` heading
containing the invoice name per document, there was an additional
heading per invoice line which broke the heuristic.

note: we also add an assertion to ensure first heading is on first page.

note: allowing several top-level heading on same page has been
implemented so reports that did not work in 11.0 but worked in 12.0 and
over (thanks to 573e57773) still work after this change.

opw-2188767
closes #48099

closes odoo/odoo#48374

X-original-commit: 63c2478cc9fb21afb83d31b04ff6c6090ee492ab
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-25 16:09:34 +00:00
Nicolas Lempereur f3182c6035 [FIX] translate.py,web: aria-label qweb translation and export
In 12.0 9de1bc0e aria-label translation was added for python views, but:

- aria-label attribute are not exported

- aria-label are not translated for JS view rendering

So by default, aria-label would only be translated for python views that
had the same aria-label term in a translatable element (eg. "title"
attribute).

opw-2222504
closes #48255

closes odoo/odoo#48275

X-original-commit: 6b6b11ea2f8391f1f195bd1650531f77b6bed729
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-24 14:46:30 +00:00
Thibault DelavalléeandRaphael Collet a1654e59b9 [FIX] core: computed fields can be copied if editable
Purpose of this commit is to let computed stored editable fields being
copied if their field class allows it.

Indeed the value of those fields is computed based on some triggers but
can also be updated manually by users.  When copying a record, it makes
sense to consider that this value is what the user expects and allow its
copy, if the original field allows it.  Either it was computed, and
copied value will be correct without having to call computation again
(well, provided all dependencies have been copied, too), or it was
updated and the copied value will be the one the user entered.

Without this fix, an edited field is not copied, and will be recomputed,
which may look like an inconsistent value.

Task ID 2209163

closes odoo/odoo#48383

X-original-commit: 4b274d3b4101fbae154a572cdf40d23838899773
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2020-03-25 17:36:02 +00:00
David Beguin 83ffe8b50b [FIX] base: make parent contact lang prevail on DB lang
Purpose
=======

If a user specifies a language on a company (res.partner), chances are children
of said company will speak the same language. It is at least most likely than
having them speak the default DB language.

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

If a language is set on the parent, the child contact created from the o2m
should have by default the same language.

Before this commit, we set lang in the context of the o2m field but it not
taken into account and is overriden by the default DB lang.

After this commit, the default lang value is forced in the default get to
be the same than the parent, if any. Else, we fallback to the default DB lang.

Link
====

Task ID: 2210350
PR #48077

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-23 09:57:09 +00:00
Martin Trigaux b51129bd30 [FIX] base: proper unlink of abtract model
Context:
Since 7593b887df an entry of ir.model.fields.selection is created
for each entry in a selection field. This allow a more modular
approach of tagging entries with an external id and translating
selections in the module that defined the selection (and not the one
that defined the field)

Problem:
When removing a selection, every record that used this selection is
updated with a 'set null'.
This was also intented on abstract models that do not have a table.

To reproduce:

1. create two models:

class ModelA(models.Abstract):
  _name = 'abstract.a'
  select = fields.Selection([
    ('foo', 'Foo'),
    ('bar', 'Bar'),
  ])

class ModelB(models.Model):
   _name = 'model.b'
   _inherit = 'abstract.a'

2. update code and removes the key 'foo'
3. update the module
   -> error
   psycopg2.errors.UndefinedTable: relation "abstract_a" does not exist
   LINE 1: UPDATE "abstract_a" SET "select"=NULL WHERE "re...

When updating the values in db, only update on real models

closes odoo/odoo#48288

X-original-commit: 6b20a8241300ebfc185500eb64e210db755574a8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-24 20:53:36 +00:00
Thibault Delavallée aaefa35e29 [MOV] link_tracker, various: more link shortening tools to mail.render.mixin
PURPOSE

Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.

SPECIFICATIONS

Move html and text links shortening methods on mail.render.mixin class.
That way rendering and post processing is done in that mixin instead of
being specific to link.tracker model. Indeed those methods are tools and
not really business related methods.

Future commits will improve the way mail and sms composer use the render
mixin. This commit is therefore both a cleaning and preparing commit.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:25:04 +00:00
Thibault Delavallée 6e25a510b3 [REF] base, mail: improve partner creation from name / email
Rewrite code parsing name (_parse_partner_name) to make it easier to
understand. Tweak find_or_create to return directly a recordset with the
found partner / new partner instead of a name_get result.

Also inherit Partner.find_or_create() in mail in order to benefits from
email_normalized field, allowing to improve the search on matching emails
and avoid duplicates.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:14 +00:00
Thibault Delavallée aa74a975d7 [IMP] base: add tests for partner find_or_create / name_create / _parse_partner_name
As find_or_create API and code will be slightly improved soon let us add some
tests to ensure behavior and avoid (too much) regressions. Notably about the
fallback on faulty emails support aka "name email@domain)" which in parsing
is considered as valid. This may happen when people copy-paste emails.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:12 +00:00
Julien Castiaux a5df755284 [FIX] base: apply changes on inherited view
Commit 60106cf2 (task 2082503) introduced some changes on server
actions and automated actions, some changes were applied on server
actions but via the base_automation inherited view.

This commit move those change so they are directly applied on the server
action form view.

closes odoo/odoo#40964

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2020-03-24 06:43:44 +00:00
Adrian Torres 32fcc1b883 [REM] base: deprecate resolve_2many_commands
With the introduction of `new`, the use of `resolve_2many_commands` is
redundant, as it accomplishes the same function with the added benefit
of returning a record-like object whose API is more familiar than
`resolve_2many_commands` API.

closes odoo/odoo#37290

Related: odoo/enterprise#9409
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-23 15:14:11 +00:00
Adrian Torres 9befa3d245 [FIX] *: adapt code for resolve_2many_commands removal
This code adapts all business code instances of calls to
`resolve_2many_commands` and replaces them by calls to `new` which
returns a record-like object whose api is more familiar than the
`resolve_2many_commands` api.
2020-03-23 15:14:10 +00:00
Xavier Morel 43f10313c6 [IMP] *: automatically brand PDFs (from PyPDF2) as Odoo
To avoid having to fixup half a dozen places where we're creating PDF
writers, and possibly ending up with new ill-configured writers in
the future, patch PyPDF2's own writer with a subclass setting /Creator
and /Producer.

Note that this will not affect non-post-processed PDFs generated by
wkhtmltopdf. wkhtmltopdf does not allow setting these properties[0][1], so
to fix this issue we'd have to alter _run_wkhtmltopdf to pass the
result through PyPDF2 in order to alter its metadata.

[0] https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2000
[1] https://bugreports.qt.io/browse/QTBUG-44451

closes odoo/odoo#29460

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-23 14:41:52 +00:00
Adrian Torres 02327d8a6b [IMP] base: warn user about the consequences of uninstall
This commit adds a warning banner near the bottom of the uninstall
wizard warning the user of the consequences of module uninstallation and
advising him to try it first on a duplicate database so as to avoid
borking the database.

The Cancel/Confirm buttons were also swapped and the Cancel one was
made primary to avoid mindless "next-clicking"

closes odoo/odoo#33396

Task-id: 1824392
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-23 12:26:56 +00:00
Priyanka Kakadiya 85c707e684 [IMP] base: sort actions by sequence if sequence available
before this commit:
actions are not showing as per the sequence, like:
1) Other actions (delete, duplicate)
2) Windows actions
3) Server actions (without sorting by sequence)

After this commit:
Server actions are sorted by the sequence, like:
1) Other actions (delete, duplicate)
2) Windows actions
3) Server actions (with sorting by sequence)

task-2005419

closes odoo/odoo#39872

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-23 12:15:38 +00:00
Jinal PatelandMohammed Shekha 8f8c93b68a [IMP] base: display full name of the field in import warning
Before this change, if an error occurs while trying to match / import
a sub-field e.g. order_line/product_id, only the name of the top-level
field is showing when displaying the error e.g. "Order Line", which
lacks precision and makes understanding and fixing the issue more
complicated.

After this change, the entire field path should be displayed, e.g.
"Order Line / Product" in the example above.

Task-1906700

closes odoo/odoo#33031

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-03-23 11:51:30 +00:00
Xavier Morel d418bff698 [FIX] core: make accessing fields from __str__ possible
Because CacheMiss calls str() on the record it's given, it's not
possible to override __str__ and get field values: on the first cache
miss (= the first field access) we're going to blow the stack:

* any random field is accessed
* and faults
* which creates a CacheMiss
* which stringifies the record
* which accesses a field
* which faults
* which creates a CacheMiss
* etc...

Fix:

* move the basic Model's stringification to repr(), which is
  implicitly called on str() if no __str__ is specified, for historical
  reasons we were doing the opposite
* use repr() when initialising CacheMiss

closes odoo/odoo#42966

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-23 10:53:34 +00:00
Raphael Collet fd50ba9fb8 [IMP] core: do not recompute stored field on new record
The use case is a cache miss of a stored field with compute on a new
record with origin.  The field should be computed only when explicitly
triggered, i.e., when a dependency has been modified.  Otherwise it
should be fetched from the origin record.

closes odoo/odoo#47353

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-23 09:04:59 +00:00
Victor Feyens bbce92b436 [REF] base, various: remove unused views
PURPOSE

Remove dead views to clean dead records

SPECIFICATIONS

Find unused views and remove them, notably specific views that are not used
anymore because generic one is always taken. Notably

  * view_partner_short_form: a short form view on partner that is not used
    anywhere anymore. Indeed it has a priority of 2 whereas default form view
    has a priority of 1 (lower better). It is not referenced in actions
    anymore. It is therefore dead.

LINKS

Task ID 2196317 (Social/Marketing specific)
2020-03-20 15:01:39 +00:00
Nisha patel e428d473c3 [IMP] various: Allow to select only internal users on m2x field with res.users
Purpose of this task is to prevent users from setting portal users on
internal documents by mistake, and preventing noise and performance
issues resulting from loading all the portal users in those fields.

This commit fixes internal many2x fields to res.users which are now
restricted to internal users by setting domain (share=false) on form view.

closes odoo/odoo#47553

Taskid: 2172779
Related: https://github.com/odoo/enterprise/pull/9204
Related: odoo/enterprise#9204
Closes: #47553
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-16 10:28:35 +00:00
Odoo's Mergebot fd113d48a2 [MERGE] *: ir.rule declaration cleanup
* remove global assignation in xml, it is a computed field anyway, let the orm compute it
* put all `ir_rule` definition as noupdate in the xml

closes odoo/odoo#47688

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-20 17:24:11 +01:00
Victor Feyens a3ded9043d [IMP] *: declare ir.rule in noupdate
ir.rule are default values but can be customized based on the
company's policy and needs.
This is typically a record that is in noupdate as should be
customization-friendly.
2020-03-20 16:21:25 +01:00
Victor Feyens 532c083cbb [IMP] *: remove global field definition in ir rules xml
It is a computed field, there is no need to manually set its value.
2020-03-20 16:15:40 +01:00
Swapnesh Shah 5d86eb64ac [FIX] base: place correctly the symbol for INR currency
closes odoo/odoo#48111

Fixes: #47687
X-original-commit: 3d65ffd15d61c48666e8489e5c86085e64d86216
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-03-20 13:05:14 +00:00
Helly kapatel 1c9a6db16f [IMP] various: Change 'assignation' to 'assignment' across all modules
Purpose
=======
The main definition of 'assignation' is the following:
   "an appointment to meet someone in secret, typically one made by lovers"

The correct word we should be using is 'assignment':
   "the allocation of someone or something as belonging to a particular group or category"

So in this commit change every iteration of the word
'assignation' to 'assignment', across all modules.

closes odoo/odoo#45041

Taskid: 1966215
Closes: #45041
Related: odoo/enterprise#8375
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-20 14:12:51 +00:00
Xavier Morel 012678bf27 [IMP] core: cutoff imports after some number of errors
Importing 100 records and getting 100 errors (often the same every
time because a required field was not mapped) is not super useful and
spams the logs a lot.

Cutting off at one point seems useful.

Note: integrates warnings-related fix from #47972 reported by Grzegorz
Marczyński in #47936.

closes odoo/odoo#48095

X-original-commit: 6b05f1d13c862dd66e89f35607d072315be80995
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-20 10:29:33 +00:00
nasreddin boulif d948362e60 [IMP] base,contacts,website_customer: rename "Sectors of activity" to "Industries"
Purpose of this commit is to improve english wording in Odoo
regarding res.partner.industry model.

For that purpose we rename "Sectors of activity" with
"Industries" everywhere we use that naming.

Original feedback #2212682

Task ID #2214290
Closes #47559

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-20 08:53:57 +00:00
Jeremy Kersten 9430dd1287 [FIX] website: perf - use lang cache in url for.
Before this commit, url_lang (= url_for) will make query to find the lang_code
but we alrady have this info in ormcache with get_available method.

So instead to rebrowse (search query) the lang, we use a new method that will
try to find it in cache if possible before to make the query.

The gain on each page is n-1 (where n is # lang installed)
Because the switcher of languages do an url_for for each lang available.

Related to #47257
task-2211013

X-original-commit: 2cecbe356ce283e15fb0bbd0a6e9aa4735af520e
2020-03-19 15:37:47 +00:00
Jeremy Kersten c2142a34f7 [FIX] website: perf - cache the compute hash for translation
Before this commit, we compute the hash on each request, to know if we need to
download the file from the frontend or if we can use cache.

Now we store the hash computed in cache. The cache will be invalidated when we
touch one of these translations (openerp-web in the comments) or when you
install a new lang (already the case).

+ avoid to use read on a record, since it will not use the cache from record.

Related to #47257
task-2211013

X-original-commit: d5aaecbc51de19ef1d8d9988b691177fc73a4b86
2020-03-19 15:37:47 +00:00
Christophe Monniez 7e1481355f [FIX] tests: move post_install only warning into browser_js
This warning should only appear when Chrome is used.

closes odoo/odoo#48009

X-original-commit: 013b32f000520217af17b6e1ffe1872ec97afdf0
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-19 11:47:41 +00:00
Xavier Morel fe376d50d0 [FIX] core, base: leftover deprecation warnings
* from collections import <ABC> is deprecated, unclear why the
  deprecation warning didn't appear before (possibly only appears in
  3.7/3.8?) either way `collections.abc` should be 3.3+ so switch
  everything to it.
* add some more ignores on third-party packages deprecation
  warnings (meh)
* while at it, mitigate generation of non-breaking space on some
  versions of Babel (in the french locale used by our tests anyway)

closes odoo/odoo#47581

Related: odoo/enterprise#9214
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-19 09:32:21 +00:00
Denis Ledoux 20e713bb27 [FIX] base: fix oversight during fp #47851
closes odoo/odoo#47965

X-original-commit: 8efb8b7c80865a739e480259a893dddbf19c0f63
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2020-03-18 21:46:16 +00:00
Jorge Pinna PuissantandXavier Morel 4ce7406b19 [FIX] fields: XLSX files mistaken as SVG files
Before this commit, when a user try to import data with a XLSX file, the
file was mistaken by an SVG file. This issue arises because a XLSX file
from import isn't encoded in base64, and for testing if the file is an
SVG file it will be decoded. base64.b64decode by default (when validate
is False), will remove all characters that are in the base-64 alphabet
from the input prior to decode. So in our case, when the non encoded
XSLX file is force decoded the results starts, unluckily,  with '<' and
it's mistaken by an XML/SVG file. Note that, the XSLX file is wrongly
tested because a XSLX file is just a ZIP file, and all the ZIP files
start with PK\x03\x04, and P is the first byte of a base64 encoded XML
file.

Now, only files that were previously encoded into base64 are decoded to
be tested. The validate = True parameter in base64.b64decode will raise
a binascii.Error if there are a non-base64-alphabet characters in the
input, this will allow us to know if the input was or wasn't base64
prior encoded. As base64.b64decode with validate = False, removed the
non-base64-alphabet characters this allows to decode input files
compatible with RFC 2045 (MIME). The files compatible with this standard
will have a newline character (b'\n') after every 76 bytes of the
output, and end with a newline. To keep backwards compatibility, we
remove the newlines and the carriage return from the input before the
decoding.

opw-2194468

closes #36081
closes #31849
closes #33543

closes odoo/odoo#47906

X-original-commit: 65d709c9ab386d646f682c494cfb21cb06ec8034
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-03-18 11:51:27 +00:00
Denis Ledoux ceb1acd6d4 [FIX] base: validate ir.ui.view xml on re-enabling
When passing a view
from `active` `False`
to `active` `True`,
its xml wasn't being checked, and it could be very well be invalid.

e.g.
Create a view inheriting from `base.view_partner_form`
`active` set to `False`
`arch` set to
```
<field name="foo" position="after">
    <field name="bar"/>
</field>
```

On creation, the `_check_xml` constraint is valid because the view is disabled.

Now, write `active` to `True`. Notice no constraint error is raised while the view is invalid.

This is particularly critical now that we automatically disable invalid custom views
during upgrades. When the user tries to re-enable the view which has been disabled to see
what was wrong, he doesn't get any error because of this.

closes odoo/odoo#47897

X-original-commit: fb2aeb29cd62e02ca5485e5b60d6b61ae4acc252
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2020-03-18 11:18:31 +00:00
Christophe Monniez 5533490b46 [FIX] ir_model: avoid records duplicates in dichotomy
When uninstalling a module, all related ir.model.data records are
unlinked, if the unlink fails, a dichotomy is performed until all
records are unlinked.

It happens that a record appears in both part of the dichotomy. In that
case, the record is deleted in the first part. When second part records
are unlinked, a crash occurs because the record cannot be found anymore.

With this commit, sets are used instead of lists to store the records
that need to be removed, avoiding duplicates in dichotomy.

closes odoo/odoo#46323

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-02 16:09:12 +00:00
Adrian TorresandRaphael Collet 0453566a76 [ADD] tests: add a script to test module uninstallation
With this commit, a new script "tests-uninstalls.py" is added in order to
test module uninstallation.

This script is a kind of standalone tool. It uses odoo as a library but
the odoo server is not started at all.

In its standard invocation, it tries an install/uninstall/reinstall
cycle for each all module found in the specified database.

By specifying '-U', it only tries to uninstall the comma separated list
of modules following the argument.

Be aware that this tool, will alter the database against which it was
invoked.

Co-authored-by: Raphael Collet <rco@odoo.com>
2020-03-02 16:07:06 +00:00
Romain Derie 96d3fa4e01 [IMP] base, website: add ir.ui.view action to compare arch (wizard)
This commit adds the possibility to compare a view arch to another one.
The result will be shown in a diff viewer (github like).

This is following what was done at #32009

task-2190072

closes odoo/odoo#44646

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-03-17 15:58:45 +00:00
Romain Derie 30f2f6fe1f [FIX] expression: 'select from not null' as subquery for x2many
Before this commit, the query to fetch records with/without relations would be
done in a separate query which results would be then passed to the main query.

This commit adds this query as a subquery of the main query to do it in the
same SQL query instead of separately.

task-2211013

closes odoo/odoo#47729

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-03-17 09:57:00 +00:00
Xavier-Do b2b36524c2 [IMP] core: improve module loading logs
Performances from a general point of view can be difficult to track.
This commit proposes to improve logs in two ways:

The current logs only use the sql_counter, wich will only be updated
when a cursor is closed. In a test-enable install, this counter
is actually the queries of the tests wince the install cursor is
open untill the end. The first fix is to use bot sql_counter and
sql_log_count to have total queries untill now on closed cursor,
but also the current number of queries of the current cursor.

This means that the new log format will be
{nb} modules loaded in {time}, {loading_querie} (+{test_cr_queries}) queries
instead of
{nb} modules loaded in {time}, {tests_cr__queries}queries

Nothe that in the current version, {nb} is actually the total number of
loaded modules until now.

This commit also add an equivalent end log by module and change the
loglevel of module start on install (mainly usefull if an error occurs
before anything else is logged hidding the module causing this error.)

A cleaner runbot logger is also added, in order to be abble to call
_logger.runbot( instead of _logger.log(25. This will clarify the purpose
of such a log level.

closes odoo/odoo#47283

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-16 13:21:57 +00:00
Andrii Skrypka cee6693165 [FIX] base: hide enterprise upgrade button
Combining a state and attrs does not work
Apply all in the same domain

closes odoo/odoo#47676

X-original-commit: 3588487ab4ef867f7fb981a395deaf298eb4a4e4
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-16 10:20:28 +00:00
Julien Castiaux 92b17aadd2 [FIX] sql_db: remove unused __closer
The `__closer` attribute is filled with the origin of a call to
`cr.close()`. That information is reused in the `check` decotator that
ensure the user is not using a closed cursor. In case he is using a
closed cursor, an error is raised with that optional origin in case of
`--log-sql`.

The attribute is a dundler so it is only accessible within its class, as
the decorator has been moved outside of the class by 058cf208a8 it is
not directly accessible thus `__getattr__` is called as a fallback. The
`__getattr__` itself is protected by the `check` decorator thus they
call each other in a infinite recursion.

As the related dundler is no more used internally, it has been decided
to remove it entirely.

closes odoo/odoo#47616

Task: 2199895
X-original-commit: 3ebf7cb9cca37b05f44aaffc0b1f289cc65f300f
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2020-03-13 15:24:54 +00:00
Richard Mathot 75483b910b [FIX] base: link to Apps platform
closes odoo/odoo#47601

X-original-commit: 49c9383af9eee6b6d01dff0bc1016faa7a3f9400
Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
2020-03-13 13:38:52 +00:00
Julien MougenotandMathieu Duckerts-Antoine 804507ef49 [REF] *: Adapt all module tests to the new control panel
Use of the new control panel helpers to increase consistency and change the assertions
according to the new DOM/behaviour (e.g. components removed instead of turning invisible).

Part of task 2196029

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13 14:08:33 +00:00