Comments (7)
#7010 might be a requirement for this
from opencollective.
For this week:
- Call with @aerugo to kickstart project
- Create initial specs
- Start development
from opencollective.
Specs
Resolving this issue without #7010 would be clanky, as we'd have to make sure all items share the same FX rate when using the same currency (which might be wrong, for example if items are not from the same date) and store this information in inappropriate places. The specs proposed below therefore address both issues.
API
- In the
ExpenseItem
model- Add a
currency
field (string) - Add a
fxRate
field (float, the FX rate between the expense and the item) - Add a
fxRateSource
field (enum<OPENCOLLECTIVE|PAYPAL|WISE|USER
> who provided this FX rate)
- Add a
- Expose this information on the
ExpenseItem
GraphQL object - Add the appropriate fields to
ExpenseItemInput
/ExpenseItemCreateInput
- Update the code in
createExpense
/editExpense
to support this.-
createExpense
-
editExpense
- Make sure that we keep verifying that
expense.amount = SUM(expenseItem.amount)
by converting the expense items amounts using the provided FX rates. - If the user-provided FX rate is too far from what we have in the DB, throws an error.
-
- In the
uploadFile
mutation (that returns the OCR results):- Add a
parsingOptions
(object) argument -
parsingOptions
.currency
: target currency to return the OCR results for - If this currency was set, use it for the generated
ParseUploadedFileResult
, to make sure it updates all the children amounts (inExpenseParsedFileInfo
andExpenseItemParsedFileInfo
) are converted to the target currency. - Ideally, try to generate the FX rate for the date returned by
OCRParseResult.date
- Add a
- In
GraphQLCurrencyExchangeRateSourceType
, add aUSER
value to acknowledge that FX rates can now be user-submitted - Add an endpoint to dynamically fetch multiple currency rates (for when the currency of the expense or an item changes)
Frontend
- In the expense form
- When uploading expense items, make sure to fetch these new amount & exchange rate fields
- In
AmountInput
, implement the ability to view the amount in both currencies (based on a given exchange rate), as surfaced in the design below. We don't want to show country flags for now.
- Let the user change the amount in whatever currency. The one of the left stays the source of truth, so changing the amount on the right only affects the exchange rate.
- Below the amount, add the explicit exchange rate, along with a link to manually set one.
- The info tooltip should say:
Currency exchange rate from {source}, as of {date}. If you have a more accurate information, please enter it.
- Implement a strategy for when the expense currency changes
- When an item's currency changes, make sure to update the amount with a proper FX rate
- When viewing the expense
- Make sure to display the FX rate source and value along with the original amount
- Make sure that the new
GraphQLCurrencyExchangeRateSourceType
.USER
is properly internationalized.
Ideas & Questions
- Does Klippa support parsing the FX rate from documents? If yes, then we should use this value by default.
- We may want to add security checks/warnings/error prevention by checking if the fx rate looks legit (based on deviation from DB value)
from opencollective.
For this week:
- Finish the API implementation
- Start Frontend implementation
from opencollective.
For this week:
- Iterate on frontend proposal, post a new demo for feedback
- Cleanup the code to get it in a reviewable state
from opencollective.
This week:
- Iterate on E2E tests (we realized the CI config for E2E was not matching dev)
- Merge & deploy frontend + API
from opencollective.
Done & released!
from opencollective.
Related Issues (20)
- Add Swish Payment method via Strip, for Sweden HOT 3
- Let collective admins view agreements
- Link Tax Forms to fiscal hosts HOT 1
- Tax Forms: add watermark on preview
- Remove root action to manually set tax form
- Surface download tax form from the expense page
- Transaction Buttons Don't Appear Immediately (only Upon Refresh) HOT 2
- Activities missing an expense description/link
- UI: Update Transaction details drawer
- Submitting Expenses with YEN; Validation Errors HOT 1
- `getServerSideProps` leads to unexpected unauthenticated queries
- Ability to export expense attachments (autogenerated invoices, item files) HOT 1
- Image in Reset Password Screen is Misaligned HOT 4
- Activity Log Dashboard: Failed Contributions Appear from Incognito
- Website join Slack link not working HOT 2
- Unclear behavior of "Virtual card charge receipts- has no receipts" filter
- Avoid re-rendering transactions table on row hover
- Cannot Select All Vendors when Editing and Expense
- Move Vendor display picture to Images server
- Toast Container error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencollective.