Commit Graph
3175 Commits
Author SHA1 Message Date
Adrian Torres 392a8d8f9e [FIX] base: handle models without associated xids at uninstall
If all the planets are correctly aligned, it is possible for a model to
not have any xids associated with it, if this happens then the computed
field that calculates the records to be deleted during an uninstall
may mistakingly add records of this xid-less model to the list of
records to be deleted, even if the actual uninstallation won't remove
these records.

opw-1904139

closes odoo/odoo#28388
2018-11-06 12:27:22 +00:00
Odoo Translation Bot 790bd62f14 [I18N] Update translation terms from Transifex 2018-11-04 01:27:12 +01:00
Christophe Simonis 5e055a2afd [MERGE] forward port branch saas-11.4 up to f6ca72b3ce 2018-11-02 10:52:55 +01:00
Odoo Translation Bot 29dc21ae4b [I18N] Update translation terms from Transifex 2018-10-28 01:25:21 +02:00
Xavier Morel 8c9174ff80 [FIX] base: handling of *_view_ref in SSF
The feature was not tested, and as it turns out completely broken:

* the non-raw string means the "backrefs" were really interpreted as
  octal literals
* the second backref was entirely wrong

Also add all loaded views to the field descriptor in case we might
have a use for it (and because inline sub-views are always stored on
the descriptor).

closes odoo/odoo#28194
2018-10-26 11:39:53 +00:00
Christophe Monniez e0219c7f39 [FIX] tests: avoid remaining requests
From times to times, warning are seen on the runbot during HttpCase
tests with the chrome headless browser.

Those warning are about Odoo trying to join remaining requests threads.
In the dumpstack, the thread seems blocked in the werkzeug
handle_one_request method, when trying to read the HTTP request line.

One explanation could be that Chrome opens a pre-connect socket for
a future use. When the HttpTest cleans the browser, the page stops
loading but (probably) keeps the socket open for a while.

That could explain the problem.

With this commit, a timeout is set on the request handler,
in the hope that it closes the pre-connect socket too.

Cheery-pick of f9ee8cf to avoid runbot_merge failures.

closes odoo/odoo#28193
2018-10-26 11:42:03 +00:00
Lucas Perais (lpe) 6389b358c8 [FIX] base: partner_merge: adapt to new administrator ID
closes odoo/odoo#28146
2018-10-25 10:05:13 +00:00
Raphael Collet 828b76d578 [FIX] models: make onchange return a smaller diff
Large diffs (specifically in x2many fields) cause performance issues.  They
overload the web client, which considers all returned fields as dirty.

closes odoo/odoo#27941
2018-10-23 14:25:38 +00:00
Stefan Rijnhart 4d8b0b723b [FIX] base: don't hardcode the new admin user id
There is no longer a priviledged user and the user named "Administrator" may
not have the id 2.

Instead of hardcoding an id, uses a group-based check

Remove the global variable ADMINUSER_ID to ensure nobody is using it (as it can
be a source of bugs when base.user_admin is not ID 2)

closes odoo/odoo#27432
2018-10-23 14:40:02 +00:00
Nicolas Lempereur dd94d06727 [FIX] web,base: report body rtl/ltr of language
Currently, the RTL/LTR direction of a report is the language direction
of the current user printing the report.

So for example a customer invoice in french can be RTL and a customer
invoice in arabic can be LTR.

With this changeset we keep a reference to the body language and use it
to choose direction later on.

opw-1890833
closes #27878
2018-10-23 15:51:16 +00:00
Gustavo Valverde d75de9ae53 [FIX] base: set Monday as first day in es_DO
This complies with ISO 8601 and it's also the first working day in the country.
Also used for payroll computations.

closes odoo/odoo#28041
2018-10-23 07:19:16 +00:00
Adrian Torres 2693918903 [FIX] xmlrpc: properly marshall date & datetime objects
Before this revision, trying to read a Date field using xmlrpc would
result in a marshalling error.

This is due to the fact that 960360afe4
changed the internal value of Date/Datetime fields to hold
datetime.date/datetime objects.

The xmlrpc layer is capable of converting datetimes to the XML
datetime representation, but this is not possible for datetime.date
objects.

In order to solve this, the Marshaller class used by python's
xmlrpc.client is overridden and monkey-patched, allowing to convert
datetime.date / datetime.datetime objects into properly formatted
strings.

opw-1896364

closes odoo/odoo#28022
2018-10-22 12:22:59 +00:00
Antoine Prieels (ANP) 218fbaf90b [IMP] snailmail: Change formatting of address in snailmail
The previos format displayed the fields 'street' and 'street2' on two different line, making the address too big for the address area allowed by Pingen.
2018-10-19 08:36:16 +00:00
Christophe Simonis b81c2bce84 [MERGE] forward port branch saas-11.4 up to 3c108977c1 2018-10-22 16:59:51 +02:00
Martin Trigaux 933165ec3a [FIX] models: restore warning on wrong record
Was lost during d5b687a48f

Set the module name in the context to be able to detect errors in xml and csv import

closes odoo/odoo#27680
2018-10-21 08:41:22 +00:00
Odoo Translation Bot de265ce63e [I18N] Update translation terms from Transifex 2018-10-21 01:25:56 +02:00
Christophe Simonis 1810f6be4c [FIX] core: early fail on missing foreign records
When installing/updating a module, verify existence of foreign records
before updating them.  Also handle forcecreate=False records.

Also fix misprefixed XML id in sale_quotation_builder.

closes odoo/odoo#27659
2018-10-19 11:23:47 +00:00
Adrian Torres 0ac93c3828 [FIX] loading: set dbdemo if demo install success
opw-1896028

closes odoo/odoo#27945
2018-10-19 07:42:30 +00:00
Thibault Delavallée 7429c61dfc [IMP] tests: add an helper in odoo tests in order to quickly create test users
Following great @odony review we decided to add a helper method allowing
to quickly create users in tests in a one-liner. It will allow to remove a
lot of duplicate code in various test classes and methods.

This method basically requires a login and a comma separated list of user
groups xml ids. Kwargs are supported to further customize the created
user. A custom context can be given to the creation as user creation in
odoo can support several options within standard addons, like mailing or
signup options.

Next commits will propagate the use of this helper in some test classes
notably in mail, hr and mass mailing.

This commit is linked to task ID 1889703 and PR #27526.
2018-10-18 13:56:56 +00:00
Christophe Simonis e9ae419fca [MERGE] forward port branch saas-11.3 up to 0de06a4132 2018-10-17 10:54:19 +02:00
Nicolas Martinelli 1f409dcea7 [FIX] base: do not crash if rtlcss.cmd is not found
closes odoo/odoo#27926
2018-10-18 08:14:29 +00:00
Christophe Simonis c9356a1096 [FIX] core: adapt forward-ported code after 4d581e26c2 2018-10-22 19:26:18 +02:00
Christophe Simonis 9dbb7d199c [MERGE] forward port branch 12.0 up to b81c2bce84 2018-10-22 17:57:08 +02:00
Géry Debongnie a8cec47c93 [IMP] assets: remove css files split
Before this commit, our asset bundles had a special behaviour for
bundles of type css: because of an old limitation in IE9, css files had
to be split to make sure they had less than 4095 rules per stylesheets.

Since we no longer support IE9, this code can be removed, which should
slightly simplify the bundle code, and should slightly reduce the number
of requests required to properly load odoo.

closes odoo/odoo#27933
2018-10-19 09:18:28 +00:00
Fabrice Henrion 9d7ad0fe54 [FIX] terminology
The last time when a user connected to Odoo is a different concept than the last time when a user authenticated to Odoo. I can authenticate once and connect many times afterwards (cookie/session).

closes odoo/odoo#27963
2018-10-19 08:02:17 +00:00
mreficent 77e5e8b7ff [REF] base: rename ir.server.object.lines type field to evaluation_type
Purpose of this commit is to rename type column to something matching the
the real business use of the field. That way it is easier to find and grep
in the code. It also lessens potential conflicts with type build-in python
function. It also lessens conflicts when using the field in JS as type
is a build-in attribute.

Renaming type column is a long-living issue. We choose to do it at the
beginning of the v13 development to catch errors as soon as possible.

This commit is linked to task ID 1896245. It is also a subpart of community
PR #27599.
2018-10-19 09:13:06 +00:00
mreficent fb7ac56d65 [REF] base: rename ir.logging type field to logging_type
Purpose of this commit is to rename type column to something matching the
the real business use of the field. That way it is easier to find and grep
in the code. It also lessens potential conflicts with type build-in python
function. It also lessens conflicts when using the field in JS as type
is a build-in attribute.

Renaming type column is a long-living issue. We choose to do it at the
beginning of the v13 development to catch errors as soon as possible.

This commit is linked to task ID 1896245. It is also a subpart of community
PR #27599.
2018-10-19 09:13:03 +00:00
Martin Trigaux 7e5afbefa7 [IMP] base: remove duplicated entry
Twice in the file

Coutresy of dhamedic, cf odoo/odoo#27826

