diff options
| author | wan <wan@odoo.com> | 2021-04-06 10:25:21 +0000 |
|---|---|---|
| committer | wan <wan@odoo.com> | 2021-04-06 10:25:21 +0000 |
| commit | 365da2a0aca1503133433f9dc66b6866e7867974 (patch) | |
| tree | 014659cc18ec5c76f313f31c7d8307177361f775 | |
| parent | 3b01c249a8d2b9673992942c2c5ea50ef0488708 (diff) | |
[FIX] account: resequence journal entry in purchase journal
The resequence wizard should consider that the sequence is shared for
invoices, journal entries and receipts; only refunds have a separate
sequence.
You could have journal entries in the purchase journal for expense
reports for instance. In that case, we want to be able to resequence all
of it at once.
closes odoo/odoo#68810
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
| -rw-r--r-- | addons/account/wizard/account_resequence.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/account/wizard/account_resequence.py b/addons/account/wizard/account_resequence.py index 05649fa619a..b3b754f4bee 100644 --- a/addons/account/wizard/account_resequence.py +++ b/addons/account/wizard/account_resequence.py @@ -30,7 +30,12 @@ class ReSequenceWizard(models.TransientModel): active_move_ids = self.env['account.move'].browse(self.env.context['active_ids']) if len(active_move_ids.journal_id) > 1: raise UserError(_('You can only resequence items from the same journal')) - if active_move_ids.journal_id.refund_sequence and len(set(active_move_ids.mapped('move_type')) - {'out_receipt', 'in_receipt'}) > 1: + move_types = set(active_move_ids.mapped('move_type')) + if ( + active_move_ids.journal_id.refund_sequence + and ('in_refund' in move_types or 'out_refund' in move_types) + and len(move_types) > 1 + ): raise UserError(_('The sequences of this journal are different for Invoices and Refunds but you selected some of both types.')) values['move_ids'] = [(6, 0, active_move_ids.ids)] return values |
