Repository
OCA/edi · module folder · Try on Runboat
Module version
Category
Accounting & Finance
Folder size
0.49 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/edi
Last tracking update
2026-08-12 11:28:17
Authors
Akretion, Odoo Community Association (OCA)
Maintainers
Akretion, Odoo Community Association (OCA)
Committers
Iván Todorovich, Nicolas JEUDY, OCA-git-bot, oca-ci
Odoo dependencies
Python dependencies
None
System dependencies
None
Required by
None
Description
This module has been started by lazy accounting users who hate entering
their vendor bills manually in Odoo. Almost all companies have several
vendor bills to enter regularly in the system from the same vendors:
phone bill, electricity bill, Internet access, train tickets, etc. Most
of these invoices are available as PDF. If we are able to automatically
extract from the PDF the required information to enter the invoice as
vendor bill in Odoo, then this module will create it automatically. To
know the full story behind the development of this module, read this
[blog
post](http://www.akretion.com/blog/akretions-christmas-present-for-the-odoo-community).

In order to reliably extract the required information from the invoice,
two international standards exist to describe an invoice in XML:

- [CII](http://tfig.unece.org/contents/cross-industry-invoice-cii.htm)
  (Cross-Industry Invoice) developed by
  [UN/CEFACT](http://www.unece.org/cefact) (United Nations Centre for
  Trade Facilitation and Electronic Business),
- [UBL](https://www.oasis-open.org/committees/ubl/) (Universal Business
  Language) which is an ISO standard ([ISO/IEC
  19845](https://www.iso.org/standard/66370.html))
  developed by [OASIS](https://www.oasis-open.org/) (Organization for
  the Advancement of Structured Information Standards).

Some e-invoice standards such as
[Factur-X](https://fnfe-mpe.org/factur-x/) propose to embed the XML
description of the invoice inside the PDF invoice. Other people think
that the future is pure-XML invoices: a European initiative called
[Peppol](https://peppol.org/) aims at setting up an open network to
exchange e-invoices as UBL XML. We don't know yet which standard and
which practice will prevail on electronic invoicing in the future, but
we hope that lazy accountants won't have to manually encode their vendor
bills in the near future. This module is here to help achieve this goal!

This module doesn't do anything useful by itself; it requires other
modules to work: each module adds a specific invoice format.

Here is how the module works:

- the user starts a wizard and uploads the PDF or XML invoice,
- if it is an XML file, Odoo will parse it to create the invoice
  (requires additional modules for specific XML formats, such as the
  module *account_invoice_import_ubl* for the UBL format),
- if it is a PDF file with an embedded XML file in Factur-X/CII format,
  Odoo will extract the embedded XML file and parse it to create the
  invoice (requires the module *account_invoice_import_facturx*),
- otherwise, Odoo will use the *invoice2data* Python library to try to
  interpret the text of the PDF (requires the module
  *account_invoice_import_invoice2data*),
- if the partner is matched, Odoo will use the partner's vendor bill
  import settings or reuse the accounting configuration from the latest
  posted invoice of that partner,
- otherwise, Odoo will create a new draft supplier invoice without a
  partner and propose to create or update the partner from the imported
  data.

This module also works with supplier refunds.

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
account_invoice_import_form account.invoice.import form New
account_invoice_import_partner_create_form account.invoice.import.partner.create form New
res_config_settings_view_form res.config.settings form Inherits account.res_config_settings_view_form
view_move_form account.move form Inherits account.view_move_form
view_partner_property_form res.partner form Inherits account.view_partner_property_form
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (7)

New fields (2)
  • company_id Many2one → res.company
    default=<expr> required=True args: 'res.company'
  • invoice_attachment_ids Many2many → ir.attachment
    required=True string='PDF or XML Invoices to Import' args: 'ir.attachment'
Public methods (11)
  • create_invoice(self, parsed_inv, import_config, origin=None)
    @api.model
  • create_invoice_webservice(self, invoice_file_b64, invoice_filename, company_id, origin, email_from=None)
    @api.model
  • fallback_parse_pdf_invoice(self, file_data, company)
    Designed to be inherited by the module account_invoice_import_invoice2data, to be sure the invoice2data technique is used after the electronic invoice modules such as account_invoice_import_facturx and account_invoice_import_ubl
  • import_invoices(self)
    Method called by the button of the wizard
  • message_new(self, msg_dict, custom_values=None)
    @api.model
    Process the message data from a fetchmail configuration The caller expects us to create a record so we always return an empty one even though the actual result is the imported invoice, if the message content allows it.
  • multi_xpath_helper(self, xml_root, xpath_list, namespaces, isdate=False, isfloat=False, ischar_to_clean=False)
  • parse_invoice(self, invoice_file_b64, invoice_filename, company, email_from=None)
    @api.model
  • parse_pdf_invoice(self, file_data, company)
    @api.model
    This method must be inherited by additional modules with the same kind of logic as the account_statement_import_* modules
  • parse_xml_invoice(self, xml_root, company)
    @api.model
  • raw_multi_xpath_helper(self, xml_root, xpath_list, namespaces)
  • xpath_to_dict_helper(self, xml_root, xpath_dict, namespaces)

New fields (6)
  • create_or_update Selection
    default='create' required=True args: [('create', "This partner doesn't already exists in Odoo"), ('update', 'This partner already exists in Odoo')]
  • import_partner_data Json
  • move_id Many2one → account.move
    readonly=True required=True string='Vendor Bill' args: 'account.move'
  • partner_name Char
    readonly=True
  • partner_vat Char
    readonly=True string='Partner VAT Number'
  • update_partner_id Many2one → res.partner
    domain=[('parent_id', '=', False)] string='Partner to Update' args: 'res.partner'
Public methods (3)
  • create_partner(self)
  • default_get(self, fields_list)
    @api.model
  • update_partner(self)

New fields (0)

No new fields.

Public methods (1)
  • create_document_from_attachment(self, attachment_ids)
    Inherit native method used when clicking on the 'Upload' button from the Vendor Bill tree view

New fields (3)
  • import_partner_data Json
  • import_warnings Html
    readonly=True
  • show_import_warnings Boolean
    compute='_compute_show_import_warnings'
Public methods (0)

No public methods.

New fields (4)
  • adjustment_credit_account_id Many2one → account.account
    check_company=True args: 'account.account'
  • adjustment_debit_account_id Many2one → account.account
    check_company=True args: 'account.account'
  • invoice_import_create_bank_account Boolean
    string='Auto-create Bank Account of Supplier'
  • invoice_import_email Char
    help='This field is used in multi-company setups to import the invoices received by the mail gateway in the appropriate company' args: 'Mail Gateway: Destination E-mail'
Public methods (0)

No public methods.

New fields (4)
  • adjustment_credit_account_id Many2one
    check_company=True domain="[('internal_group', '=', 'income')]" readonly=False related='company_id.adjustment_credit_account_id'
  • adjustment_debit_account_id Many2one
    check_company=True domain="[('internal_group', '=', 'expense')]" readonly=False related='company_id.adjustment_debit_account_id'
  • invoice_import_create_bank_account Boolean
    readonly=False related='company_id.invoice_import_create_bank_account'
  • invoice_import_email Char
    readonly=False related='company_id.invoice_import_email'
Public methods (0)

No public methods.

New fields (8)
  • invoice_import_account_id Many2one → account.account
    check_company=True company_dependent=True domain="[('internal_group', '=', 'expense')]" help='The account configured here will be updated by the mapping of the fiscal position.' string='Default Expense Account' args: 'account.account'
  • invoice_import_journal_id Many2one → account.journal
    company_dependent=True domain="[('type', '=', 'purchase'), ('company_id', '=', current_company_id)]" help='If empty, Odoo will use the first purchase journal.' string='Force Purchase Journal' args: 'account.journal'
  • invoice_import_label Char
    company_dependent=True help='Force Invoice Line Description' string='Force Invoice Line Description'
  • invoice_import_move_id Many2one → account.move
    readonly=True string='Related Imported Vendor Bill' args: 'account.move'
  • invoice_import_move_partner_id Many2one
    related='invoice_import_move_id.partner_id'
  • invoice_import_product_id Many2one → product.product
    company_dependent=True string='Default Product' args: 'product.product'
  • invoice_import_single_line Boolean
    company_dependent=True string='Force Single Invoice Line'
  • invoice_import_tax_ids Many2many → account.tax
    domain="[('type_tax_use', '=', 'purchase'), ('company_id', '=', current_company_id)]" help='Taxes configured here will go through the mapping of the fiscal position.' string='Default Taxes' args: 'account.tax'
Public methods (1)
  • update_imported_invoice(self)
    Method called by button in partner banner

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Status
Open migration PR — not merged yet for this version
CI status
checks failing
Open since
188 days ago
Last activity
32 days ago
Repository
OCA/edi
Pull request
[17.0][MIG] account_invoice_import: Migration to 17.0 (#1295)