Account Invoice Import Simple PDF
account_invoice_import_simple_pdf · OCA/edi
-
Security25/25No findings
-
Activity25/25Human commit this month
-
Required by15/251 module depends on it
-
Maturity18/25In 3 Odoo series since 14.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
AccountInvoiceImportSimplePdfFields— Migrating to 19.0: `_sql_constraints` is ignored and its constraints are silently not created: declare `models.Constraint` attributes instead. migration-sql-constraints · sourceAccountInvoiceImportSimplePdfInvoiceNumber— Migrating to 19.0: `_sql_constraints` is ignored and its constraints are silently not created: declare `models.Constraint` attributes instead. migration-sql-constraints · source
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
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:
- raw text extraction of the PDF file,
- identify the partner using the VAT number (if the VAT number is present in the raw text extraction) or some keywords,
- 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 ID | Name | Model | Type | Status |
|---|---|---|---|---|
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
No new fields.
Public methods (5)-
fallback_parse_pdf_invoice(self, file_data, import_config)@api.modelThis 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
-
date_formatSelectionhelp='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_separatorSelectioncompute='_compute_date_separator'help='Leave empty if the format used is the same as the format defined in the global section.'precompute=Truereadonly=Falsestore=Truestring='Specific Date Separator' args: '_date_separator_sel' -
endCharstring='End String' -
extract_ruleSelectioncompute='_compute_extract_rule'precompute=Truereadonly=Falserequired=Truestore=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')] -
nameSelectionrequired=Truestring='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_idMany2one → res.partnerondelete='cascade'string='Vendor' args: 'res.partner' -
positionIntegerdefault=2 -
regexpCharstring='Specific Regular Expression' -
sequenceIntegerdefault=10 -
startCharstring='Start String'
-
get_value_from_list(self, data_list, test_info, raise_if_none=True) -
restrict_text(self, raw_text, test_info)
-
fixed_charChar -
occurrence_maxIntegercompute='_compute_occurrence_max'default=1precompute=Truereadonly=Falsestore=Truestring='Maximum Occurence' -
occurrence_minIntegerdefault=1string='Minimum Occurence' -
partner_idMany2one → res.partnerondelete='cascade'string='Vendor' args: 'res.partner' -
sequenceIntegerdefault=10 -
string_typeSelectionrequired=Truestring='Type' args: '_string_type_sel'
No public methods.
-
simple_pdf_currency_idMany2one → res.currencyhelp='If empty, Odoo will use the company currency.'ondelete='restrict'string='Invoice Import Currency' args: 'res.currency' -
simple_pdf_date_formatSelectionhelp="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_separatorSelectioncompute='_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=Truereadonly=Falsestore=Truestring='Date Separator' args: '_simple_pdf_date_separator_sel' -
simple_pdf_decimal_separatorSelectioncompute='_compute_simple_pdf_decimal_separator'help='If empty, Odoo will use the decimal separator configured on the language of the partner.'precompute=Truereadonly=Falsestore=Truestring='Decimal Separator' args: [('dot', 'dot'), ('comma', 'comma')] -
simple_pdf_field_idsOne2many → account.invoice.import.simple.pdf.fieldsstring='Fields for PDF Invoice Import' args: 'account.invoice.import.simple.pdf.fields', 'partner_id' -
simple_pdf_invoice_number_idsOne2many → account.invoice.import.simple.pdf.invoice.numberstring='Invoice Import Number Format' args: 'account.invoice.import.simple.pdf.invoice.number', 'partner_id' -
simple_pdf_keywordCharhelp="If empty, Odoo will use the VAT number to identify the partner. To match on several keywords, separate them with '|' (pipe)." -
simple_pdf_pagesSelectiondefault='all'string='Page Analysis' args: [('first', 'First Page Only'), ('all', 'All Pages')] -
simple_pdf_test_fileBinaryattachment=Truestring='Test PDF Invoice File' -
simple_pdf_test_filenameCharstring='Test PDF Invoice Filename' -
simple_pdf_test_raw_textTextreadonly=Truestring='Test Text Extraction' -
simple_pdf_test_resultsHtmlreadonly=Truestring='Test Results' -
simple_pdf_thousand_separatorSelectioncompute='_compute_simple_pdf_thousand_separator'help='If empty, Odoo will use the thousand separator configured on the language of the partner.'precompute=Truereadonly=Falsestore=Truestring='Thousand Separator' args: [('none', 'none'), ('space', 'space'), ('dot', 'dot'), ('comma', 'comma'), ('apostrophe', 'apostrophe')]
-
pdf_simple_generate_default_fields(self) -
pdf_simple_test_cleanup(self) -
pdf_simple_test_run(self)
Loading…
Loading…