Skip to content
Health
83/100
good
  • Security25/25
    No findings
  • Activity25/25
    Human commit this month
  • Required by15/25
    1 module depends on it
  • Maturity18/25
    In 3 Odoo series since 14.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
1
Modules depending on it
External deps
5 pip · 0 bin
Python packages / system binaries
License
AGPL-3
No conflicts with its dependencies
Folder size
0.49 MB
Module directory on disk
Code analysis 2 migration notes 4 models 7 views 0 HTTP endpoints

Description

This module is an extension of the module account_invoice_import: it adds support for simple PDF invoices i.e. PDF invoice that don't have an embedded XML file. This module has been developped to solve the drawbacks of the OCA module account_invoice_import_invoice2data ; its advantages are the following:

  • Possibility to add support for a new vendor without developper skills: the accountant can do it!
  • Adding support for a new vendor is faster.
  • More tolerance on vendor invoice layout changes.
  • Easier to install.

With this module, you can import all the invoices that you were able to import with the module account_invoice_import_invoice2data. In fact, this module uses the same design when importing a PDF vendor bill:

  1. raw text extraction of the PDF file,
  2. identify the partner using the VAT number (if the VAT number is present in the raw text extraction) or some keywords,
  3. use regular expressions (regex) to extract the data needed to create the vendor bill in Odoo (single line configuration).

The main difference with the OCA module account_invoice_import_invoice2data is that the regular expressions are auto-generated from the configuration made by the user in Odoo. No need to be a regex expert! But you can still write regex to extract some fields for some very specific needs.

The module can extract the following fields:

  • Total Amount with taxes
  • Total Untaxed Amount
  • Total Tax Amount
  • Invoice Date
  • Due Date
  • Start Date
  • End Date
  • Invoice Number
  • Description (for that field, you have to write a regex)

In this list, only 3 fields are required:

  • Invoice Date
  • 2 out of the 3 Amount fields (the 3rd can be deducted from the 2 others: Total Amount = Total Untaxed + Total Tax)

To take advantage of the fields Start Date and End Date, you need the OCA module account_invoice_start_end_dates from the account-closing project.

To know the full story behind the development of this module, read Akretion's blog post.

Dependencies

Odoo dependencies
Python dependencies
dateparser, pymupdf, pypdf>=3.1.0, regex, factur-x>=7.9
System dependencies
None
Required by
l10n_fr_account_invoice_import_simple_pdf

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

Views touched 7

XML IDNameModelTypeStatus
account_invoice_import_form account.invoice.import form Inherits account_invoice_import.account_invoice_import_form
account_invoice_import_simple_pdf_fields_form account.invoice.import.simple.pdf.fields form New
account_invoice_import_simple_pdf_fields_tree account.invoice.import.simple.pdf.fields list New
account_invoice_import_simple_pdf_invoice_number_form account.invoice.import.simple.pdf.invoice.number form New
account_invoice_import_simple_pdf_invoice_number_tree account.invoice.import.simple.pdf.invoice.number list New
view_partner_property_form res.partner form Inherits account_invoice_import.view_partner_property_form
view_partner_property_form_move res.partner form Inherits account_invoice_import_simple_pdf.view_partner_property_form

HTTP endpoints 0

No HTTP endpoints found for this module.

Models touched 4

New fields (0)

No new fields.

Public methods (5)
  • fallback_parse_pdf_invoice(self, file_data, import_config)
    @api.model
    This method must be inherited by additional modules with the same kind of logic as the account_bank_statement_import_* modules
  • simple_pdf_match_partner(self, raw_text_no_space, test_results=None)
    @api.model
  • simple_pdf_parse_invoice(self, file_data, import_config)
    @api.model
  • simple_pdf_parse_invoice_en16931(self, file_data, import_config)
  • simple_pdf_text_extraction(self, file_data, test_info)
    @api.model

