Skip to content

Commit

Permalink
Fix bug CSV stats no VAT
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsieurV committed Jun 26, 2024
1 parent 2b531db commit c14e8fc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.6.4

* Fix bug with CSV stat export when no VAT on an invoice

# 0.6.3

* Fix bug with `price_formula` and empty string prices

# 0.6.2

* Migrate to Hy `>= 0.26`
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import sys
import re
import os
import ast
from setuptools import setup


# Pass package modules files.
# From https://stackoverflow.com/a/36693250/1956471
def package_files(directory):
paths = []
for (path, directories, filenames) in os.walk(directory):
for path, directories, filenames in os.walk(directory):
for filename in filenames:
paths.append(os.path.join("..", path, filename))
return paths
Expand All @@ -20,7 +18,7 @@ def package_files(directory):

setup(
name="tqwgp-parser",
version="0.6.3",
version="0.6.4",
url="https://github.com/YtoTech/talk-quote-work-getpaid-parser",
license="AGPL-3.0",
author="Yoan Tournade",
Expand Down
22 changes: 13 additions & 9 deletions tqwgp_parser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,13 @@ def format_decimal(number):
# TODO Include date parsing in core parser.
# Allows to set format in definitions?
# "DD MMMM YYYY"
"parsed_date": pendulum.from_format(
invoice["date"], date_format, locale=date_locale
)
if date_format
else None,
"parsed_date": (
pendulum.from_format(
invoice["date"], date_format, locale=date_locale
)
if date_format
else None
),
}
)
if date_format:
Expand All @@ -343,15 +345,17 @@ def format_decimal(number):
document["project_name"],
invoice["number"],
invoice["date"],
invoice_entry["parsed_date"].format(date_csv_format)
if invoice_entry["parsed_date"] and date_csv_format
else "-",
(
invoice_entry["parsed_date"].format(date_csv_format)
if invoice_entry["parsed_date"] and date_csv_format
else "-"
),
invoice["title"],
invoice["sect"]["name"],
invoice["client"]["name"],
# Options to round, change numeric character (,.), ...
format_decimal(invoice["price"]["total_vat_excl"]),
format_decimal(invoice["price"]["vat"]),
format_decimal(invoice["price"]["vat"] or 0),
format_decimal(invoice["price"]["total_vat_incl"]),
len(invoice["lines"]),
]
Expand Down

0 comments on commit c14e8fc

Please sign in to comment.