diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e007d1..1d784f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.1 + +* Fix missing dependencies + # 0.4.0 * Introduce statistics feature, allowing to parse a directory of invoices and generating revenue statistics (experimental) diff --git a/setup.py b/setup.py index 340fe8f..ec7bbae 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name="tqwgp-parser", - version="0.4.0", + version="0.4.1", url="https://github.com/YtoTech/talk-quote-work-getpaid-parser", license="AGPL-3.0", author="Yoan Tournade", @@ -27,5 +27,13 @@ }, zip_safe=False, platforms="any", - install_requires=["hy>=1.0a4", "toolz", "hyrule"], + install_requires=[ + "hy>=1.0a4", + "toolz", + "hyrule", + "pendulum", + "toml", + "pyyaml", + "click", + ], ) diff --git a/tqwgp_parser/__main__.py b/tqwgp_parser/__main__.py index 5d7e98e..bc0eece 100644 --- a/tqwgp_parser/__main__.py +++ b/tqwgp_parser/__main__.py @@ -276,46 +276,66 @@ def csv( ) csv_ouput = io.StringIO() csv_writer = csv_lib.writer(csv_ouput, quoting=csv_lib.QUOTE_MINIMAL) - csv_writer.writerow([ - "Project", "Reference", "Date (input)", "Date (parsed)", "Title", "Provider name", "Client name", "Total excl VAT", - - "VAT amount", "Total incl VAT", "Lines count" - ]) + csv_writer.writerow( + [ + "Project", + "Reference", + "Date (input)", + "Date (parsed)", + "Title", + "Provider name", + "Client name", + "Total excl VAT", + "VAT amount", + "Total incl VAT", + "Lines count", + ] + ) all_invoices = [] for document in loaded_documents["documents"]: if document["document_type"] == "invoice": for invoice in document["parsed_document"]["invoices"]: - all_invoices.append({ - "invoice": invoice, - "document": document, - # 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, - }) + all_invoices.append( + { + "invoice": invoice, + "document": document, + # 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, + } + ) if date_format: # By date. - sorted_invoices = sorted(all_invoices, key=lambda i: i['parsed_date']) + sorted_invoices = sorted(all_invoices, key=lambda i: i["parsed_date"]) else: # By reference. - sorted_invoices = sorted(all_invoices, key=lambda i: i['invoice']['number']) + sorted_invoices = sorted(all_invoices, key=lambda i: i["invoice"]["number"]) for invoice_entry in sorted_invoices: invoice = invoice_entry["invoice"] document = invoice_entry["document"] - csv_writer.writerow([ - 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["title"], - invoice["sect"]["name"], - invoice["client"]["name"], - # TODO Options to round, change numeric character (,.), ... - invoice["price"]["total_vat_excl"], - invoice["price"]["vat"], - invoice["price"]["total_vat_incl"], - len(invoice["lines"]), - ]) + csv_writer.writerow( + [ + 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["title"], + invoice["sect"]["name"], + invoice["client"]["name"], + # TODO Options to round, change numeric character (,.), ... + invoice["price"]["total_vat_excl"], + invoice["price"]["vat"], + invoice["price"]["total_vat_incl"], + len(invoice["lines"]), + ] + ) print(csv_ouput.getvalue())