Commit Graph
4328 Commits
Author SHA1 Message Date
Toufik Ben Jaa ac32c3ea6c [FIX] models: crash on one2many fields without inverse
- In some cases One2many fields defined as computed without
    inverse field defined could cause crashes if it is used
    in a search.

    This should not be done, but shouldn't crash either.
    With this fix, trying to search on one of this fields
    would just print a warning.

closes odoo/odoo#46742

X-original-commit: 4b4f1623590f2e872c565e8e56002bc3f5bf9efe
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-03-03 12:19:10 +00:00
Adrien Dieudonne 464968de36 [FIX] account, hr_expense: amounts on multiple lines in the dashboard
Before this commit, the amount currency could be wrapped on a
second line (on mobile).

To fix this, we had to find a way to have more space:
- Buttons are now displayed at the top (mobile only).
- Amounts can grow (col-auto) and the other column will take the
  space left (col) and add "..." when there is not enough space.
  (mobile + desktop)

We also had to remove a button from a div tag in order to display
the buttons next to each other on mobile (buttons are "inline-block"
but div is a "block").
The main flow tour has been adapted accordingly and the typo has
been fixed too...

closes odoo/odoo#46680

Task-id: 2184243
X-original-commit: 159e3d4cb8a301c908f7718a56138528033e75d4
Related: odoo/enterprise#8963
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-03-03 08:09:49 +00:00
Lucas Perais (lpe) 9ce6136be7 [FIX] web, base: make company-specific report assets static
Before this commit, the company specific colors and font were
implemented by systematically overwriting a "virtual" report SCSS
asset file before rendering each report.
This caused many issues, forced frequent asset bundles recomputations
(performance problem + cache invalidation causing random bugs).
And it could simply not work in a multi-company setup where multiple
styles are involved, as the asset management could be made not
thread-safe.

PR #44225 was a first attempt to mitigate the numerous problems by
making the asset bundle invalidation less frequent. But the problems
were still present and a more complete solution was necessary for
multi-company setups.

Besides, the design of the bundle forbade making company specific assets.

This commit uses a different approach: instead of having a
company-specific asset that needs to be constantly updated, a global
"multi-company" asset is maintained and included in the report assets.
It only needs to be generated when a company style changes, not for
every rendering operation.

Unfortunately this change cannot be fully performed without updating the
template declarations, so it will require an update of the `web` (or
`base`) module to be operational.

As this represents a rather invasive change in a stable branch, extensive
testing was conducted to minimize the effects and ensure proper
degradation of features for production deployments where the new code
would be deployed without forcing an update of the `web` module:
- The report SCSS files were left untouched, to prevent any bundle
  invalidation, ensuring that old cached assets would remain valid. This
  means that single-company setups should not see any visible difference
  after pulling the code (with or without updating `web`).
  SCSS cleanup will be done later.
- Existing Python methods were kept but emptied, to make sure that
  old templates and code would not crash.
- For multi-companies, the last used colors will be applied for all
  reports until the `web` module is updated. The old behavior was not
  working correctly anyways, so the degradation is actually limited.
- For all setups, changing the colors after deploying this patch will
  have no effect unless the `web` module is updated.

/UPDATED FOR master on top of #44393/:
- removed the `res_company.update_scss()` method entirely
- fixed the report SCSS styles, as the variable names referred to the old
  behavior, e.g. "$o-company-primary-color" is nonsense.
  Renamed to "$o-default-report-primary-color" etc.

--
Improves #44225
Forward of #44393

opw-2168623
opw-2171040

closes odoo/odoo#46647

X-original-commit: a5b1421aecf27b1de408434d3bb6d7ac81f57dc3
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-03-02 13:22:09 +00:00
jbw 5c127860fc [FIX] various : fix misspellings
- small mistake when you want to import a bank statement file:
  it is written:
  SEPA recommanded Cash Management format (CAMT.053)
  while it should be:
  recommended

