Skip to Content

Contributors

field extraction rule for funny date format

Hi!
The module account_invoice_import_simple_pdf allows to define field 
extraction rules. UPS sends invoices with date in format "02.April 2024" 
so the first separator is a dot and the second a space. Is it possible 
to define a field extraction rule for such format?

Best regards
Jan

by Jan Suhr - 02:32 - 23 May 2024

Follow-Ups

  • Re: field extraction rule for funny date format

    Hi,


    reading the source there probably isn't but I haven't tested it. Looking at it I see 2 ways going forward:

    1) Extending the options for date formats with this specific one - may be a bit tricky

    2) Adding an option for usage of dateparser library and possible mask


    Regarding dateparser it's quite easy:

    >>> dateparser.parse('02.April 2024', date_formats=['%d.%B %Y'])
    datetime.datetime(2024, 4, 2, 0, 0)

    I would even suggest reworking the date handling using the library...


    Best regards


        Radovan


    On štvrtok 23. mája 2024 14:32:10 CEST Jan Suhr | Nitrokey wrote:

    > Hi!

    > The module account_invoice_import_simple_pdf allows to define field

    > extraction rules. UPS sends invoices with date in format "02.April 2024"

    > so the first separator is a dot and the second a space. Is it possible

    > to define a field extraction rule for such format?

    > Best regards

    > Jan

    >

    > _______________________________________________

    > Mailing-List: https://odoo-community.org/groups/contributors-15 [1]

    > Post to: mailto:contributors@odoo-community.org

    > Unsubscribe: https://odoo-community.org/groups?unsubscribe [2]

    >

    >

    >

    > [1] https://odoo-community.org/groups/contributors-15

    > [2] https://odoo-community.org/groups?unsubscribe




    by Radovan Skolnik - 02:50 - 23 May 2024