diff --git a/l10n_do_accounting/__manifest__.py b/l10n_do_accounting/__manifest__.py index 96162021..cecdf091 100644 --- a/l10n_do_accounting/__manifest__.py +++ b/l10n_do_accounting/__manifest__.py @@ -8,7 +8,7 @@ "category": "Localization", "license": "LGPL-3", "website": "https://github.com/odoo-dominicana", - "version": "15.0.0.14.4", + "version": "15.0.0.14.5", # any module necessary for this one to work correctly "depends": ["l10n_latam_invoice_document", "l10n_do"], # always loaded diff --git a/l10n_do_accounting/models/account_move.py b/l10n_do_accounting/models/account_move.py index 45d35b44..5f7e2d1e 100644 --- a/l10n_do_accounting/models/account_move.py +++ b/l10n_do_accounting/models/account_move.py @@ -897,7 +897,10 @@ def _get_last_sequence_domain(self, relaxed=False): @api.depends(lambda self: [self._l10n_do_sequence_field]) def _compute_split_sequence(self): super(AccountMove, self)._compute_split_sequence() - for record in self: + l10n_do_invoices = self.filtered( + lambda inv: inv.l10n_latam_use_documents and inv.country_code == "DO" + ) + for record in l10n_do_invoices: sequence = record[record._l10n_do_sequence_field] or "" regex = re.sub( r"\?P<\w+>", @@ -907,6 +910,9 @@ def _compute_split_sequence(self): matching = re.match(regex, sequence) record.l10n_do_sequence_prefix = sequence[:3] record.l10n_do_sequence_number = int(matching.group(1) or 0) + (self - l10n_do_invoices).write( + {"l10n_do_sequence_prefix": False, "l10n_do_sequence_number": False} + ) def _get_last_sequence(self, relaxed=False, with_prefix=None, lock=True): if not self._context.get("is_l10n_do_seq", False):