diff options
| author | wan <wan@odoo.com> | 2019-09-19 10:10:18 +0000 |
|---|---|---|
| committer | wan <wan@odoo.com> | 2019-09-19 10:10:18 +0000 |
| commit | beaa2933775a05a70eaa58f04d385f29dec31047 (patch) | |
| tree | 000e3a4cf1a9c2e6011f3b738d0b45f61dc88d9d /addons | |
| parent | b487537c24407ea47e3e25c0833d51370be4291f (diff) | |
[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>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_move.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 0d66c3cacb1..e0fbfbc1873 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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. |
