[IMP] account: tell which invoice are duplicated
There was no way of knowing which vendor bills were duplicated if you uploaded multiple vendor bills and the warning from _check_duplicate_supplier_reference was raised. closes odoo/odoo#37131 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -1295,8 +1295,11 @@ class AccountMove(models.Model):
|
||||
AND move2.id != move.id
|
||||
WHERE move.id IN %s
|
||||
''', [tuple(moves.ids)])
|
||||
if self._cr.fetchone():
|
||||
raise ValidationError(_('Duplicated vendor reference detected. You probably encoded twice the same vendor bill/credit note.'))
|
||||
duplicated_moves = self.browse([r[0] for r in self._cr.fetchall()])
|
||||
if duplicated_moves:
|
||||
raise ValidationError(_('Duplicated vendor reference detected. You probably encoded twice the same vendor bill/credit note:\n%s') % "\n".join(
|
||||
duplicated_moves.mapped(lambda m: "%(partner)s - %(ref)s - %(date)s" % {'ref': m.ref, 'partner': m.partner_id.display_name, 'date': format_date(self.env, m.date)})
|
||||
))
|
||||
|
||||
def _check_balanced(self):
|
||||
''' Assert the move is fully balanced debit = credit.
|
||||
|
||||
Reference in New Issue
Block a user