closes odoo/odoo#27858
2018-10-16 16:01:41 +00:00
Andreas Raster 956b3ce54d [FIX] server: ignore broken symlinks
Previously broken symlinks would cause a FileNotFoundError
exception in the filesystem watcher thread spawned when using the
--dev=reload argument.

This problem appeared when using emacs to edit python files while
they are being watched by an odoo instance for changes. Emacs
creates a broken symlink as lockfile in the same directory as the
python file that it edits.

This commit makes the filesystem watcher silently ignore any
FileNotFoundError that occurs when it tries to open a file.

Fixes  #21214, closes #21215
2018-10-15 11:15:42 +02:00
Odoo Translation Bot 156d099e32 [I18N] Update translation terms from Transifex 2018-10-14 06:02:03 +02:00
Xavier Morel a8ee940e38 [REM] core: assert, ir_set and url tags from XML data files
* ir_set and url were accepted by the RNG despite ir_set having been
  removed back in 2015 or so and <url> having possibly never existed in
  the first place (could not find any reference to an <url> element
  outside of sitemap qweb templates)
* <assert> was essentially deprecated/removed in 2015 with the v9
  accounting having stopped running account_assert_test.xml, which was
  the last file using the tag so far as I can tell. The file itself
  remained as dead code until 2018
2018-10-11 15:01:59 +00:00
Xavier Morel 4d581e26c2 [REF] core: cleanup noupdate handling in XML import
Use the same pattern as for the envs: a stack of noupdate values pushed
and popped around data nodes.

Avoids re-parsing the same noupdate attribute on every node execution,
and completely removes the need to pass the nearest data node to every
_tag_ function.
2018-10-11 15:01:36 +00:00
Xavier Morel bf0ed03d0f [FIX] core: support for uid/context in XML data files
* add tests for uid/context on record & function & root nodes (odoo,
  data, openerp) "inherited" by record & function
* add rng validation to the test cases to ensure technical
  capabilities are matched by validation capabilities (which was not
  the case as we could validate nonsense and import stuff which didn't
  pass validation or something)
* extact uid/context into its own rng pattern
  - add uid support to record validation
  - add uid support to root nodes validation
  - fix uid support on function validation: was typoed to @id, which
    is not used anywhere in function tags loading & makes no sense
    as far as I can tell
* replace get_uid/get_context by get_env & reimplement the whole mess:
  build a stack of environments from the root nodes (each root node =
  one env in the stack, though the exact same env can be present
  multiple times if none of the root nodes has a @uid or @context) and
  leaves can build upon this "ready made" environment for their own
  uses or use it as-is.

  As a result, all uid/context should now properly transfer from the
  root nodes to the leaves needing them
* fix support for context on functions: was not actually implemented
  as the context was not propagated into the old-style API call
* add uid support to record & context is now inherited from env
2018-10-11 15:00:22 +00:00
Xavier Morel 77b5911137 [IMP] core: convert_xml refactorings to prepare for improvements
* add _tag_ methods for root nodes (remove some of the parse special
  casing)
