From 2b62a36109759a27ac66f890fca50e8fdb67dae4 Mon Sep 17 00:00:00 2001 From: Jorge Conce Date: Tue, 7 May 2024 11:46:59 -0400 Subject: [PATCH] [FIX] l10n_do_accounting: fix seq with same prefix in diferent year --- l10n_do_accounting/models/account_move.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/l10n_do_accounting/models/account_move.py b/l10n_do_accounting/models/account_move.py index 45d35b44..4d8ea61f 100644 --- a/l10n_do_accounting/models/account_move.py +++ b/l10n_do_accounting/models/account_move.py @@ -1020,3 +1020,16 @@ def unlink(self): _("You cannot delete fiscal invoice which have been posted before") ) return super(AccountMove, self).unlink() + + @api.model + def _deduce_sequence_number_reset(self, name): + if (self.l10n_latam_use_documents + and self.company_id.country_id.code == "DO" + and name not in ['/', False, '', '1'] + and not self._context.get("is_l10n_do_seq", False)): + return 'year' + elif self._context.get("is_l10n_do_seq", False): + return 'never' + else: + 'never' + return super(AccountMove, self)._deduce_sequence_number_reset(name)