- comma separated -> comma-separated

Task : 2200054

closes odoo/odoo#46645

Related: odoo/enterprise#8940
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-02-28 15:29:32 +00:00
Nisha patel 159699b09c [IMP] various: set boolean_toggle on 'active' fields in form view
Currently, to activate/deactivate records with the 'active' checkbox
user has to switch to edit mode of the form.
So the purpose of the task is to allow the user to activate/deactivate
records from the readonly mode of the form view.

In this commit, we  set widget='boolean_toggle' on the 'active' field in form
view.

closes odoo/odoo#46567

Taskid: 2206794
Related: https://github.com/odoo/enterprise/pull/8918
Related: odoo/enterprise#8918
Closes: #46567
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-02 06:26:02 +00:00
fw-bot 1d135ffc06 [FW][FIX] base: No company_id on new res.partner
When a user is created, its partner_id shall not have any company_id.

A test has been added to check that in 'base/test'.

Update test_mail tests by setting a company to partner_id linked to users
as now, by default the partner linked to a new user has no company_id.

closes odoo/odoo#46515

Task: 2198688
Forward-port-of: #45900
X-original-commit: 187b12fc5715721efdd9af283e086dfc3f856fc2
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-28 09:19:19 +00:00
qsm-odoo b6553afeac [FIX] base: properly alert the user of bundle compilation errors
Since we now use native promises, the code in charge of alerting the
user of bundle compilation errors was opening both an alert and a
dialog (fwp of https://github.com/odoo/odoo/pull/46437).

In 13.0, the mention fwp is not enough. On the website, the JS is also
lazy loaded now so we need to wait for that lazy loading before being
able to open a modal.

The whole alerting code should be improved to not be defined in python.

Fixes https://github.com/odoo/odoo/issues/45447

closes odoo/odoo#46482

X-original-commit: d5a2469b1edd0d22b366b44086d08c6f0b2247b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-27 19:33:01 +00:00
Hardik Prajapati ad5038ac74 [FIX] base: fix various issue of the contacts form view
In address block there is extra space between label and field
so added class o_td_label with o_form_label in span tag

Wrong hover title on create company button when company_name is set
so direct use icon attrs instead of span

closes odoo/odoo#44695

Taskid: 2182637
Closes: #44695
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-27 05:55:39 +00:00
Victor Feyens f4bcf2c3f9 [IMP] base: batch records (un)archiving
This allows detailed reporting in write overrides.

Expl:

When (un)archiving multiple records together (from a view list, or in batch call),
you will only see one record at a time in `write` overrides.  This means you
won't be able to return meaningful and complete messages to the end user.

Before:
1) Archive A & B
2) "You cannot archive A"
3) Archive B
4) "You cannot archive B"

After:
1) Archive A & B
2) "You cannot archive A & B"

closes odoo/odoo#46358

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-02-26 14:31:31 +00:00
Victor Feyens b174428344 [REF] base: remove unused dead action(s)
PURPOSE

Clean dead actions.

SPECIFICATIONS

Some ir.actions.act_window are not used in odoo codebase anymore

  * not linked to a given menu;
  * not referenced in the code;

LINKS

Task ID 2188942 (original)
Task ID 2196183 (Social/Marketing specific)
Community PR odoo/odoo#46435
Enterprise PR odoo/enterprise#8846
2020-02-27 13:09:52 +00:00
Sébastien TheysandRaphael Collet 5d62e4954f [FIX] core: fix _flush_search() when _order depends on m2o
closes odoo/odoo#46365

X-original-commit: 604b6a22db8eddfb37f9be31d3826394e25bd86c
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2020-02-26 17:56:32 +00:00
Debauche Stéphane 991eb9a17b [FIX] sms: ensure chatter / SMS have the same content
When we send a SMS in the contact form view, exact body is sent by SMS and
displayed in chatter. If some manual HTML is added chatter will display it
as HTML while sms receive HTML tags.

