2
0

Merge PR #1718 into 16.0

Signed-off-by moylop260
This commit is contained in:
OCA-git-bot 2023-08-24 16:00:11 +00:00
commit 29fd548469

View File

@ -101,6 +101,10 @@ class AccountJournal(models.Model):
@api.model @api.model
def _create_sequence(self, vals, refund=False): def _create_sequence(self, vals, refund=False):
seq_vals = self._prepare_sequence(vals, refund=refund) 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) return self.env["ir.sequence"].sudo().create(seq_vals)
def _prepare_sequence_current_moves(self, refund=False): def _prepare_sequence_current_moves(self, refund=False):