Skip to content

Commit

Permalink
[FIX] l10n_do_accounting: do not compute split for moves
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-pcg committed Jul 2, 2024
1 parent 12aa653 commit c57efa7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion l10n_do_accounting/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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+>",
Expand All @@ -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):
Expand Down

0 comments on commit c57efa7

Please sign in to comment.