We want that the SMS content in the chatter is the same as the SMS sent and
that HTML tags are removed to avoid being interpreted.

To achieve that goal we call html2plaintext in ``_message_sms`` and in
``prepare_log_body_value`` that are two entry points to send SMS.

We also update ``html2plaintext`` to strip result in order to avoid having
unnecessary spaces left.

Task ID 2126123
PR #40441

closes odoo/odoo#46362

X-original-commit: 4b7b14a5ea5e6ab521838c01813fa478154682fd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-26 15:12:03 +00:00
Raphael Collet 229075205f [FIX] core: compute fields in batch on new records
Remove a leftover special case of the ORM from a former version.
This fixes a performance issue, where an onchange recomputes a field on
one2many lines one by one.

X-original-commit: 16a75d85741db8a1f87c1d26503a9bb75197cf83
2020-02-26 12:57:05 +00:00
Raphael Collet 687793adca [IMP] core: do not warn about crappy upgrades in test modules
This allows modifications of models of test modules in stable versions.

closes odoo/odoo#46329

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-26 12:16:22 +00:00
Yoshi Tashiro 06d842d31f [IMP] base: use unnaccent Japanese prefectures
Very few people in Japan know how to type accented characters, which
brings a usability issue when the Japanese prefectures are defined
with accented characters.

closes odoo/odoo#46258

X-original-commit: db4ea065fee3e0344a65d2386799ffa6e7e47abc
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-25 14:16:20 +00:00
Sébastien Theys 6bb0963b6a [IMP] core: optimize read() by avoiding useless query
When the `select` returns nothing more than ids that are already known, there is
no need to make it at all.

This removes one query from `_read` every time it has to fetch only fields that
are stored in a different table (o2m, ...), which happens all the time when
reading a stored field first (triggering prefetch) and then reading a o2m.

The query that is now removed was used to check access rules, but the trick is
to use `check_access_rule` to verify the rules in python instead.

Part of task-2061122

closes odoo/odoo#36263

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-02-25 13:46:10 +00:00
Denis Ledoux c5b9bccf6b [FIX] doc: api.model no longer accept traditional style call
Since we dropped the old-api style compatibility layer,
some years ago.

This docstring was added to the 13.0 documentation
thanks to odoo/odoo#44838
So it's best not to mention this old-api style
in our latest documentation

closes odoo/odoo#46223

X-original-commit: 63691c78006fbf7077eb13f3045be21a18bbe753
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2020-02-25 12:06:06 +00:00
Lucas Perais (lpe) 9256492f10 [FIX] qweb2: ignore comments between branching directives
Have a template of that form:
```xml
<t t-if=""/>
<!-- Comment -->
<t t-elif=""/>
```

Before this commit, both python and JS crashed because any type of node
between branching directive was forbidden

After this commit, Comments are just ignored and removed, while actual
template nodes are still forbidden between branching directives
There is no crash anymore

closes odoo/odoo#45899

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-02-24 15:32:19 +00:00
Toufik Ben Jaa 1744878573 [FIX] base: access rights issue on users form
- The form view on `res.users` displays information about
    how many record rules, ACL and groups are applied to the users.

    In some cases the current users may not have the required
    access rights to compute those values.
    To fix this issue, the computed fields are now computed
    in `compute_sudo` mode

closes odoo/odoo#46149

X-original-commit: 653f81f49ba4d92648eb04209cdbe73894dfac08
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-02-24 16:39:26 +00:00
Raphael Collet dfab454732 [IMP] fields: inherited field on new record are set on parent records
This makes the behavior of `onchange()` consistent in the case of
inherited models (with `_inherits`).

closes odoo/odoo#45910

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-24 15:52:32 +00:00
Xavier Morel 9b00d352a9 [IMP] core: logging of array remoteobjects
The old path would just return e.g. `Array(2)` for an array of size 2,
which is not very useful when trying to see if an array's contents are
relevant to an issue.

Turns out arrays are serialized pretty much exactly like objects
without a subtype, just with property names being indices instead of
keys. So add a case which formats such remoteobjects as
array-literal-ish.

closes odoo/odoo#46056

X-original-commit: 6d5639024fa0f7501efe836e5571cd45bb46b123
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-24 10:22:38 +00:00
Swapnesh Shah 8c64021512 [IMP] base: add group by object on Access Rights
Create the same group by as available on ir.model.access

closes odoo/odoo#44677

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-24 08:18:35 +00:00
alt-odoo 8f70f203d0 [FIX] base: merge user contacts without company
If some contacts are linked to a user, we keep the company consistent
but we should do it only if a company is set on the destination partner.

opw-2199352

closes odoo/odoo#46000

X-original-commit: 3f9cb47cb6fdc240a58f3daa3bd4cf32f55cb084
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-21 21:06:03 +00:00
Romain Estievenart e0231481d6 [FIX] base,hr,web: kanban image sizing/look & feel
The image illustrating some kanban cards (like "Employees" or
"Contacts") has a weird scaling and rendering on smaller screen sizes.

Step to reproduce (on small screen):
1. Open Employee
2. Apply a filter
3. Picture is ugly (shape changes to get something pretty weird)

This commit fixes it by:
1. removing the rounding which was only applied (sic) on smaller screens
2. adjusting the size and/or the margins of the image to keep its ratio
   and the alignment with the other kanban cards.

Task ID: 2198419

closes odoo/odoo#45956

X-original-commit: dd5db84464998b45d0524055f9c96bcad894c4c9
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-02-21 14:28:04 +00:00
574d7f0d4c [IMP] core: import-compatible export of m2m fields
When performing an import-compatible export, m2m values would be
exported as a record per cell unless the `id` subfield was the first
to be exported. Which is not the case when using the export UI (as it
always adds the field itself before any subfield). This would make the
m2m not actually export-compatible in most cases.

* export m2m "display name" in an import compatible format as well
* re-prioritise exporting xids when there are multiple m2m exports in
  import-compatible mode
* never fall back on the o2m / non-import-compatible m2m path for m2ms
  in import-compatible mode

Note: if multiple m2m fields are specified only one of them gets filled.

Task 2065428

closes odoo/odoo#37407

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Ravi Singh <ras@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-02-21 12:12:19 +00:00
xmo-odoo 44aa17cc46 [REV] re-enable the multiple calls of initialize_sys_path
Some of the implicit side-effects got missed, namely that under some conditions
(e.g. using an odoo subcommand) `initialize_sys_path` can be called before the
config has been loaded at all, resulting in the first call not properly setting
up things, and one of the subsequent calls fixing things up.

Since this breaks workflows right now, quickly fix it, we'll re-investigate
how to fixup the entire thing in order to restrict & enforce a single call.

closes odoo/odoo#45844

X-original-commit: 6cb4c829e1559bcf836e4b573051760565b7d0c1
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-20 15:45:42 +00:00
Christophe Monniez 253d5341a4 [FIX] tests: remove memory limit for chrome headless
Since Chrome version 80, the V8 javascript engine is using an new
pointer compression feature [1]. This features tries to reserve more the
4GiB of memory. As a consequence, during HttpCase tests, odoo tries to
launch chrome headless in a subprocess but fails because of the
memory-limit-soft.

With this commit, the Chrome browser is spawned in a forked process
that removes the memory limit.

Also a new Chrome CLI switch is used to prevent crash reports to be sent
to google.

[1] https://v8.dev/blog/v8-release-80

closes odoo/odoo#45859

