{"action":"closed","issue":{"url":"https://api.github.com/repos/jantman/biweeklybudget/issues/178","repository_url":"https://api.github.com/repos/jantman/biweeklybudget","labels_url":"https://api.github.com/repos/jantman/biweeklybudget/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/jantman/biweeklybudget/issues/178/comments","events_url":"https://api.github.com/repos/jantman/biweeklybudget/issues/178/events","html_url":"https://github.com/jantman/biweeklybudget/issues/178","id":294596173,"node_id":"MDU6SXNzdWUyOTQ1OTYxNzM=","number":178,"title":"Budget split for transactions - implement split","user":{"login":"jantman","id":273454,"node_id":"MDQ6VXNlcjI3MzQ1NA==","avatar_url":"https://avatars0.githubusercontent.com/u/273454?v=4","gravatar_id":"","url":"https://api.github.com/users/jantman","html_url":"https://github.com/jantman","followers_url":"https://api.github.com/users/jantman/followers","following_url":"https://api.github.com/users/jantman/following{/other_user}","gists_url":"https://api.github.com/users/jantman/gists{/gist_id}","starred_url":"https://api.github.com/users/jantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jantman/subscriptions","organizations_url":"https://api.github.com/users/jantman/orgs","repos_url":"https://api.github.com/users/jantman/repos","events_url":"https://api.github.com/users/jantman/events{/privacy}","received_events_url":"https://api.github.com/users/jantman/received_events","type":"User","site_admin":false},"labels":[{"id":614814688,"node_id":"MDU6TGFiZWw2MTQ4MTQ2ODg=","url":"https://api.github.com/repos/jantman/biweeklybudget/labels/unreleased%20fix","name":"unreleased fix","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jantman/biweeklybudget/milestones/1","html_url":"https://github.com/jantman/biweeklybudget/milestone/1","labels_url":"https://api.github.com/repos/jantman/biweeklybudget/milestones/1/labels","id":3159121,"node_id":"MDk6TWlsZXN0b25lMzE1OTEyMQ==","number":1,"title":"0.8.0","description":"Next minor release - 0.8.0","creator":{"login":"jantman","id":273454,"node_id":"MDQ6VXNlcjI3MzQ1NA==","avatar_url":"https://avatars0.githubusercontent.com/u/273454?v=4","gravatar_id":"","url":"https://api.github.com/users/jantman","html_url":"https://github.com/jantman","followers_url":"https://api.github.com/users/jantman/followers","following_url":"https://api.github.com/users/jantman/following{/other_user}","gists_url":"https://api.github.com/users/jantman/gists{/gist_id}","starred_url":"https://api.github.com/users/jantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jantman/subscriptions","organizations_url":"https://api.github.com/users/jantman/orgs","repos_url":"https://api.github.com/users/jantman/repos","events_url":"https://api.github.com/users/jantman/events{/privacy}","received_events_url":"https://api.github.com/users/jantman/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":4,"state":"open","created_at":"2018-03-04T14:06:55Z","updated_at":"2018-07-07T22:05:07Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-02-06T00:59:19Z","updated_at":"2018-07-07T22:05:07Z","closed_at":"2018-07-07T22:05:07Z","author_association":"OWNER","body":"This is the second part of adding support for allocating a single transaction against multiple budgets. This must maintain the actual transaction amount (for OFX reconcile, etc.) but allow allocating that amount either to one budget, or split across multiple budgets.\r\n\r\nThe first part was done in #105 to update the models to use BudgetTransactions to associate a Transaction with a budget. Once that's done and verified, implement the pieces to allow splits, i.e. multiple budgets for a Transaction. OFX reconcile must still work, and allocated vs spent must still work as well.\r\n\r\n__Planning:__\r\n\r\n* [x] How to display transactions with split budgets on the various table and datatable views (i.e. payperiod, transactions, etc.).\r\n\r\n__Implementation:__\r\n\r\n* [x] Validation in the DB layer to ensure that all BudgetTransactions equal the amount of the parent Transaction. This is already done via [Transaction.set_budget_amounts()](http://biweeklybudget.readthedocs.io/en/latest/biweeklybudget.models.transaction.html#biweeklybudget.models.transaction.Transaction.set_budget_amounts).\r\n* [x] Ensure that everywhere we do calculations based on BudgetTransactions, we support splits\r\n  * [x] [budgets view by_month chart](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/budgets.py#L350)\r\n  * [x] [BiweeklyPayPeriod._dict_for_trans()](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/biweeklypayperiod.py#L619-L620) and then cascading updates to that class\r\n* [x] UI support for display of split transactions\r\n  * [x] Transactions view / datatable (note: Budget is not a search-able field via Search box)\r\n    * [x] [transactions view ajax /ajax/transactions](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/transactions.py#L198-L204) and [datatable](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/static/js/transactions.js#L42)\r\n    * [x] Ensure sorting on Budget column still works\r\n    * [x] Ensure Budget filter dropdown still works, including for split transactions\r\n  * [x] payperiod view (transactions table) - ``transactions`` list now has \"budgets\" dict instead of ``budget_id`` and ``budget_name``, like ``BiweeklyPayPeriod._dict_for_trans()``\r\n  * [x] reconcile view Transaction div - [reconcile /ajax/unreconciled/trans](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/reconcile.py#L128-L129) and [reconcile.js reconcileTransDiv](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/static/js/reconcile.js#L163-L183)\r\n  * [x] Reconcile modal form and population - [reconcile /ajax/reconcile/ID](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/reconcile.py#L85-L86) and [reconcile_modal.js](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/static/js/reconcile_modal.js#L61)\r\n* [x] UI support for splitting a transaction across multiple budgets, including editing of existing transactions.\r\n  * [x] Transaction modal and reconcile modal - populate with budget split - [transactions view single txn ajax /ajax/transactions/ID](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/transactions.py#L221-L223)\r\n  * Transaction modal, form and backend - ([/forms/transaction validation](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/transactions.py#L269) and [/forms/transaction submission](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/views/transactions.py#L320-L321)) and [modal](https://github.com/jantman/biweeklybudget/blob/6330b52fd4565795b202b15b333a38855d5cd243/biweeklybudget/flaskapp/static/js/transactions_modal.js)\r\n  * [x] Transaction modal - new transaction with budget split\r\n    * [x] Client-side validation of budget split amounts/total\r\n  * [x] Transaction modal - edit/save transaction that was already split (different budgets and/or amounts)\r\n    * [x] Client-side validation of budget split amounts/total\r\n  * [x] Transaction modal - edit/save transaction that was not previously split, now is\r\n    * [x] Client-side validation of budget split amounts/total\r\n  * [x] Transaction modal - edit/save transaction that was previously split, but isn't anymore\r\n    * [x] Client-side validation of budget split amounts/total\r\n  * [x] Verify (direct POST) backend validation of budget split amounts/total on existing Transaction\r\n  * [x] Verify (direct POST) backend validation of budget split amounts/total on new Transaction\r\n  * [x] When changing a txn from not split to split, select proper budget and set initial amount\r\n  * [x] On split txn, when a budget is selected and its amount is empty, set amount to the remaining from total\r\n* [x] Grep flaskapp for ``budget_id`` and ``budget_name``; be sure to remove any straggling uses\r\n* [x] Add some split transactions to sampledata (ensure that overall amount doesn't change)\r\n  * [x] Update all acceptance tests for new budget sums for the payperiod\r\n"}}
{"actor":{"display_login":"jantman"}}