Commit Graph
767 Commits
Author SHA1 Message Date
Xavier Morel 4d6d5c8290 [FIX] P3: stupid use of hasattr
In Python 2, hasattr swallows *any* exception raised during the
access. In Python 3, it only swallows AttributeError.

Accessing an attribute on an unbound threadlocal proxy raises
RuntimeError, while running test_ir_http_mimetype ``request`` is
unbound, in Python 2 ``hasattr`` would return ``False`` on an unbound
threadlocal, in Python 3 it lets ``RuntimeError`` pass through blowing
up the test.

Fix this by just checking if the threadlocal is bound by using it as a
boolean…
2017-08-19 02:34:22 +02:00
Xavier Morel 25df2352f5 [FIX] P3: / has become 'real division' in all cases 2017-08-19 02:34:22 +02:00
Xavier Morel a4ada695e1 [FIX] P3: absolute ordering removed 2017-08-19 02:34:21 +02:00
Xavier Morel 70599807a1 [FIX] P3: round() compatibility shim
In Python 3 round:

* rounds half to even (banker's rounding) rather than up
* returns an int if not given a precision (or given a precision of
  None)
* discards the negative sign when rounding to 0

Add a compatibility shim which implements P2 behaviour and at least
allows passing float_utils's tests.

Implementing float_round on top of Decimal was attempted but did not
work: although Decimal.quantize takes a non-integral
Decimal (e.g. ``d.quantize(D('0.001'))``) it only supports integral
powers of 10 and does not support quantizing to e.g. 0.05: while that
will not fail it will just use the exponent for quantization and 0.05
is thus equivalent to 0.01, which is not what we want if e.g. need to
round a value to 5 cents.

This is hinted at but maybe not clearly spelled out by the official
documentation:

> Return a value equal to the first operand after rounding
> and **having the exponent of** the second operand.

Also convert a bunch of hand-rolled currency rounding to just using
the round() method on res.currency.
2017-08-19 02:34:20 +02:00
Christophe Simonis 48b2ce60ed [MERGE] forward port branch saas-16 up to 85571bb78c 2017-08-10 17:01:05 +02:00
Christophe Simonis 85571bb78c [MERGE] forward port branch saas-15 up to dde62073ba 2017-08-10 16:22:36 +02:00
Christophe Simonis dde62073ba [MERGE] forward port branch saas-14 up to a2361e23ea 2017-08-10 16:17:28 +02:00
Christophe Simonis a2361e23ea [MERGE] forward port branch 10.0 up to 544aa9b04a 2017-08-10 15:45:07 +02:00
xmo-odoo d140f0ef0e [FIX] prefetch issues on computed/related fields (#18644)
When deciding to prefetch records (getting records from the cache with
no value for the field being fetched), if the field was computed
`determine_value` would just get all records, not limited by the normal
prefetch limit; for large recordsets this would generate gigantic
prefetch lists for records we may not need at all.

Fix by applying the `PREFETCH_MAX` limit to records from the cache as is
done in `_prefetch_field`.

Complementarily, when traversing related fields the prefetch
environment would be lost and every record would get an empty prefetch
environment, so the values would ultimately be read one by one.

Example: select (search) 1000 product.product records, access a
related field (e.g. categ_id) in a loop, on the first iteration the
system would first read 1000 templates, then it would read each
categ_id individually, resulting in >1000 SQL queries rather than the
~2 we would expect.

Fixes #18511
2017-08-10 14:51:27 +02:00
Christophe Simonis c3d710d2f6 [MERGE] forward port branch saas-14 up to 80ac087d6e 2017-08-09 17:11:10 +02:00
Christophe Simonis 80ac087d6e [MERGE] forward port branch 10.0 up to f69655829a 2017-08-09 15:53:37 +02:00
Adrien Dieudonne 99e38c04bf [FIX] test_main_flows: don't click behind modal
In the main_flow_tour, we edit a related record of a many2one in a
one2many. A modal is displayed and we make some changes. We
then click on 'Save' in the dialog. The next step is to add a new record
in the one2many, so we click on 'Add an item'. However, we didn't
wait for the modal to be closed before clicking, which is actually not
possible in practice (because of the modal backdrop).

This made the tour fail when run from the browser, since commit
c300e5e, which produces a redraw of the line containing the
many2one that has been edited.

This rev. ensures that we wait for the modal to be closed before
adding a second record.
2017-08-09 09:04:30 +02:00
Christophe Simonis 40a82cdfda [FIX] http: ensure registry is still bound to the request before using it
A user can be logged out during a request, loosing the database (and
thus registry) information.
2017-08-08 19:14:05 +02:00
Odoo Translation Bot 47d84fca1c [I18N] Update translation terms from Transifex 2017-08-06 07:14:52 +02:00
Odoo Translation Bot b5ce70e70e [I18N] Update translation terms from Transifex 2017-08-06 04:40:09 +02:00
Fabien Meghazi 2c0f6f39d7 [IMP] http: improve dumpstacks and remaining requests handling during tests (#18640)
This patch modifies Root#dispatch() in order to keep the httprequest url
in the current thread's attribute and use if for dumpstacks and the
phantomjs tests remaining requests handling.

Also added a counter in order to avoid looping forever when trying to join unclosed http requests
in phantomjs test suite after a phantomjs failure + added a log.warning in such a case so it's easier to troubleshoot runbot's ir.logging.
2017-08-03 10:50:18 +02:00
Nicolas Martinelli ce8c3af3a9 [FIX] base: default company on rate
- Activate multi-company
- Company B is parent of Company A
- Admin is in Company A
- Demo is in Company B
- Create a rate with Demo

The rate is recorded on Company A, not Company B as expected.

This is because we call: `self.env.user._get_company()` which would be
equivalent to `self.env.user.env.user.company_id`. Since the user is
browsed as `sudo`, it returns the company of the Admin.

opw-753139
2017-08-02 14:04:35 +02:00
Yannick Tivisse ee5ebbadab [FIX] base/module: Use a correct env to load next action on install
Bug introduced in https://github.com/odoo/odoo/commit/c8601f4384e0c95abc92d1f0b3092cfe2cb2a79d

Purpose
=======

If a module installation is supposed to load an action (example: a wizard like in l10n_eu_service) and if the related action is defined in this module (example: l10n_eu_service.wizard), currently we're using the environment defined on self, which is not updated after the module install, and the key is not defined in the registry.

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

Instead of using the environment on self, let's use the new environment created after the cursor commit.
2017-08-02 12:32:24 +02:00
Christophe Simonis 072411b336 [MERGE] forward port branch saas-16 up to 8d89148d13 2017-08-02 01:08:42 +02:00
Christophe Simonis 8d89148d13 [MERGE] forward port branch saas-15 up to 5e19f28bfc 2017-08-01 23:11:27 +02:00
Christophe Simonis 5e19f28bfc [MERGE] forward port branch saas-14 up to d0ece6cd89 2017-08-01 23:07:22 +02:00
Christophe Simonis d0ece6cd89 [MERGE] forward port branch 10.0 up to afd4b68acc 2017-08-01 23:06:43 +02:00
Christophe Simonis d1cf4f9672 [MERGE] forward port branch saas-11 up to ed36929265 2017-08-01 22:39:16 +02:00
Christophe Simonis 6990c28d05 [MERGE] forward port branch saas-16 up to a42b056ca9 2017-08-01 18:00:22 +02:00
Christophe Simonis a42b056ca9 [MERGE] forward port branch saas-15 up to d3154e0ef4 2017-08-01 17:59:16 +02:00
Christophe Simonis d3154e0ef4 [MERGE] forward port branch saas-14 up to af9868bc28 2017-08-01 17:54:09 +02:00
Christophe Simonis af9868bc28 [MERGE] forward port branch 10.0 up to e6ad245634 2017-08-01 17:22:43 +02:00
Jeremy Kersten 856f35eb21 [FIX] UserError: don't display None in Warning popup.
UserError uses a retrocompatibility function 'except_orm' which one can take a
second parameters. The default value of this second param is None, so if we
don't force an empty string, we will see a None on each raise UserError as last line.
2017-08-01 10:43:36 +02:00
Christophe Simonis 391a29dc42 [MERGE] forward port branch saas-16 up to 3becbd764d 2017-07-31 19:07:04 +02:00
Christophe Simonis 3becbd764d [FIX] test_main_flows: wait buttons to be active before triggering them
Since a1f7aa3362, buttons are deactivated
during action.
2017-07-31 18:59:30 +02:00
Christophe Simonis 3462ec3787 [FIX] test_main_flows: adapt tour to new view layout 2017-07-31 16:09:36 +02:00
Christophe Simonis f46a393602 [MERGE] forward port branch saas-16 up to 09d698d05f 2017-07-31 14:53:06 +02:00
Christophe Simonis 09d698d05f [MERGE] forward port branch saas-15 up to a6900c43b4 2017-07-31 14:09:34 +02:00
Christophe Simonis a6900c43b4 [MERGE] forward port branch saas-14 up to 9cae991345 2017-07-31 12:59:48 +02:00
Christophe Simonis 9cae991345 [MERGE] forward port branch 10.0 up to 1e64a88cd3 2017-07-31 11:45:29 +02:00
Fabien Meghazi b244f31151 [FIX] server: don't crash in case we can't check if a database exists
In case Postresgl access rights prevents the pguser to access
`pg_database`, the server should not crash when trying to create the
database because the pguser does not have the right to check if the
database exists and he won't be able to create a new database anyway.

However the database might exists and in such a case the flow should
continue. This patch allows the flow to be resumed in such a case, and
in case the database did not actually exists, a warning will tell the
user that it was not possible to check if the db existed and the
registry for this database will fail to be loaded afterward.
2017-07-31 10:03:45 +02:00
Odoo Translation Bot 90282fa2d5 [I18N] Update translation terms from Transifex 2017-07-30 07:14:49 +02:00
Odoo Translation Bot b1e79e85bd [I18N] Update translation terms from Transifex 2017-07-30 04:40:00 +02:00
Christophe Simonis 4d5ff6401c [MERGE] forward port branch saas-16 up to b76109173a 2017-07-28 18:37:10 +02:00
Christophe Simonis b76109173a [MERGE] forward port branch saas-15 up to c0ec09e9d5 2017-07-28 18:11:07 +02:00
Christophe Simonis c0ec09e9d5 [MERGE] forward port branch saas-14 up to be77cf7f5f 2017-07-28 17:25:45 +02:00
Christophe Simonis be77cf7f5f [MERGE] forward port branch 10.0 up to e686385138 2017-07-28 16:56:14 +02:00
Christophe Simonis e686385138 [MERGE] forward port branch saas-11 up to 5e6637a240 2017-07-28 16:26:57 +02:00
Christophe Simonis a7b7576536 [FIX] test_converter: declare string containing unicode as unicode 2017-07-28 15:41:46 +02:00
David Monjoie 3b3f6f04af [FIX] web: save changes when readonly if force_save is set
In previous versions, readonly used to prevent sending the values
of the fields to the server. However, it was not working properly
for fields which have their own sub-arch in the view, as the value
used to be sent regardless of the readonly value.

In the new views, the readonly modifier is never overlooked, which
created a bug in the stock_picking_return wizard which was not
able to return products received from a po anymore. Basically the
value of the product_id field was not sent so the create crashed.

This commit introduces a new "force_save" modifier which is used
to express that we want to save the value of the field even though
it is readonly from a user interface point of view.
2017-07-28 08:29:12 +02:00
Christophe Simonis 97bac8d64c [IMP] core: capture Warnings though logging 2017-07-27 22:35:47 +02:00
Adrien Dieudonne e989d6333c [ADD] test_main_flows
This module defines tours meant to test some cross-app workflows in Odoo.

At this time, it contains a 'tour' that do some important tasks like:
- product creation
- sale order creation
- reordering rule
- invoicing
- reconciliation
- ...
2017-07-27 13:58:58 +02:00
Christophe Simonis 3d4238f71e [MERGE] forward port branch saas-16 up to 98d3a08ebb 2017-07-26 20:36:23 +02:00
Christophe Simonis 98d3a08ebb [FIX] base: mute handled errors 2017-07-26 20:28:32 +02:00
Christophe Simonis 4f501348c4 [MERGE] forward port branch saas-16 up to 46e1104ce1 2017-07-26 19:55:44 +02:00