Compare commits
No commits in common. "3bc150c088386a8865b55849df497e532a344450" and "30a0d9a8921eeae80c3026004059a93421ec3287" have entirely different histories.
3bc150c088
...
30a0d9a892
2 changed files with 2 additions and 25 deletions
|
@ -8,7 +8,7 @@ Wir berechnen dir daher die folgenden Mitgliedsbeiträge:
|
|||
Wir werden dir daher die folgenden Mitgliedsbeiträge berechnen:
|
||||
{%- endif %}
|
||||
{% for line in invoice.lines %}
|
||||
{% if line.description %}{{ line.description.ljust(39) }}{% elif line.product %}{{ line.product.name.ljust(39) }}{% else %}{{ " ".ljust(39) }}{% endif %} {{ (line.quantity|format_quantity).rjust(5) }} × {{ (line.unit_price|format_currency(currency=line.currency.code)).rjust(9) }} = {{ (line.amount|format_currency(currency=line.currency.code)).rjust(12) }}
|
||||
{{ line.description.ljust(39) }} {{ (line.quantity|format_quantity).rjust(5) }} × {{ (line.unit_price|format_currency(currency=line.currency.code)).rjust(9) }} = {{ (line.amount|format_currency(currency=line.currency.code)).rjust(12) }}
|
||||
{%- endfor %}
|
||||
{{ "".ljust(72, '-') }}
|
||||
{{ "Summe".ljust(59) }} {{ (invoice.total_amount|format_currency).rjust(12) }}
|
||||
|
|
|
@ -11,7 +11,6 @@ import operator
|
|||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
import tomllib
|
||||
|
||||
import babel.numbers
|
||||
import dateutil.relativedelta
|
||||
|
@ -69,10 +68,7 @@ def fee_invoice(env: Env):
|
|||
invoicing_client = triad.client.InvoicingClient.from_session(env.session)
|
||||
template = env.jinja2_env.get_template("beitrag.eml")
|
||||
for member in csvreader:
|
||||
try:
|
||||
invoice = invoicing_client.Invoice.find([(env.args.lookup_key, "=", str(member['invoice_id'])), ("type", "=", "out")])[0]
|
||||
except IndexError:
|
||||
continue
|
||||
invoice = invoicing_client.get_invoice_by_id(member['invoice_id'])
|
||||
year = invoice.invoice_date or env.args.year
|
||||
months = [datetime.date(year.year, month, 1) for month in range(1, 13)]
|
||||
email_address = member.get('email') or invoice.party.email
|
||||
|
@ -182,8 +178,6 @@ def main():
|
|||
parser.add_argument("-O", "--output-dir", help="email output directory", default=".", type=pathlib.Path)
|
||||
parser.add_argument("-T", "--template-dir", help="email template directory", default="mail_templates")
|
||||
|
||||
parser.add_argument("-c", "--config", type=argparse.FileType("rb"))
|
||||
|
||||
# Email arguments
|
||||
parser.add_argument('--email-sender', help='email signature sender')
|
||||
parser.add_argument("--email-from", help="email from header")
|
||||
|
@ -196,7 +190,6 @@ def main():
|
|||
fee_invoice_parser.add_argument("-F", "--csv-fields", type=lambda f: f.split(","), help="csv fields")
|
||||
fee_invoice_parser.add_argument("-y", "--year", type=lambda y: datetime.date(int(y), 1, 1))
|
||||
fee_invoice_parser.add_argument("--months", help="Beitragsmonate", type=lambda m: m.split(","), default="1,2,3,4,5,6,7,8,9,10,11,12")
|
||||
fee_invoice_parser.add_argument("-k", "--lookup-key", choices={'number', 'id'}, default='id', help='lookup key for invoice')
|
||||
fee_invoice_parser.add_argument("csvfile", type=argparse.FileType("r"), default="-", nargs="?")
|
||||
fee_invoice_parser.set_defaults(func=fee_invoice)
|
||||
|
||||
|
@ -220,22 +213,6 @@ def main():
|
|||
env.jinja2_env.filters["format_quantity"] = format_quantity
|
||||
env.args = args
|
||||
|
||||
if args.config:
|
||||
env.config = tomllib.load(args.config)
|
||||
args.config.close()
|
||||
if "tryton" in env.config:
|
||||
if "uri" in env.config["tryton"]:
|
||||
env.args.uri = env.config["tryton"]["uri"]
|
||||
if "username" in env.config["tryton"]:
|
||||
env.args.username = env.config["tryton"]["username"]
|
||||
if "password" in env.config["tryton"]:
|
||||
env.args.password = env.config["tryton"]["password"]
|
||||
if "email" in env.config:
|
||||
if "sender" in env.config["email"]:
|
||||
env.args.email_sender = env.config["email"]["sender"]
|
||||
if "from" in env.config["email"]:
|
||||
env.args.email_from = env.config["email"]["from"]
|
||||
|
||||
if not args.uri:
|
||||
args.uri = input("URI for Tryton: ")
|
||||
|
||||
|
|
Loading…
Reference in a new issue