odoo / o-spreadsheet

Other
193 stars 44 forks source link

[IMP] currency format: add accounting format #4769

Closed hokolomopo closed 1 month ago

hokolomopo commented 2 months ago

[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:

[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

robodoo commented 2 months ago

Pull request status dashboard

rrahir commented 1 month ago

Small functional comment - the "zero" format that we propose for the custom currency formats isn't that good, having the symbol or code adjacent to the dash "-", that is. Could we imagine adding some padding, maybe a simple space or 2 for that case?

hokolomopo commented 1 month ago

Small functional comment - the "zero" format that we propose for the custom currency formats isn't that good, having the symbol or code adjacent to the dash "-", that is. Could we imagine adding some padding, maybe a simple space or 2 for that case?

That's fixed in the follow up task https://www.odoo.com/odoo/2328/tasks/3965246 where I add the * character support in the format. But I can also put some spaces here, it's free 🤷

rrahir commented 1 month ago

yayyy

@robodoo r+ rebase-ff

robodoo commented 1 month ago

Merge method set to rebase and fast-forward.