Skip to content

Commit d5c79d9

Browse files
authored
Merge pull request #4 from AmetrasIntelligence/13.0-mig-account_invoice_import
[MIG] account_invoice_import : migrate module to 13.0.
2 parents 11587bb + 51ef3dd commit d5c79d9

40 files changed

+9671
-4
lines changed

.pre-commit-config.yaml

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exclude: |
55
# Files and folders generated by bots, to avoid loops
66
^setup/|/static/description/index\.html$|
77
# We don't want to mess with tool-generated files
8-
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|
8+
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
99
# Maybe reactivate this when all README files include prettier ignore tags?
1010
^README\.md$|
1111
# Library files can have extraneous formatting (even minimized)
@@ -15,7 +15,7 @@ exclude: |
1515
# You don't usually want a bot to modify your legal texts
1616
(LICENSE.*|COPYING.*)
1717
default_language_version:
18-
python: python3
18+
python: python3.8
1919
node: "14.13.0"
2020
repos:
2121
- repo: local
@@ -27,6 +27,11 @@ repos:
2727
entry: found forbidden files; remove them
2828
language: fail
2929
files: "\\.rej$"
30+
- id: en-po-files
31+
name: en.po files cannot exist
32+
entry: found a en.po file
33+
language: fail
34+
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
3035
- repo: https://github.com/oca/maintainer-tools
3136
rev: ab1d7f6
3237
hooks:
@@ -49,6 +54,7 @@ repos:
4954
rev: 19.10b0
5055
hooks:
5156
- id: black
57+
additional_dependencies: ["click<8.1.0"]
5258
- repo: https://github.com/pre-commit/mirrors-prettier
5359
rev: v1.19.1
5460
hooks:
@@ -101,10 +107,16 @@ repos:
101107
name: isort except __init__.py
102108
exclude: /__init__\.py$
103109
- repo: https://github.com/acsone/setuptools-odoo
104-
rev: 2.6.0
110+
rev: 3.1.8
105111
hooks:
106112
- id: setuptools-odoo-make-default
107-
- repo: https://gitlab.com/pycqa/flake8
113+
- id: setuptools-odoo-get-requirements
114+
args:
115+
- --output
116+
- requirements.txt
117+
- --header
118+
- "# generated from manifests external_dependencies"
119+
- repo: https://github.com/PyCQA/flake8
108120
rev: 3.7.9
109121
hooks:
110122
- id: flake8

