diff options
| author | David Beguin <dbe@odoo.com> | 2020-09-17 14:20:19 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2020-09-21 17:33:08 +0000 |
| commit | cc4e7f401164acd053864a53372a96873d5d1b77 (patch) | |
| tree | ff1da1af42cb0910bed860a7b7bccda31504b770 /addons/crm/tests | |
| parent | 8bb3b09a2abf27011e4920a9dc045fc27e1ec628 (diff) | |
[FIX] crm: fix pls field config parameter and force depends recompute
The method _compute_probability has a dynamic depends, that depends on the
crm.pls_fields config parameter. When installing the DB, the depends is
evaluated. If the config parameter is modified afterwards, the depends is not
re-evaluated as the registry is not rebuilt.
The result is that when modifying the config parameter, if an optional
pls_field's value is modified on a record, the compute won't be triggered, as
that pls_field is not in the compute's depends.
This commit force to re-setup the registry after a modification (or the
creation) of the crm.pls_fields config parameter, in order to force the
depends of the _compute_probability method to be updated.
Task ID: 2341829
closes odoo/odoo#58163
X-original-commit: e95afbedc18d198454c7f66b523c4cafb19a4066
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Signed-off-by: David Beguin <dbeguin@users.noreply.github.com>
Diffstat (limited to 'addons/crm/tests')
| -rw-r--r-- | addons/crm/tests/test_crm_pls.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/crm/tests/test_crm_pls.py b/addons/crm/tests/test_crm_pls.py index 9d74fac2938..b49e8e612d1 100644 --- a/addons/crm/tests/test_crm_pls.py +++ b/addons/crm/tests/test_crm_pls.py @@ -280,6 +280,15 @@ class TestCRMPLS(TransactionCase): self.assertEqual(tools.float_compare(leads[3].probability, 40, 2), 0) self.assertEqual(tools.float_compare(leads[8].probability, 2.43, 2), 0) + # Test modify country_id + leads[8].country_id = country_ids[1] + self.assertEqual(tools.float_compare(leads[8].automated_probability, 34.38, 2), 0) + self.assertEqual(tools.float_compare(leads[8].probability, 34.38, 2), 0) + + leads[8].country_id = country_ids[0] + self.assertEqual(tools.float_compare(leads[8].automated_probability, 2.43, 2), 0) + self.assertEqual(tools.float_compare(leads[8].probability, 2.43, 2), 0) + # ---------------------------------------------- # Test tag_id frequencies and probability impact # ---------------------------------------------- |