X-original-commit: 726d9c50720c2d3c9e617e998ed0dcd12272a271
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-02-20 16:53:33 +00:00
Christophe Monniez 426fc163ba [FIX] tests: avoid confusing traceback at browser start
During an HttpCase, when the Chrome browser starts, it may happens that
the websocket is unreachable. In such a case, the stop method is called
and tries to stop the browser gracefully by sending a `Browser.close`
through the websocket ... which is not reachable.

The result is a confusing traceback. With this commit, nothing is sent
is the websocket is not available.

Moreover, the `sigxcpu_handler` attribute is used in the stop method but
not yet declared. Fixed by moving it before calling the _chrome_start
method.

X-original-commit: 0d156fd3bc114b40680ca5aa0456e0f21a5b8cff
2020-02-20 16:53:33 +00:00
mreficent 3dffce34bf [IMP] fields: log warning for ignored selection
When a field is related, defining a selection or selection_add will
have no effect and the paramater is ignored.

Log a warning and fix all fields badly definied

Closes odoo/odoo#45716

closes odoo/odoo#45832

Related: odoo/enterprise#8613
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-20 14:58:33 +00:00
Adrien Dieudonne 62c9227fda [FIX] web: document layout configuration: style not scoped
Commit 9a482fc introduced change for the document layout preview:
all "td" tag included in clearfix were in display: flex;
Because of this some styles were broken in form views on mobile.

We could have only put this rule in the right scope but
we preferred to fix this correctly.

Steps to reproduce:
- Go to Settings
- General Settings
- Click on Configure Document Layout

Related to task-ID: 2184243

closes odoo/odoo#45830

X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-02-20 14:47:04 +00:00
Victor Feyens 5ccdc1540d [IMP] base: no use of default AND compute for non stored fields. 2020-02-20 14:51:13 +00:00
Cedric Snauwaert 07d5ea3779 [FIX] http.py: remove try except in JsonRequest.dispatch()
The idea is to make the dispatching and error-handling consistent for
JsonRequest and HTTPRequest.

In 8809c77f60 we introduced a way for
request-specific error-handling, but JsonRequest.dispatch() was
still catching all errors internally, instead of letting them bubble
up to ir_http._handle_exception()

By removing the internal try except in JsonRequest.dispatch(), we do not
change the behavior much as there are only a couple of "if" in
ir_http._handle_exception() before returning to the request-specific
handle_exception. However we give the opportunity to modules to
customize exception handling even for JsonRPC, the same way it is
possible for HTTP requests.

Here is a simple pseudo code of the flow

ir_http.dispatch():
	try:
		request.dispatch()
	catch Exception as e:
		ir_http._handle_exception(e)

ir_http.handle_exception(e)
	request._handle_exception(e)

closes odoo/odoo#45639

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-02-18 14:50:57 +00:00
Raphael Collet 60b0f6da34 [FIX] core: avoid invalidation of field 'ir.ui.view.arch' when setting it
This fixes the following issue.  Set the field `arch` on a view; this
automatically writes on `arch_db`, which is a translated field.  If some
translations are discarded, a call to `unlink()` invalidates the whole
cache.  And then things go wrong: when `arch_db` is validated, the field
`arch` is missing from cache, and the ORM sets it to `None` because the
field is still protected by the initial write!

Fix the issue by avoiding the call to `unlink()`, and do it in SQL
instead.

closes odoo/odoo#45740

X-original-commit: e7679152ee480a51ef2b6d208ae7a05b2ef61941
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-19 17:42:16 +00:00
Xavier-Do 7e9918dbe3 [FIX] core: improve get_files performances
On a standard odoo install, `MigrationManager._get_files` represent
more than 4% of an install. This is because the legacy
odoo/base/maintenance/migration path was added to upgrade.__path__
once by module, making the get_filed check 574^2 os.path.exists.

This commit adds a check on initialize_sys_path to call it only once,
and merge legacy path with upgrade-path management in order to benefit
of the `up not in upgrade.__path__` check. This second part of the fix
will also remove the local dir from the upgrades paths.

