Skip to content
Snippets Groups Projects
Commit 11551f36 authored by Katherine Zaoral's avatar Katherine Zaoral
Browse files

[FIX] l10n_ar: share sequences compute sequences


Before this change, we have the errors that documents generated on
pre-printed sales journals mark as unified book were wrongly
named using the wrong doc prefix code.

This was visible thanks to the demo data were we notices that the credit
notes were having FA- doc prefix instead of NC-

This was because we are reusing the shared sequence directly, now we
check and fix the doc prefix for those cases and all documents generated
on shared sequences are properly named.

closes odoo/odoo#85170

Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
parent 1d3cd7ee
Branches
Tags
No related merge requests found
......@@ -239,6 +239,14 @@ class AccountMove(models.Model):
return self._get_formatted_sequence()
return super()._get_starting_sequence()
def _get_last_sequence(self, relaxed=False):
""" If use share sequences we need to recompute the sequence to add the proper document code prefix """
res = super()._get_last_sequence(relaxed=relaxed)
if res and self.journal_id.l10n_ar_share_sequences and self.l10n_latam_document_type_id.doc_code_prefix not in res:
res = self._get_formatted_sequence(number=self._l10n_ar_get_document_number_parts(
res.split()[-1], self.l10n_latam_document_type_id.code)['invoice_number'])
return res
def _get_last_sequence_domain(self, relaxed=False):
where_string, param = super(AccountMove, self)._get_last_sequence_domain(relaxed)
if self.company_id.country_id.code == "AR" and self.l10n_latam_use_documents:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment