mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 05:01:48 +02:00
Fix minor issues with BillForm task
This commit is contained in:
parent
cda60ee55d
commit
203a31fcf5
3 changed files with 15 additions and 3 deletions
|
@ -38,7 +38,7 @@ def get_billform_for(project, set_default=True, **kwargs):
|
|||
display the default form, it will call set_default on it.
|
||||
|
||||
"""
|
||||
form = BillForm(project=project, **kwargs)
|
||||
form = BillForm(**kwargs)
|
||||
form.original_currency.label = Label("original_currency", "Currency (Default: %s)" % (project.default_currency))
|
||||
active_members = [(m.id, m.name) for m in project.active_members]
|
||||
|
||||
|
@ -193,7 +193,7 @@ class BillForm(FlaskForm):
|
|||
bill.date = self.date.data
|
||||
bill.owers = [Person.query.get(ower, project) for ower in self.payed_for.data]
|
||||
bill.original_currency = self.original_currency.data
|
||||
bill.original_amount = currency_helper.exchange_currency(bill.amount, bill.original_currency, project.default_currency)
|
||||
bill.original_amount = self.currency_helper.exchange_currency(bill.amount, bill.original_currency, project.default_currency)
|
||||
|
||||
return bill
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@
|
|||
{{ input(form.what, inline=True) }}
|
||||
{{ input(form.payer, inline=True, class="form-control custom-select") }}
|
||||
{{ input(form.amount, inline=True) }}
|
||||
{{ input(form.external_link, inline=True) }}
|
||||
{{ input(form.original_currency, inline=True) }}
|
||||
{{ input(form.external_link, inline=True) }}
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-3" for="payed_for">{{ _("For whom?") }}</label>
|
||||
|
|
|
@ -1099,6 +1099,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer": 1,
|
||||
"payed_for": [1, 2, 3, 4],
|
||||
"amount": "10.0",
|
||||
"original_amount": "10.0",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -1110,6 +1112,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer": 2,
|
||||
"payed_for": [1, 3],
|
||||
"amount": "200",
|
||||
"original_amount": "200",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -1121,6 +1125,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer": 3,
|
||||
"payed_for": [2],
|
||||
"amount": "13.33",
|
||||
"original_amount": "13.3",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -1134,6 +1140,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer_name": "tata",
|
||||
"payer_weight": 1.0,
|
||||
"owers": ["fred"],
|
||||
"original_amount": "13.3",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
{
|
||||
"date": "2016-12-31",
|
||||
|
@ -1142,6 +1150,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer_name": "fred",
|
||||
"payer_weight": 1.0,
|
||||
"owers": ["alexis", "tata"],
|
||||
"original_amount": "200.0",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
{
|
||||
"date": "2016-12-31",
|
||||
|
@ -1150,6 +1160,8 @@ class BudgetTestCase(IhatemoneyTestCase):
|
|||
"payer_name": "alexis",
|
||||
"payer_weight": 2.0,
|
||||
"owers": ["alexis", "fred", "tata", "p\xe9p\xe9"],
|
||||
"original_amount": "10.0",
|
||||
"original_currency": "USD",
|
||||
},
|
||||
]
|
||||
self.assertEqual(json.loads(resp.data.decode("utf-8")), expected)
|
||||
|
|
Loading…
Reference in a new issue