Xavier-Do f49d09decd [FIX] crm: avoid indeterminism linked to create_date filter
The test `test_assign_count` may fail randomly leading to the error:

```
self.assertEqual(self.sales_team_1_m3.lead_month_count, 14)
AssertionError: 12 != 14
```

Since BUNDLE_HOURS_DELAY is 0 (during tests), the domain becomes
`[('create_date', '<', fields.Datetime.now()]`

Depending of the time when the transaction starts, and the tests is
executed, the domain could match more or less records when executed one
second earlier or later. This is especially True for single module build
where there is less logic and the execution is faster. The domain may be
tested earlier and match less records.

This error can be reproduced deterministically by setting
`BUNDLE_HOURS_DELAY = 1/3600`

A fix could be to ignore ignore the create_date domain if the
BUNDLE_HOURS_DELAY is 0, we want to match all records in theory
(except if some of them are created in the future...)

The chosen solution is to use cr.now and use a <= instead.

Some assertions where also added to the test in order to identify why
the count was different and give a more precise message when it fails.

```
AssertionError: Lists differ: [] != ['TestLeadInitial_0000', 'TestLeadInitial_[97 chars]006']

Second list contains 6 additional elements.
First extra element 0:
'TestLeadInitial_0000'

- []
+ ['TestLeadInitial_0000',
+  'TestLeadInitial_0001',
+  'TestLeadInitial_0002',
+  'TestLeadInitial_0004',
+  'TestLeadInitial_0005',
+  'TestLeadInitial_0006']
```

task-2796579

closes odoo/odoo#87107

X-original-commit: 4a5b68f05c57ba36560d43733dfd04b67c3297a8
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-03-24 10:48:56 +01:00
2022-03-22 07:56:12 +01:00
…
…
…
2022-01-14 15:44:52 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%