2
0

[FIX] account_move_name_sequence: do not create duplicated sequences

This commit is contained in:
Andrea Stirpe 2023-08-24 13:22:31 +02:00
parent cebdf3287f
commit a015ec61f8

View File

@ -101,6 +101,10 @@ class AccountJournal(models.Model):
@api.model
def _create_sequence(self, vals, refund=False):
seq_vals = self._prepare_sequence(vals, refund=refund)
domain = [(key, "=", value) for key, value in seq_vals.items()]
existing = self.env["ir.sequence"].search(domain, limit=1)
if existing:
return existing
return self.env["ir.sequence"].sudo().create(seq_vals)
def _prepare_sequence_current_moves(self, refund=False):