New fields (10)
  • date_format Selection
    help='Leave empty if the format used is the same as the format defined in the global section.' string='Specific Date Format' args: '_date_format_sel'
  • date_separator Selection
    compute='_compute_date_separator' help='Leave empty if the format used is the same as the format defined in the global section.' precompute=True readonly=False store=True string='Specific Date Separator' args: '_date_separator_sel'
  • end Char
    string='End String'
  • extract_rule Selection
    compute='_compute_extract_rule' precompute=True readonly=False required=True store=True args: [('first', 'First'), ('last', 'Last'), ('position_start', 'Specific Position from Start'), ('position_end', 'Specific Position from End'), ('min', 'Min'), ('max', 'Max'), ('position_min', 'Specific Position from Min'), ('position_max', 'Specific Position from Max')]
  • name Selection
    required=True string='Field' args: [('amount_total', 'Total'), ('amount_untaxed', 'Untaxed Amount'), ('amount_tax', 'Tax Amount'), ('date', 'Invoice Date'), ('date_due', 'Due Date'), ('date_start', 'Start Date'), ('date_end', 'End Date'), ('invoice_number', 'Invoice Number'), ('description', 'Description')]
  • partner_id Many2one → res.partner
    ondelete='cascade' string='Vendor' args: 'res.partner'
  • position Integer
    default=2
  • regexp Char
    string='Specific Regular Expression'
  • sequence Integer
    default=10
  • start Char
    string='Start String'
Public methods (2)
  • get_value_from_list(self, data_list, test_info, raise_if_none=True)
  • restrict_text(self, raw_text, test_info)

New fields (6)
  • fixed_char Char
  • occurrence_max Integer
    compute='_compute_occurrence_max' default=1 precompute=True readonly=False store=True string='Maximum Occurence'
  • occurrence_min Integer
    default=1 string='Minimum Occurence'
  • partner_id Many2one → res.partner
    ondelete='cascade' string='Vendor' args: 'res.partner'
  • sequence Integer
    default=10
  • string_type Selection
    required=True string='Type' args: '_string_type_sel'
Public methods (0)

No public methods.

New fields (13)
  • simple_pdf_currency_id Many2one → res.currency
    help='If empty, Odoo will use the company currency.' ondelete='restrict' string='Invoice Import Currency' args: 'res.currency'
  • simple_pdf_date_format Selection
    help="If the date format uses 'Month', check that the language is properly configured on the partner. 'Month' works both in full and short version ('January' and 'Jan.')." string='Date Format' args: '_simple_pdf_date_format_sel'
  • simple_pdf_date_separator Selection
    compute='_compute_simple_pdf_date_separator' help="If the date looks like 'Sep. 4, 2021', use 'space' as date separator (Odoo will ignore the dot and comma)." precompute=True readonly=False store=True string='Date Separator' args: '_simple_pdf_date_separator_sel'
  • simple_pdf_decimal_separator Selection
    compute='_compute_simple_pdf_decimal_separator' help='If empty, Odoo will use the decimal separator configured on the language of the partner.' precompute=True readonly=False store=True string='Decimal Separator' args: [('dot', 'dot'), ('comma', 'comma')]
  • simple_pdf_field_ids One2many → account.invoice.import.simple.pdf.fields
    string='Fields for PDF Invoice Import' args: 'account.invoice.import.simple.pdf.fields', 'partner_id'
  • simple_pdf_invoice_number_ids One2many → account.invoice.import.simple.pdf.invoice.number
    string='Invoice Import Number Format' args: 'account.invoice.import.simple.pdf.invoice.number', 'partner_id'
  • simple_pdf_keyword Char
    help="If empty, Odoo will use the VAT number to identify the partner. To match on several keywords, separate them with '|' (pipe)."
  • simple_pdf_pages Selection
    default='all' string='Page Analysis' args: [('first', 'First Page Only'), ('all', 'All Pages')]
  • simple_pdf_test_file Binary
    attachment=True string='Test PDF Invoice File'
  • simple_pdf_test_filename Char
    string='Test PDF Invoice Filename'
  • simple_pdf_test_raw_text Text
    readonly=True string='Test Text Extraction'
  • simple_pdf_test_results Html
    readonly=True string='Test Results'
  • simple_pdf_thousand_separator Selection
    compute='_compute_simple_pdf_thousand_separator' help='If empty, Odoo will use the thousand separator configured on the language of the partner.' precompute=True readonly=False store=True string='Thousand Separator' args: [('none', 'none'), ('space', 'space'), ('dot', 'dot'), ('comma', 'comma'), ('apostrophe', 'apostrophe')]
Public methods (3)
  • pdf_simple_generate_default_fields(self)
  • pdf_simple_test_cleanup(self)
  • pdf_simple_test_run(self)

Loading…

Loading…