Skip to content

Commit

Permalink
Merge PR #74 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Oct 7, 2024
2 parents 4b54c4a + dd9ecd8 commit 5529bcf
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
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>']
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from . import test_relais_local
from . import test_relais_vert_1
from . import test_relais_vert_2
from . import test_relais_vert_3
from . import test_scop_epice_1
from . import test_scop_epice_2
from . import test_salaisons_de_chartreuse
Expand Down

Large diffs are not rendered by default.

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,
}
],
)

0 comments on commit 5529bcf

Please sign in to comment.