o-spreadsheet icon indicating copy to clipboard operation
o-spreadsheet copied to clipboard

[IMP] currency format: add accounting format

Open hokolomopo opened this issue 7 months ago • 1 comments

[IMP] format: implement multi-part format

This commits adds the possibility to have a format with multiple parts, as well as improving/fixing the behaviour of currently implemented formats.

The formats are now tokenized and parsed in a more structured way, which allows for more complex formats to be implemented. Some example of things that are now supported are:

  • multi parts format, separated by a semicolon
  • multiple escaped strings in a number format
  • strings can now be escaped with quotes, and chars with backslash
  • escaped string now support [ characters inside of them
  • can now have any separator/escaped string inside a date format
  • number formats with escaped strings in the middle are now correctly handled (before formatting 123 with format 0[$$]0 would return 123$123 instead of 12$3)
  • we support format on strings

[IMP] format: handled more complex text format

Also removed the PLAIN_TEXT_FORMAT variable. The variable made it looks like the @ was an immutable special case, whereas @ is just a text placeholder that can be used in more complex text formats.

[IMP] currency format: add accounting format:

This commits adds the accounting format. This is similar to a currency format, except that negative values are displayed in parentheses and zero is displayed as a dash.

Also changed the model config defaultCurrencyFormat to defaultCurrency, so it can be used for both currency and accounting formats.

Task: : 4083126

review checklist

  • [ ] feature is organized in plugin, or UI components
  • [ ] support of duplicate sheet (deep copy)
  • [ ] in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • [ ] in model/UI: ranges are strings (to show the user)
  • [ ] undo-able commands (uses this.history.update)
  • [ ] multiuser-able commands (has inverse commands and transformations where needed)
  • [ ] new/updated/removed commands are documented
  • [ ] exportable in excel
  • [ ] translations (_t("qmsdf %s", abc))
  • [ ] unit tested
  • [ ] clean commented code
  • [ ] track breaking changes
  • [ ] doc is rebuild (npm run doc)
  • [ ] status is correct in Odoo

hokolomopo avatar Aug 02 '24 11:08 hokolomopo