A further improvement would be to fix MigrationManager in order to skip
_get_file work on a fresh install, (wip by rco-odoo)

closes odoo/odoo#45699

X-original-commit: 497330a695ed52a33f9c9b9c27b149446de0db29
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-19 11:15:09 +00:00
Paul Morelle 98d5770e5d [FIX] tools: stop evaluating twice <function eval="..."> in _eval_xml
After a bad merge d785adba6c the eval code
was evaluated twice.

closes odoo/odoo#45554

X-original-commit: c0316bb807e6c2db9c3567cba1aeb52da946cae7
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2020-02-17 17:35:19 +00:00
Swapnesh Shah f69fa0af63 [FIX] base: paperformat_id is required on settings
Not setting a value for paperformat_id on 'Company Document Layout'
will also make paperformat_id False on the company but it is required
in the settings.

Without this commit, you can get in the weird situation of being able
to set a value on the document layout but having an error in the
general settings as a required field is missing.

Apply the same logic as in the other views

closes odoo/odoo#45527

X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-17 15:07:15 +00:00
jvm-odoo 49140ca834 [FIX] config: fix pg_dump not found
Issue

	- Remove ~/.odoorc
	- Launch a server
	- Try to dump the db in db manager

	Ok

	- Restart the server
	- Retry

	pg_dump not found

Cause

	When the .odoorc file is not there,
	the pg_path option is not present so
	the normalize method set it to None

	When the server is restarted, it re-checks
	the options (which are strings) and in the
	normalize method we check "if not pg_path"
	but 'None' is truthy so it thinks this is
	a real path.

Solution

	Check if not pg_path or if pg_path string
	is None

OPW-2189789

closes odoo/odoo#45369

X-original-commit: f080964694c01a79c52e05c0ceb42c18d4c77df5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-14 09:17:31 +00:00
Raphael Collet 84723d4278 [IMP] core: add warning when removing field on upgrade
The purpose is to force developers to explicitly manage the removal of
field via migration scripts.

closes odoo/odoo#45269

Related: odoo/upgrade#777
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-13 16:21:48 +00:00
Martin Trigaux 0cc8610923 [I18N] export saas-12.3 source terms
closes odoo/odoo#45285

X-original-commit: bb281e98f52a2716f00d43a07446a08df698c1dd
Related: odoo/enterprise#8413
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-02-13 11:45:39 +00:00
Debauche Stéphane 3b2b2ef9d8 [IMP] base: improve state creation usability
Purpose
=======
Improve the state creation flow.
Some users created states by mistake, we want to avoid this situation.

Specifications
==============
Do not allow to create country from the partner form view.

Disable the quick create of the state in the partner form view.

When we create a state from the partner form view, set by default the
country of the state to the country of the partner.

Task 2178289

