[FIX] account: resequence journal with payment sequence set to False
Resequencing entries that come from payment and non payment raise a UserError, even if the journal has `payment_sequence` set to False Steps to reproduce: 1) Go to "Accounting / Configuration / Accounting / Journals" and create a new journal with type "Bank" and "Dedicated Payment Sequence" in False. 2) Create a "Bank Statement Line" in the journal created in step "1". 3) Create and confirm a customer payment using the journal created in step "1". 4) Go to "Accounting / Accounting / Journals / Journal Entries". Select journal entries created on step "2" and "3" and then click on Action --> Resequence. Then a User Error is being show "The sequences of this journal are different for Payments and non-Payments but you selected some of both types." it is not correct as the journal created on step "1" has the field "Dedicated Payment Sequence" set to "False". opw-3763500 closes odoo/odoo#159003 X-original-commit: 11d71cf1b244174c12c0094eb2f0f072894aecc6 Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com> Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
This commit is contained in:
committed by
guva-odoo
parent
05e3645997
commit
1d57f3b335
@@ -639,6 +639,26 @@ class TestSequenceMixin(TestSequenceMixinCommon):
|
||||
for move in payments.move_id:
|
||||
self.assertRecordValues(move.line_ids, [{'move_name': move.name}] * len(move.line_ids))
|
||||
|
||||
def test_resequence_payment_and_non_payment_without_payment_sequence(self):
|
||||
"""Resequence wizard could be open for different move type if the payment sequence is set to False on the journal."""
|
||||
journal = self.company_data['default_journal_bank'].copy({'payment_sequence': False})
|
||||
bsl = self.env['account.bank.statement.line'].create({'name': 'test', 'amount': 100, 'journal_id': journal.id})
|
||||
payment = self.env['account.payment'].create({
|
||||
'payment_type': 'inbound',
|
||||
'partner_id': self.partner_a.id,
|
||||
'amount': 100,
|
||||
'journal_id': journal.id,
|
||||
})
|
||||
|
||||
payment.action_post()
|
||||
wizard = Form(self.env['account.resequence.wizard'].with_context(
|
||||
active_ids=(payment.move_id + bsl.move_id).ids,
|
||||
active_model='account.move'),
|
||||
)
|
||||
|
||||
wizard.save().resequence()
|
||||
self.assertTrue(wizard)
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSequenceMixinDeletion(TestSequenceMixinCommon):
|
||||
|
||||
@@ -40,7 +40,10 @@ class ReSequenceWizard(models.TransientModel):
|
||||
):
|
||||
raise UserError(_('The sequences of this journal are different for Invoices and Refunds but you selected some of both types.'))
|
||||
is_payment = set(active_move_ids.mapped(lambda x: bool(x.payment_id)))
|
||||
if len(is_payment) > 1:
|
||||
if (
|
||||
active_move_ids.journal_id.payment_sequence
|
||||
and len(is_payment) > 1
|
||||
):
|
||||
raise UserError(_('The sequences of this journal are different for Payments and non-Payments but you selected some of both types.'))
|
||||
values['move_ids'] = [(6, 0, active_move_ids.ids)]
|
||||
return values
|
||||
|
||||
Reference in New Issue
Block a user