-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
grap_account_invoice_invoice2data_templates/templates/relais_vert_3.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
issuer: Relais Vert | ||
|
||
keywords: | ||
- "352 867 493 00137" | ||
- "FR 72 352 867 493" | ||
- "AVOIR AC" | ||
|
||
fields: | ||
version: | ||
parser: static | ||
value: 3 | ||
vat: | ||
parser: static | ||
value: "FR72352867493" | ||
amount: | ||
parser: regex | ||
type: float | ||
regex: Montant Total TTC\s+-([\d\s?]+\.\d+) | ||
amount_untaxed: | ||
parser: regex | ||
type: float | ||
regex: Montant Total HT\s+-([\d\s?]+\.\d+) | ||
invoice_number: | ||
parser: regex | ||
regex: AVOIR\s+(AC\d+) | ||
date: | ||
parser: regex | ||
type: date | ||
regex: AVOIR.*(\d{2}/\d{2}/\d{4}) | ||
vat_code_055: | ||
parser: static | ||
value: "1" | ||
vat_code_200: | ||
parser: static | ||
value: "6" | ||
lines: | ||
parser: lines | ||
start: Adresse de facturation | ||
end: Total TTC | ||
line: ^ ?(?P<product_code>\w+) +(?P<product_name>.*) {5,}((?P<optional_package_qty>-\d+) +)? {5,}-(?P<quantity>\d+(\.\d+)?) +(?P<price_unit>\d+\.\d+) +-(?P<price_subtotal>\d+\.\d+) ?(?P<vat_code>1|6) | ||
types: | ||
quantity: float | ||
price_unit: float | ||
price_subtotal: float | ||
|
||
options: | ||
currency: EUR | ||
date_formats: | ||
- '%d/%m/%Y' | ||
languages: | ||
- fr | ||
decimal_separator: '.' | ||
replace: | ||
# Standardize the decimal separator. ('1,24' -> '1.24') | ||
- [',', '.'] | ||
# Remove the thousands separator. ('1 234.56' -> '1234.56') | ||
- ['(\d+) (\d{3}\.\d{2})', '\g<1>\g<2>'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...oice2data_templates/tests/invoices/relais-vert__2024-07-26__CLO__AC10407220.pdf.encrypted
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
grap_account_invoice_invoice2data_templates/tests/test_relais_vert_3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from datetime import datetime | ||
|
||
from .test_module import TestModule | ||
|
||
|
||
class TestRelaisVert(TestModule): | ||
def test_relais_vert_3_01(self): | ||
self._test_supplier_template( | ||
"relais-vert__2024-07-26__CLO__AC10407220.pdf", | ||
line_qty=13, | ||
expected_values={ | ||
"issuer": "Relais Vert", | ||
"version": 3, | ||
"date": datetime(day=26, month=7, year=2024), | ||
"invoice_number": "AC10407220", | ||
"amount_untaxed": 105.38, | ||
"amount": 111.18, | ||
}, | ||
expected_lines=[ | ||
{ | ||
"product_code": "16887", | ||
"product_name": "BOUCHEES MOZZARELLA ET TOMATES (6X30G) CARTE NATURE", | ||
"vat_code": "1", | ||
"quantity": 2.0, | ||
"price_unit": 2.83, | ||
"price_subtotal": 5.66, | ||
} | ||
], | ||
) |