* remove unnecessary/useless returns
* remove cr & uid (there's an env)
* remove mode argument from callbacks (redundant and confused with
  self.mode)
* try to cleanup menuitem callback a bit
* make second callback param not optional (because it's not)
2018-10-11 14:59:51 +00:00
Christophe Simonis 1ade6675c3 [MERGE] forward port branch 11.0 up to 717f458394 2018-10-11 16:29:46 +02:00
Christophe Simonis 717f458394 [MERGE] forward port branch saas-15 up to 93c22558f3 2018-10-11 14:48:49 +02:00
Christophe Simonis 93c22558f3 [MERGE] forward port branch saas-14 up to 77286e4296 2018-10-11 12:15:02 +02:00
Christophe Simonis 77286e4296 [MERGE] forward port branch 10.0 up to c2688e45f3 2018-10-11 10:34:48 +02:00
Christophe Simonis 7415f40fbd [MERGE] forward port branch 11.0 up to a69f117bbf 2018-10-10 14:40:01 +02:00
Sébastien Theys 80d363cd31 [FIX] tools: expand user and vars for data_dir 2018-10-10 14:03:59 +02:00
Stijn Houben 26d67991c2 [FIX] base: allow admin to modify paperformats
If a user creates a paperformat, he should be able to modify it too.
Employees have no reason to modify the paperformat though (nor create).
Having a malicious employee modifying an existing report may be dangerous.

[CLA] signature for stijnh92

Fixes #26292

closes odoo/odoo#27444
2018-10-10 13:13:19 +00:00
Nicolas Martinelli 177ea3b96d [FIX] base: RTLCSS on Windows
RTLCSS is not working on Windows for several reasons:
- the executable is called `rtlcss.cmd`
- rtlcss is not available in the System Path; it is only available in
  the User Path

In this commit, we correct the first issue.

opw-1892952
2018-10-17 13:23:08 +00:00
Swapnesh Shah 44287eb719 [FIX] doc: correct links to categories
Was pointing to a file that no longer exists

Fixes odoo/odoo#27741

closes odoo/odoo#27755
2018-10-17 10:03:25 +00:00
Swapnesh Shah e6e0d7ae78 [FIX] base,mail: do not include field attachments in attachment_count
The _search was already excluding these attachments but not the read_group
Avoid the read_group from mail to search on all existing attachments

Fixes odoo/odoo#27673

closes odoo/odoo#27698
2018-10-17 11:38:17 +00:00
Christophe Simonis 6d3477cbb7 [FIX] base: do not enforce module state in module declaration in xml file
Modules are automatically created with adequate state by introspecting
the addons available in addons-path during database initialization.
Auto-installable modules are also marked as `to install` at the same
time.

However, forcing their state as `uninstallable` will forbid them to be
installed.

This is the case of `web_mobile`.

The solution is to simply let the modules created via xml to have a
default state of `uninstallable`.

Moreover, this is a better default value.

closes odoo/odoo#27852
2018-10-16 13:04:03 +00:00
Denis Ledoux 3823dcacef [FIX] http, server: cross-platform memory limit management
This revision aims to support the memory limits
on Linux, Windows and MacOSX according to their own spefication
regarding their memory management.

Among others, it brings the possibility to
use the multi-workers mode on Windows and MacOSX.

e.g.
- Windows does not support `resource`,
  and therefore we skip to set the hard limit
- MacOSX allocates a large virtual memory for each process
  even if the memory is not actually used,
  and therefore using the VMS to limit the memory is pointless
  as it will always exceeds the default soft memory limit.
  We therefore choose to use the RSS to limit the memory

closes odoo/odoo#27848
2018-10-16 15:37:40 +00:00
Denis Ledoux b34b7d4270 [FIX] server.py: resource is not available on Windows
Rev. dcb56412d6
introduces limits for the threadedserver

It uses `resource` to set the hard limit,
but unfortunately `resource` is not available on Windows.

As in the GeventServer, we therefore set the resource
hard limit within a `if os.name == 'posix'` block,
as in rev.
c68b41bff2
2018-10-16 12:14:46 +02:00
Denis Ledoux dcb56412d6 [IMP] server.py: implements limits (real) for multi-threading
The multi-threaded server graceful stop policy is now as follows:
 - shutdown the server so it does not accept new requests (the socket remains open),
 - wait for remaining requests to finish up to a certain time (e.g. 1 second)

Previously, the multi-threaded server waited indefinitely for requests to finish.

The reload policy when a thread reaches a limit is as following:
 - wait there is no other running requests, up to 1 minute
 - then stop the server (with the above graceful stop policy applied),
 - then reload the server, therefore accepting new requests again.
- The socket is not closed during this operation.
  This allows the inverse proxy to queue the requests arriving during
  the time the server is shutted down and therefore not accepting new requests.
  This allows a transparent restart for the users, as their
  requests done during the shutting down of the server are not rejected but queued.
- When a thread reaches a limit, we reload the whole threaded server instead of
  just killing this thread. Killing a thread is not a good practice as it could
  lead to dead locks in case these threads acquire locks.
  Killing a thread that acquired a lock would lead for this lock to never be
  released.

Regarding the override of `_handle_request_noblock`:
  In `socketserver`,
  when `shutdown` is called
  `__shutdown_request` is set to True,
  https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L241-L249
  This tells the server to no longer accept requests. Callstack below:
  - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L231-L234
  - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L308
  - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L487

  Unfortunately, this is very possible the HTTP server is already polling for a request when this flag is set
  to `True` by the main thread:
  - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L232
  As the poll_interval is set to 0.5s:
  - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L215
  if a request arrives within 500ms after the server is shut down,
  the request is accepted, while the server is shutdown.

  We want to prevent this: Once the server is marked as shut down, we want it to no longer accept requests:
  so the inverse proxy knows it has to queue the request.

closes odoo/odoo#24982
2018-10-15 07:46:52 +00:00
Odoo Translation Bot e774b2cb1c [I18N] Update translation terms from Transifex 2018-10-14 01:23:43 +02:00
Christophe Simonis a5772d4338 [MERGE] forward port branch 9.0 up to 75388edd9c 2018-10-09 16:23:35 +02:00