Commit Graph
188 Commits
Author SHA1 Message Date
Christophe Simonis d5e1fd16b4 [MERGE] forward port branch saas-12.4 up to cda4f3c308 2019-07-29 14:10:30 +02:00
Xavier-Do 735ee5487c [IMP] core: improve test logs
1. Make test logs clearer & remove redundancies

Instead of having an ERROR log right when the test fails then print
the useful / relevant information at the end of the test suite,
immediately print the traceback. Keep the final summary. Also avoids
having to wait for the entire test suite to end before a dev' can know
the failure details of a specific test.

Done by working at a lower level and replacing the custom
test stream mess by a custom Result class which prints and formats the
information we want. Replace TextTestRunner by a bare-bones custom
Runner object to tie it in.

2. Provide useful location information on test failure

Leverage the work above to log the test function's failure location:
previously logging would point to within TestStream which is not
useful.

Here, on failure the traceback is used to discover the caller info and
point to the test line which fails instead. similar to unittest's
_exc_info_to_string (https://github.com/python/cpython/blob/93e8aa62cfd0a61efed4a61a2ffc2283ae986ef2/Lib/unittest/result.py#L173).

3. Replace direct logging in browser_js by raising errors

Properly marks the test as in error, and the error traceback points to
the tour definition / launcher (python side) rather than common.py
and/or module.py.

Also removes unused dbname parameter that was added in
/278ed718e9805edf088642ba10d3b7c4e5716c31/openerp/modules/module.py#L361
for nor visible reason

closes odoo/odoo#34996

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-07-25 12:09:27 +00:00
Christophe Simonis bfd34e14b1 [MERGE] forward port branch saas-12.3 up to 40e8b67179 2019-07-26 15:12:29 +02:00
Martin Trigaux a98427834e [MERGE] Forward port of saas-12.2 to saas-12.3 up to 860ab5a1c2
closes odoo/odoo#35119

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-24 10:32:23 +00:00
Martin Trigaux e266c7c98a [MERGE] Forward port of 12.0 to saas-12.2 up to 5e4c1b3701 2019-07-23 13:41:00 +02:00
Pratima GuptaandSébastien Theys 61de1c263a [IMP] portal: allow attachment upload from portal chatter
Before this commit, it was only possible to add attachments on documents from
the backend or by sending them by email.

It is now possible to add them also from the portal chatter, including for
portal/public users who have a valid access_token.

Part of task-37264

closes odoo/odoo#34526

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>


Co-authored-by: Pratima Gupta <pgu@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2019-07-24 12:30:31 +00:00
Martin Trigaux beba36416f [MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c 2019-07-16 16:36:40 +02:00
Martin Trigaux 40421be73c [MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7
closes odoo/odoo#34907

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 11:44:38 +00:00
Martin Trigaux cf8e74a1a7 [MERGE] Forward port of 12.0 to saas-12.2 up to 1bd434da34
closes odoo/odoo#34901

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 09:14:17 +00:00
Xavier-Do dd85e312cd [FIX] core: backport of 62533ec7 and f167ae7d
The ready code warning timeout of 2 seconds can be confusing since
it is triggered just after the 2 seconds. We can log this message
at the end in order to give the real timeout.

In JS tests, when the ready code takes too much time, a warning is
logged. As a consequence, the runbot updates the github status as a
failure, causing real pain to people who simply wants to merge their
features.

With this commit the warning is changed into an info and the runbot will
be happy.

closes odoo/odoo#34865

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-07-15 11:37:14 +00:00
Martin Trigaux 1f5a4649a6 [MERGE] Forward port of saas-12.3 to saas-12.4 up to 87fc1554d6
closes odoo/odoo#34820

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-12 13:59:35 +00:00
Martin Trigaux c962b2cd11 [MERGE] Forwardport of saas-12.2 to saas-12.3 up to 01365a3f62
closes odoo/odoo#34747

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-12 07:22:41 +00:00
Xavier-Do 95b4f2ab4b [IMP] core: improve test_tags
Add the support to be able to specify exlicitely module, class and method name in test_tags

Before this commit, there is no distinction between module tag and test tag. Meaning
that --test-tag module_name will replace the default +standard tag and execute all test
of the module.

This commit tries to keep the initial behaviour, while addind new features, like explicit
modules tag with /module_name, as well as class (:class) and method (.method)

Some usage examples:
--test_tags /module will execute all standard test of module
--test_tags :class will execute all standard test with class name 'class'
--test_tags .method will execute all standard test with method name 'method'
--test_tags external/module will execute all external test of module
--test_tags */module will execute all tests of module,
--test_tags */module,-standard will execute all non standard tests of module,
--test_tags -/website:TestUiTranslate.test_admin_tour_rte_translator will disable only rte translator test

closes odoo/odoo#34756

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-07-11 09:03:14 +00:00
Raphael Collet b8f4ad585e [FIX] test: assertRaises() without environment 2019-07-11 08:48:18 +00:00
Martin Trigaux 00ef2653da [MERGE] Forward port of 12.0 to saas-12.2 up to 3b1d00acda
closes odoo/odoo#34732

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-10 10:14:06 +00:00
Xavier Morel 3e63d8efce [ADD] core: support for parent.xxx in modifiers of o2m sub-fields
closes odoo/odoo#34699

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-07-09 12:41:41 +00:00
Martin Trigaux 2be2f64aeb [FIX] tests: properly log errors
If a test is failing with assertRecordValues, the comparison and the error
logging were not computed the same way.
The _compare_candidate was accessing the record via
record[field_name]
which uses the cache

While the _format_message was doing
records.read(...)
which queries directly the database.

If the test was failing (correctly) because of a wrong cache invalidation
(e.g. update the value directly in SQL without invalidating the cache),
the error message would look like:

AssertionError: Record doesn't match expected values at index 0.
Current values:
{'id': 42, 'name': 'Foo'}
Expected values:
{'name': 'Foo'}

closes odoo/odoo#34589

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-04 13:33:37 +00:00
Christophe Simonis cf51b5f25d [MERGE] forward port branch saas-12.3 up to 793933a128 2019-06-25 14:23:48 +02:00
Christophe Simonis 78b2063b29 [MERGE] forward port branch saas-12.2 up to 8747d72f1e 2019-06-21 15:16:54 +02:00
Christophe Simonis be780012bf [MERGE] forward port branch 12.0 up to 0e72b983c3 2019-06-21 11:06:04 +02:00
Thanh Dodeur f3e10f6980 [FIX] base, web: set 304 status in binary_content
Before this commit, the No Change status wasn't properly set because
the `filehash` wasn't passed to `_binary_set_headers` and because
the status was not changed to 304 if it was already set to 200 earlier.

This commit fixes this issue and also prevents images to be processed
in `content_image` if the status is 304.

opw-2008426

closes odoo/odoo#34032

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-06-19 12:31:07 +00:00
Adrian Torres 46d12675a7 [FIX] tests: allow False as value for required booleans in SSF
A required boolean accepts two values, True and False, however the SSF
and the web-client assume False to be equal to NULL and treat them
interchangeably.

In the SSF, we verify that a required field is filled by checking that
its value is different from False, however False is a valid value for a
boolean, this means that setting a required boolean to False would never
work in the SSF.

This commit overcomes this issue by simply skipping the check for fields
of type boolean.

closes odoo/odoo#34729

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-07-10 08:58:27 +00:00
Christophe Monniez 0dc4a63e2d [IMP] tests: save screenshots and screencasts in temp
Actually, when a browser_js test is running, screencasts and screenshots
are saved only if a "--logfile" parameter is specified.

This is problematic with the runbot because '--logfile' arg is not
provided when running tests.  Also, in most situations, developpers
prefer to have logs on stdout.

With this commit, two CLI args are added to specify screencasts and
screenshots directories. If no screenshots dir is provided, it defaults
to "{tmp_dir}/odoo_tests/{db_name}/screenshots".

It means that screenshots are always enabled during browser_js tests.

If screencasts arg is given, it enables screencasts and save them in
"DIR/{db_name}/screencasts". If the screencasts parameter is "1", DIR
will be the same as for screenshots.

The ffmpeg tools is used to encode frames into a video. If the ffmpeg
tool is not found on the system, the frames are kept as pngs files
instead.

closes odoo/odoo#34640

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-07-19 12:14:36 +00:00
Xavier-Do 154703d21c [IMP] core: log traceback in one group
Traceback coming from tests are currently logged
line by line. This will implies that runbot will have one
ir_logging entry per line which is not practical. More than
that, the log prefix can make the traceback less readable
because of line returns and difficult to copy paste.

This commit simply remove this feature. After discussion with odo
and chs, we will also remove the docstring from test shortDescription
since most of the time this information is not clear and can be accessed
in source code if needed.

closes odoo/odoo#33911

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-06-05 14:34:33 +00:00
Christophe Monniez f167ae7d6e [FIX] core: change ready code warning into info
In JS tests, when the ready code takes too much time, a warning is
logged. As a consequence, the runbot updates the github status as a
failure, causing real pain to people who simply wants to merge their
features.

With this commit the warning is changed into an info and the runbot will
be happy.

closes odoo/odoo#33931

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-06-06 07:43:58 +00:00
Christophe Simonis 71a50a2214 [MERGE] forward port branch saas-12.3 up to 409679866b 2019-06-06 11:54:35 +02:00
Christophe Monniez 38cc295235 [FIX] core: catch error when removing chrome profile
For a not yet known reason, a race condition appeared during HttpCase
tests that use ChromeBrowser. When the test is finished, failed or not,
the Chrome broser instance is terminated and the temporary profile
directory is removed. Sometimes, a file is still written in the profile
dir during the shutil.rmtree processing, when it tries to remove
directories that should be empty, causing a traceback.

With this commit, the error is simply ignored.
As on the runbot, tests are run in Docker containers, it's not harmful
to keep a directory.

closes odoo/odoo#34168

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-06-17 08:33:10 +00:00
Christophe Simonis c8d7ad9a6b [MERGE] forward port branch saas-12.2 up to 995aa1685e 2019-06-03 15:49:31 +02:00
Christophe Simonis cfe0523714 [MERGE] forward port branch 12.0 up to 8f21148e1a 2019-05-31 14:37:38 +02:00
Raphael Collet 9db8497a99 [FIX] tests: Form must perform onchange with actual record
closes odoo/odoo#33557

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-05-22 08:45:10 +00:00
Xavier-Do 62533ec752 [FIX] core: improve ready code warning timeout
The ready code warning timeout of 2 seconds can be confusing since
it is triggered just after the 2 seconds. We can log this message
at the end in order to give the real timeout.

closes odoo/odoo#33478

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-05-18 10:29:02 +00:00
Christophe Simonis 3fc2577c01 [MERGE] forward port branch saas-12.2 up to be3c981423 2019-04-11 19:27:36 +02:00
Christophe Simonis be3c981423 [MERGE] forward port branch saas-12.1 up to 636df25f21 2019-04-11 18:17:25 +02:00
Christophe Simonis 636df25f21 [MERGE] forward port branch 12.0 up to c9d3653f48 2019-04-11 18:00:27 +02:00
Xavier Morel 6bd9e71d9d [FIX] SSF: misinterpretation of onchange command (4)
From an onchange, at this point, (4) doesn't mean "no change" it means
"reset to database values". Through the interplay of client and server
reverse-engineering one another at this point the client (is supposed
to) assume the o2m results are "complete" and a diff from the
current *in-database* values rather than the in-client (sent to the
server) ones.

So a (1) should completely replace all existing values, and a (4)
should just remove all of them (but keep the record linked).

closes odoo/odoo#32617

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-04-11 07:49:21 +00:00
Christophe Simonis 3f95b074e9 [MERGE] forward port branch saas-12.2 up to f2be461f09 2019-04-05 18:46:10 +02:00
Christophe Simonis f2be461f09 [MERGE] forward port branch saas-12.1 up to f2d0995362 2019-04-05 10:50:56 +02:00
Christophe Simonis d29e8cf423 [MERGE] forward port branch 12.0 up to 7e4b0350c3 2019-04-04 19:01:12 +02:00
Xavier Morel 7e4b0350c3 [FIX] core: handle multi level o2m in SSF
Technically it does 3 different things:

* switch from 1 level of o2m to 2 levels of o2m when recursing
* handles `parent.<xxx>` readonly modifiers on o2m subfields
* handles `id` readonly modifiers on o2m subfields (already worked in the
  normal case but not for o2m records from default_get)

The last two especially are temporary quickfixes, that will need proper fixes.

closes odoo/odoo#32428

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-04-04 14:20:51 +00:00
Christophe Simonis d32420397d [MERGE] forward port branch 12.0 up to 251021796c 2019-04-04 11:20:03 +02:00
Xavier Morel ef8df8fb4e [FIX] core: don't send readonly fields in o2m in SSF
The SSF would correctly filter out readonly fields when saving a
toplevel form, however it could not remove readonly values when saving
o2m pseudo-records to the parent form (as these would be expected to
remain available for reading upon the next edition and whatnot), so
these values would get sent in 0/1 commands.

Filter out these fields during the parent / toplevel save call.

Complexity notes:

* evaluating readonly modifiers requires the entire record, so
  unchanged fields still have to be written back to the parent form
  and be filtered out when *it* is set up for save, an alternative
  would be to store the `changed` and `readonly` flags alongside the
  record dict, and have the post-process only override the
  pre-computed readonly flag using force_save
* had to fix a test to match the new behaviour, the post-edition
  states turns out to be in line with the client's behaviour (or how
  it looks anyway)

Fixes #32019
2019-04-03 08:44:22 +00:00
Xavier Morel 922d77a291 [FIX] core: infinite recursion in SSF on self-recursive models
The extra setup probably affects any o2m whose edition view itself
contains an o2m, but most likely to blow up entirely on models with
some sort of tree structure (parent/child relationship): the SSF
eagerly loads and setups the o2m's view, and the o2m's o2m's, ... ad
infinitam.

A better / cleaner fix would be to set up the subview on-demand (and
possibly cache it), but the rest of the o2m stuff is unlikely to work
correctly recursively so just don't recurse the o2m view setup at all
for now.

fixes #31458
2019-04-03 08:44:21 +00:00
Xavier Morel 7e0b29cbcd [FIX] core: backport changes in 12.1/master to 12.0
PRs #28645 and #31494 were not applied to 12.0, but there's no reason
not to, they should only fix things (make behaviours more in-line with
the regular client), and since o2m is an area where more fixes are
needed and it would be nice to have them in 12.0...
2019-04-01 10:34:47 +00:00
Christophe Simonis 71faa19af0 [MERGE] forward port branch saas-12.1 up to 2b3296bbf8 2019-03-11 14:42:34 +01:00
Christophe Simonis 2c5c9b8342 [MERGE] forward port branch 12.0 up to c023d0784f 2019-03-08 17:56:14 +01:00
Xavier Morel f9d3b5b7df [FIX] core: order of fields in onchange of SSF
When calling the initial (create / default_get) onchange, the SSF
would send the list of fields in whatever order was provided by the
fields map of fields_view_get.

The web client uses view ordering, and it turns out some uses / tests
have dependencies between onchanges (e.g. _create_payment in
test_account_reports) which break on some orderings of the fields.

Send the initial onchange using view-ordered fields in the SSF as
well.

closes odoo/odoo#31494
2019-02-28 10:58:33 +00:00
Christophe Simonis 06898fac3c [MERGE] forward port branch saas-12.1 up to f9d3b5b7df 2019-02-28 13:47:09 +01:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Christophe Simonis 7f9b7beed8 [MERGE] forward port branch 12.0 up to b2db72c9d1 2019-02-21 21:36:52 +01:00
Christophe Simonis b2db72c9d1 [FIX] core: handle multiple m2o levels in Form
closes odoo/odoo#31335
2019-02-21 17:03:27 +00:00