account_invoice_import/README.rst

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
======================
2+
Account Invoice Import
3+
======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:26f0853d4122605d020e48687fa420f66fdad1a6c7e41efe74059e0a845f5348
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
20+
:target: https://github.com/OCA/edi/tree/14.0/account_invoice_import
21+
:alt: OCA/edi
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-account_invoice_import
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module has been started by lazy accounting users who hate enter they 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>`_.
32+
33+
In order to reliably extract the required information from the invoice, two international standards exists to describe an Invoice in XML:
34+
35+
* `CII <http://tfig.unece.org/contents/cross-industry-invoice-cii.htm>`_ (Cross-Industry Invoice) developped by `UN/CEFACT <http://www.unece.org/cefact>`_ (United Nations Centre for Trade Facilitation and Electronic Business),
36+
* `UBL <http://ubl.xml.org/>`_ (Universal Business Language) which is an ISO standard (`ISO/IEC 19845 <http://www.iso.org/iso/catalogue_detail.htm?csnumber=66370>`_) developped by `OASIS <https://www.oasis-open.org/>`_ (Organization for the Advancement of Structured Information Standards).
37+
38+
Some e-invoice standards such as `Factur-X <http://fnfe-mpe.org/factur-x/>`_ propose to embed the XML description of the invoice inside the PDF invoice. Other people think that the futur is pure-XML invoices: a European initiative called `PEPPOL <https://peppol.eu/>`_ 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!
39+
40+
This module doesn't do anything useful by itself ; it requires other modules to work: each modules adds a specific invoice format.
41+
42+
Here is how the module works:
43+
44+
* the user starts a wizard and uploads the PDF or XML invoice,
45+
* 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),
46+
* 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*),
47+
* otherwise, Odoo will use the *invoice2data* Python library to try to interpret the text of the PDF (requires the module *account_invoice_import_invoice2data*),
48+
* if there is already some draft supplier invoice for this supplier, Odoo will propose to select one to update or create a new draft invoice,
49+
* otherwise, Odoo will directly create a new draft supplier invoice and attach the PDF to it.
50+
51+
This module also works with supplier refunds.
52+
53+
**Table of contents**
54+
55+
.. contents::
56+
:local:
57+
58+
Configuration
59+
=============
60+
61+
Go to the form view of the suppliers and configure it with the following parameters:
62+
63+
* Individual/Company: *Company*
64+
* the *VAT Number* (this field is used by default when searching the supplier in the Odoo partner database)
65+
* in the *Accounting* tab, create one or several *Invoice Import Configurations*.
66+
67+
You can configure a mail gateway to import invoices from an email:
68+
69+
* Go to the menu *Settings > Technical > Email > Incoming Mail Servers* and setup the access (POP or IMAP) to the mailbox that will be used to receive the invoices,
70+
* In the section *Actions to perform on incoming mails*, set the field *Create a new record* to *Wizard to import supplier invoices/refunds* (model *account.invoice.import*).
71+
* If you are in a multi-company setup, you also have to go to the menu *Invoicing > Configuration > Settings*: in the section *Invoice Import*, enter the email of the mailbox used to import invoices in the field *Mail Gateway: Destination E-mail* (it will be used to import the invoice in the proper company).
72+
* The bank accounts of the suppliers can be automatically populated from data received from invoice files. For security reasons this has to be activated seperatly: Go to the menu *Settings > Invoicing and select* "Auto-create Bank Account of Supplier".
73+
74+
Usage
75+
=====
76+
77+
Go to the menu *Invoicing > Vendors > Import Vendor Bill* and follow the instructions of the wizard. You can also start the wizard from the *Accounting Dashboard*: on the purchase journal, click on the *Upload* button.
78+
79+
This module also supports the scenario where you have a draft vendor bill (generated from a purchase order for instance) and you have to update it to comply with the real invoice sent by the vendor: on the form view of the draft vendor bill, click on the button *Import Invoice File* and follow the instructions of the wizard.
80+
81+
If you have a large volume of invoices to import, you may be interested by the script **mass_invoice_import.py** which is available in the *scripts* subdirectory of this module. If you run:
82+
83+
.. code::
84+
85+
./mass_invoice_import.py --help
86+
87+
you will have detailed instructions on how to use the script.
88+
89+
A particular use case of this script is to have a directory where all the invoices saved are automatically uploaded in Odoo. For that, have a look at the sample script **inotify-sample.sh** available in the same subdirectory. Edit this sample script to adapt it to your needs.
90+
91+
Known issues / Roadmap
92+
======================
93+
94+
* Remove dependency on *base_iban* and develop a separate glue module between this module and *base_iban*
95+
96+
Bug Tracker
97+
===========
98+
99+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_.
100+
In case of trouble, please check there if your issue has already been reported.
101+
If you spotted it first, help us to smash it by providing a detailed and welcomed
102+
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20account_invoice_import%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
103+
104+
Do not contact contributors directly about support or help with technical issues.
105+
106+
Credits
107+
=======
108+
109+
Authors
110+
~~~~~~~
111+
112+
* Akretion
113+
114+
Contributors
115+
~~~~~~~~~~~~
116+
117+
* Alexis de Lattre <[email protected]>
118+
* Andrea Stirpe <[email protected]>
119+
* Nicolas JEUDY <https://github.com/njeudy>
120+
* Yannick Vaucher <[email protected]>
121+
* Ronald Portier <[email protected]>
122+
* Simone Orsi <[email protected]>
123+
124+
Maintainers
125+
~~~~~~~~~~~
126+
127+
This module is maintained by the OCA.
128+
129+
.. image:: https://odoo-community.org/logo.png
130+
:alt: Odoo Community Association
131+
:target: https://odoo-community.org
132+
133+
OCA, or the Odoo Community Association, is a nonprofit organization whose
134+
mission is to support the collaborative development of Odoo features and
135+
promote its widespread use.
136+
137+
.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px
138+
:target: https://github.com/alexis-via
139+
:alt: alexis-via
140+
141+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
142+
143+
|maintainer-alexis-via|
144+
145+
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/14.0/account_invoice_import>`_ project on GitHub.
146+
147+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

account_invoice_import/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from . import wizard
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2015-2021 Akretion France (http://www.akretion.com/)
2+
# @author: Alexis de Lattre <[email protected]>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Account Invoice Import",
7+
"version": "13.0.1.0.0",
8+
"category": "Accounting & Finance",
9+
"license": "AGPL-3",
10+
"summary": "Import supplier invoices/refunds as PDF or XML files",
11+
"author": "Akretion,Odoo Community Association (OCA)",
12+
"maintainers": ["alexis-via"],
13+
"website": "https://github.com/OCA/edi",
14+
"depends": [
15+
"account",
16+
"base_iban",
17+
"base_business_document_import",
18+
"onchange_helper",
19+
],
20+
"data": [
21+
"security/ir.model.access.csv",
22+
"security/rule.xml",
23+
"views/account_invoice_import_config.xml",
24+
"views/res_config_settings.xml",
25+
"wizard/account_invoice_import_view.xml",
26+
"views/account_invoice.xml",
27+
"views/account_journal_dashboard.xml",
28+
"views/res_partner.xml",
29+
],
30+
"images": ["images/sshot-wizard1.png"],
31+
"installable": True,
32+
}

0 commit comments

Comments
 (0)