frappe / frappejs

Node + Electron + Vue based metadata web framework (inspired by Frappe)
263 stars 109 forks source link

refactor: use dedicated class to handle currency #153

Closed 18alantom closed 2 years ago

18alantom commented 2 years ago

Changes

Currency handling using pesa

frappe.db.getSingleValues

await frappe.db.getSingleValues('currency', 'internalPrecision')

await frappe.db.getSingleValues(
  {fieldname: 'currency', parent: 'AccountingSettings'},
  {fieldname: 'internalPrecision', parent: 'SystemSettings'}
)

// Both will return:
// [ 
//    {fieldname: 'internalPrecision', value: '11', parent: 'SystemSettings'},
//    {fieldname: 'currency', value: 'INR', parent: 'AccountingSettings'}
// ]

Number Formatting

Hash based number formats have been removed. Intl.NumberFormat will be used instead. This is locale dependent, each country has an associated locale from which the number format is obtained.

Frappe Books: https://github.com/frappe/books/pull/268