aboutsummaryrefslogtreecommitdiffstats
path: root/python/Dawn/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/Dawn/views.py')
-rw-r--r--python/Dawn/views.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/python/Dawn/views.py b/python/Dawn/views.py
index c8e73d17..5b3b6d9c 100644
--- a/python/Dawn/views.py
+++ b/python/Dawn/views.py
@@ -271,7 +271,7 @@ def get_form(trade, kind):
]
elif kind == "swaption":
form.portfolio.choices = [("OPTIONS", "OPTIONS"), ("IR", "IR")]
-
+ form.cp_code.choices = form.cp_code.choices + list(cp_choices(kind))
return form
@@ -419,7 +419,6 @@ def trade_manage(tradeid, kind):
trade = get_trade(tradeid, kind)
form = _get_form(kind)()
- form.cp_code.choices = form.cp_code.choices + list(cp_choices(kind))
if kind == "bond":
old_ticket_name = trade.ticket
if kind == "capfloor":
@@ -435,6 +434,10 @@ def trade_manage(tradeid, kind):
save_ticket(trade, old_ticket_name)
if kind == "capfloor":
save_confirm(trade, old_confirm)
+ if kind == "cds":
+ if trade.swap_type != "CD_INDEX":
+ trade.account_code = "BAC"
+ trade.cashaccount = trade.fcm_account.cash_account
try:
session.commit()
except IntegrityError as e:
@@ -446,12 +449,6 @@ def trade_manage(tradeid, kind):
action_url=url_for("trade_manage", tradeid=tradeid, kind=kind),
)
else:
- if kind == "cds":
- if trade.swap_type != "CD_INDEX":
- trade.account_code = "BAC"
- trade.cashaccount = trade.fcm_account.cash_account
- session.commit()
-
buf = simple_serialize(trade, upload=form.upload_globeop.data)
q = get_queue()
q.rpush(f"{kind}_{form.fund.data}", buf)
@@ -460,9 +457,6 @@ def trade_manage(tradeid, kind):
if form.errors:
app.logger.error(form.errors)
form = get_form(trade, kind)
- form.cp_code.choices = form.cp_code.choices + list(cp_choices(kind))
- if kind == "cds":
- form.account_code.choices = list(fcm_accounts())
return render_template(
"trade_entry.html",
form=form,