Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0] [IMP] l10n_ar_ux: For compatibility with old invoices/documents #472

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

nicomacr
Copy link
Contributor

No description provided.

@nicomacr nicomacr force-pushed the 13.0-h-35985-nmr branch 2 times, most recently from 517cb55 to 2d0ab4d Compare February 11, 2021 12:00
@coveralls
Copy link

coveralls commented Feb 11, 2021

Coverage Status

Coverage decreased (-0.1%) to 42.617% when pulling 2d0ab4d on adhoc-dev:13.0-h-35985-nmr into cfd168d on ingadhoc:13.0.

@nicomacr nicomacr force-pushed the 13.0-h-35985-nmr branch 2 times, most recently from 0ba8176 to cb969da Compare February 12, 2021 17:28
@jjscarafia
Copy link
Member

@api.model
def _l10n_ar_get_document_number_parts(self, document_number, document_type_code):
    """
    For compatibility with old invoices/documents we replicate part of previous method
    https://github.com/ingadhoc/odoo-argentina/blob/12.0/l10n_ar_account/models/account_invoice.py#L234
    """
    try:
        return super()._l10n_ar_get_document_number_parts(document_number, document_type_code)
    except Exception as e:
        _logger.info('Error while getting document number parts, try with backward compatibility')
    invoice_number = point_of_sale = False
    if "-" in document_number:
        splited_number = document_number.split('-')
        invoice_number = splited_number.pop()
        point_of_sale = splited_number.pop()
    elif "-" not in document_number and len(document_number) == 12:
        point_of_sale = document_number[:4]
        invoice_number = document_number[-8:]
    invoice_number = invoice_number and re.sub("[^0-9]", "", invoice_number)
    point_of_sale = point_of_sale and re.sub("[^0-9]", "", point_of_sale)
    if not point_of_sale or point_of_sale:
        raise ValidationError(_(
            'No pudimos obtener l número de factura y de punto de venta para %s %s. Verifique que tiene un número '
            'cargado similar a "00001-00000001"') % (document_type_code, document_number))
    return {
            'invoice_number': int(invoice_number),
            'point_of_sale': int(point_of_sale),
        }

@nicomacr nicomacr force-pushed the 13.0-h-35985-nmr branch 3 times, most recently from bf4e62d to 44ff2ae Compare February 17, 2021 19:58
@jjscarafia
Copy link
Member

se mezcla igual porque runbot esta roto por el momento

@jjscarafia jjscarafia merged commit a0f0d83 into ingadhoc:13.0 Feb 17, 2021
@jjscarafia jjscarafia deleted the 13.0-h-35985-nmr branch February 17, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants