Do not notify for duplicate identifier from the same party
Closes #14434 (grafted from 33e65be32c54cf8ba9f2fb680541ef74aec7b420) --HG-- branch : 7.0
This commit is contained in:
@@ -851,13 +851,14 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
|
||||
notifications.extend(self._notify_duplicate())
|
||||
return notifications
|
||||
|
||||
@fields.depends('code', methods=['on_change_with_code'])
|
||||
@fields.depends('party', 'code', methods=['on_change_with_code'])
|
||||
def _notify_duplicate(self):
|
||||
cls = self.__class__
|
||||
if self.code:
|
||||
code = self.on_change_with_code()
|
||||
others = cls.search([
|
||||
('id', '!=', self.id),
|
||||
('party', '!=', self.party),
|
||||
('type', '!=', None),
|
||||
('code', '=', code),
|
||||
], limit=1)
|
||||
|
||||
Reference in New Issue
Block a user