diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/Dawn/views.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/python/Dawn/views.py b/python/Dawn/views.py index abd9ce83..bf9c6b1d 100644 --- a/python/Dawn/views.py +++ b/python/Dawn/views.py @@ -390,7 +390,7 @@ def terminate(dealid, kind): form.populate_obj(termination) session = form.get_session() rec = db.session.execute( - "SELECT notional, coalesce(terminated_amount, 0.), currency, globeop_id " + "SELECT notional, coalesce(terminated_amount, 0.), currency, globeop_id, cp_code " f"FROM {table} " "LEFT JOIN " "(SELECT dealid, sum(termination_amount) AS terminated_amount " @@ -398,9 +398,11 @@ def terminate(dealid, kind): "WHERE dealid = :dealid", {"dealid": dealid}, ) - notional, terminated_amount, currency, globeop_id = next(rec) + notional, terminated_amount, currency, globeop_id, cp_code = next(rec) if not termination.partial_termination: termination.termination_amount = notional - terminated_amount + if termination.termination_cp is None: + termination.termination_cp = cp_code session.add(termination) try: session.commit() |
