diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 34a4a44a485012f8ed339d375405382c7e96e20b..630e0c095976805f6801d153a0cf7093e7f62e71 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -990,7 +990,7 @@ class MassMailing(models.Model): remaining = set(res_ids).difference(already_mailed) if topick > len(remaining) or (len(remaining) > 0 and topick == 0): topick = len(remaining) - res_ids = random.sample(remaining, topick) + res_ids = random.sample(sorted(remaining), topick) return res_ids def _get_remaining_recipients(self): diff --git a/odoo/netsvc.py b/odoo/netsvc.py index 204b349be46a070dc508e7097b6e6ce83ffbb570..c5248934e6bb54f169e21c824a7eedf21b70f845 100644 --- a/odoo/netsvc.py +++ b/odoo/netsvc.py @@ -139,8 +139,10 @@ def init_logger(): # ignore deprecation warnings from invalid escape (there's a ton and it's # pretty likely a super low-value signal) warnings.filterwarnings('ignore', r'^invalid escape sequence \'?\\.', category=DeprecationWarning) - # recordsets are both sequence and set so trigger warning despite no issue - warnings.filterwarnings('ignore', r'^Sampling from a set', category=DeprecationWarning, module='odoo') + if sys.version_info[:2] == (3, 9): + # recordsets are both sequence and set so trigger warning despite no issue + # Only applies to 3.9 as it was fixed in 3.10 see https://bugs.python.org/issue42470 + warnings.filterwarnings('ignore', r'^Sampling from a set', category=DeprecationWarning, module='odoo') # ignore a bunch of warnings we can't really fix ourselves for module in [ 'babel.util', # deprecated parser module, no release yet