closes odoo/odoo#44291

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-12 08:14:45 +00:00
Adrian Torres 9b0e976b9f [IMP] base: raise warning if no field in search view
Before this commit, it was possible (and common) to create search views
without fields and only filters, the consequence was that a search for
that particular search view was not possible. (See
https://github.com/odoo/enterprise/pull/7852)

With this commit, a warning is raised if no field is defined within a
search view, preventing these "common mistakes" from happening again.

closes odoo/odoo#45058

Task-id: 2179521
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-12 13:44:07 +00:00
Raphael Collet c8e79869a3 [FIX] core: delay of constraints in upgrade
Sometimes, constraints are not delayed during a module upgrade: the
module is 'to upgrade' but in 'init' mode :-/
Fix this by relying on the module's state only.

closes odoo/odoo#45179

X-original-commit: 878b6538961a9b6a5fe1c6ac68d4ff39391abcdf
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-12 11:17:54 +00:00
Raphael Collet eb08ac11ff [FIX] base: missing flush() before setting up registry
Custom models and fields set up the registry as part of their CRUD.
Make sure to flush() before setting up the registry, in order to avoid
neverending recomputations (as fixed by the former commit).

closes odoo/odoo#45163

X-original-commit: af6dbb5c7c165dcf37bf87ee76c0170795ecb574
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-02-12 10:16:12 +00:00
Xavier-Do 7483fdfce0 [FIX] core: flush env after pre upgrade scripts
In some case, a pre-migration script calls `xml_import.parse` to force
reload a no-update data in pre-script. It is possible that fields are
marked to recompute in the process. The problem is that the reference to
the field added in `env.all.tocompute` won't be the same as the
reference of the same field after calling `registry.setup_models()`,
leading to an infinite loop while recomputing this field, since
`fields.__get__` wont find `self` in `env.all.tocompute`.

This problem was discovered when trying to migrate a database with all
modules installed (no demo data) from 12.0 to 13.0 (for commit
references: http://runbot.odoo.com/runbot/build/1176576 with database
comming from http://runbot.odoo.com/runbot/build/1171714).

This commit adds a check before executing `registry.setup_models()` in
order to log when some fields to compute remain before breaking fields
references, and adds a `flush()` after pre-scripts to fix the current
issue.

X-original-commit: 41b9d810066774736c4077bba1dc9c9fba004f48
2020-02-12 10:16:11 +00:00
Victor Feyens fe7b0e828f [IMP] base: UI improvement
closes odoo/odoo#43676

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-11 14:48:52 +00:00
Victor Feyens 27650db8bb [IMP] base: onchange cleanup 2020-02-11 14:48:52 +00:00
Raphael Collet fd30d29d3c [FIX] core: log import traceback in debug mode
This is a followup of 1d553eea7b.

Systematically logging import tracebacks can fill up log files, and
waste disk space.  We therefore log those tracebacks in DEBUG mode, so
that they can be activated only when needed.

closes odoo/odoo#45075

X-original-commit: 017e3d798c55b1bdac221aea76d3d944f045ee65
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-11 11:39:25 +00:00
Victor Feyens d4e0fe018d [IMP] *: use ref= instead of eval="ref(' in xml field tags.
* Code cleanup
* Avoid a safe evaluation of the field value when loading those records.

closes odoo/odoo#44883

Related: odoo/enterprise#8283
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-02-11 13:07:06 +00:00
Nicolas Martinelli 12af185961 [FIX] api, product: search by pricelist
- Activate variants and pricelists
- Go to Product > Products Variants
- Search for anything on the 'Pricelist' filter

A traceback is raised: 'Can only create cache keys from hashable
values...'.

This comes from the following change:

https://github.com/odoo/odoo/blob/4b06fe19fa68255b7982d15e5847da2f6d6209fd/addons/web/static/src/js/views/control_panel/control_panel_model.js#L962

It returns a list instead of a string. Since a list is not hashable, it
causes the issue.

There are not much solutions since the context key `pricelist` can be a
`list` or an `int` (an ID). We force the cache key conversion to a tuple
to avoid the `TypeError` and handle the `list` use case (which was
broken on top of crashing).

opw-2187757

closes odoo/odoo#45064

X-original-commit: ec0a8767143b4c4818418281803c4f52fefa8d2a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-11 11:05:09 +00:00
Richard Mathot 9e78d55344 [FIX] models: ignore dependencies of fields inherited from custom fields
When adding a custom field, the ORM also adds it to all the inherits'ed
models, but with the state `base`, because those inherited fields are
automatic (created by the ORM).  However, dependencies are enforced for
`base` fields, while they can be ignored for `manual` ones.  This is a
problem when a custom field is fucked up: its inherited fields will make
the registry crash.

We fix the issue by not enforcing dependency check on fields inherits'ed
from custom fields.

opw-2191114

closes odoo/odoo#45024

X-original-commit: 2db0787dc9e8717200aaf1d71ac64df1c17f4143
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-02-10 16:22:24 +00:00