diff --git a/CHANGELOG b/CHANGELOG index b83d63067c..c33683a102 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Erase user email when party is erased * Require email only for active user * Add maximum authentication attempt diff --git a/__init__.py b/__init__.py index 95e5430c54..793b338f48 100644 --- a/__init__.py +++ b/__init__.py @@ -14,6 +14,7 @@ def register(): module='web_user', type_='model') Pool.register( party.PartyReplace, + party.PartyErase, module='web_user', type_='wizard') Pool.register( EmailValidation, diff --git a/party.py b/party.py index c172fcb7aa..a9cd052940 100644 --- a/party.py +++ b/party.py @@ -1,8 +1,8 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -from trytond.pool import PoolMeta +from trytond.pool import PoolMeta, Pool -__all__ = ['PartyReplace'] +__all__ = ['PartyReplace', 'PartyErase'] class PartyReplace: @@ -14,3 +14,18 @@ class PartyReplace: return super(PartyReplace, cls).fields_to_replace() + [ ('web.user', 'party'), ] + + +class PartyErase: + __metaclass__ = PoolMeta + __name__ = 'party.erase' + + def to_erase(self, party_id): + pool = Pool() + User = pool.get('web.user') + to_erase = super(PartyErase, self).to_erase(party_id) + to_erase.append( + (User, [('party', '=', party_id)], True, + ['email'], + [None])) + return to_erase