-
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
9 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
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
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
69 changes: 69 additions & 0 deletions
69
grap_account_invoice_invoice2data_templates/templates/saldac_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,69 @@ | ||
issuer: Saldac | ||
|
||
keywords: | ||
# Note: Il semblerait qu'il y ait plusieurs établissements secondaire | ||
# - 44206081000011 | ||
# - 44206081000029 | ||
- "FR91442060810" | ||
- "Montant HT +Tx TVA" | ||
- "Conditions de règlement" | ||
|
||
fields: | ||
version: | ||
parser: static | ||
value: 3 | ||
vat: | ||
parser: static | ||
value: "FR91442060810" | ||
amount: | ||
parser: regex | ||
type: float | ||
regex: Total TTC\s+(\d+\.\d+) | ||
amount_untaxed: | ||
parser: regex | ||
type: float | ||
regex: Total HT\s+(\d+\.\d+) | ||
invoice_number: | ||
parser: regex | ||
regex: Facture N°.*\s+(FA[\w+|\/]+) | ||
date: | ||
parser: regex | ||
type: date | ||
regex: Facture N°.*\s+FA[\w+|\/]+ +(\d{2}\/\d{2}\/\d{2}) | ||
date_due: | ||
parser: regex | ||
type: date | ||
regex: Conditions de.*(\d{2}\/\d{2}\/\d{4}) | ||
vat_code_055: | ||
parser: static | ||
value: "5.5" | ||
vat_code_200: | ||
parser: static | ||
value: "20.0" | ||
lines: | ||
parser: lines | ||
start: Réf.*TVA | ||
end: Code +Base | ||
# Note: Dans 'P.U net HT', il y a le prix brut. Tout va bien | ||
line: ^ *(?P<product_code>\w+) *(?P<product_name>.*) +(?P<quantity>\d+) +(?P<price_unit>\d+\.\d+) +((?P<discount>\d+(\.\d+)?)%)? +(?P<price_subtotal>\d+\.\d+) +(?P<vat_code>\d+\.\d+)$ | ||
types: | ||
quantity: float | ||
price_unit: float | ||
discount: float | ||
price_subtotal: float | ||
|
||
options: | ||
currency: EUR | ||
date_formats: | ||
- '%d/%m/%Y' | ||
- '%d/%m/%y' | ||
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>'] | ||
|
||
# Some product are on two lines | ||
- [' *(.*)\n\s+(\w+) *(\d+\ *\d+\.\d+\ *\d+\.\d+ *2)', '\g<2> \g<1> \g<3>'] | ||
- ['\s+\*spp', ' '] |
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
...ice_invoice2data_templates/tests/invoices/saldac__2024-08-20__LUC__FA243718.pdf.encrypted
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...oice_invoice2data_templates/tests/invoices/saldac__2024-09-24__LUC_FA244308.pdf.encrypted
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
60 changes: 60 additions & 0 deletions
60
grap_account_invoice_invoice2data_templates/tests/test_saldac_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,60 @@ | ||
# Copyright (C) 2023 - 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 TestSaldac(TestModule): | ||
def test_saldac_3_01(self): | ||
self._test_supplier_template( | ||
"saldac__2024-08-20__LUC__FA243718.pdf", | ||
line_qty=4, | ||
expected_values={ | ||
"issuer": "Saldac", | ||
"version": 3, | ||
"date": datetime(day=20, month=8, year=2024), | ||
"date_due": datetime(day=27, month=8, year=2024), | ||
"invoice_number": "FA243718", | ||
"amount_untaxed": 437.32, | ||
"amount": 461.37, | ||
}, | ||
expected_lines=[ | ||
{ | ||
"product_code": "CAFEM1KG", | ||
"product_name": "Café moulu bio. El Palomar - Pérou 1 kg. *SPP", | ||
"vat_code": "5.5", | ||
"quantity": 18.0, | ||
"price_unit": 13.75, | ||
"discount": 2.0, | ||
"price_subtotal": 242.55, | ||
} | ||
], | ||
) | ||
|
||
def test_saldac_3_02(self): | ||
self._test_supplier_template( | ||
"saldac__2024-09-24__LUC_FA244308.pdf", | ||
line_qty=8, | ||
expected_values={ | ||
"issuer": "Saldac", | ||
"version": 3, | ||
"date": datetime(day=24, month=9, year=2024), | ||
"date_due": datetime(day=1, month=10, year=2024), | ||
"invoice_number": "FA244308", | ||
"amount_untaxed": 909.17, | ||
"amount": 959.17, | ||
}, | ||
expected_lines=[ | ||
{ | ||
"product_code": "NOIXAMA2KG", | ||
"product_name": "Noix Amazonie grillée bio. Pérou. sac de 2 kg", | ||
"vat_code": "5.5", | ||
"quantity": 1.0, | ||
"price_unit": 45.2, | ||
"discount": 2.0, | ||
"price_subtotal": 44.3, | ||
} | ||
], | ||
) |