Displaying currency on line form

For a company working with multiple currencies, currency information is missing when displaying a line form (purchase_line form, sale_line form,…).
In the case of viewing this form from the parent this is not really a problem because you can see the currency on the parent (purchase, sale, …) before viewing the line form and you know in which currency are the unit price and the amount.
But in the case of viewing directly the line form (when clicking on “origin” in a model), you don’t have this information until you click on the “parent” displayed on the line_form (on the screen capture, requisition field)

This could be improved by adding a currency function field on each model or adding currency to the rec_name of the parent… On my screen capture, requisition field could be "PRE2019100014 [USD]’.
Unless there’s a widget field to add currency symbol on some fields ?
Indeed this would be useful only for companies working with multiple currencies.
What do you think ?

It is possible to add a suffix on the views to include the currency symbols for the monetary fields. Like we do for percantage fields (see payment term relative deltas for example)

Personaly I prefer to see 100.00€ than 100.00 but probably it’s a mather of taste.
Indeed on reports the amounts always include the company currency, so for coherence we can do the same on the UI.

So i’ll have to create function field to get currency on the line and then using this function field to display symbol as suffix on the form view?

Indeed it’s better for our users to see 100.00€, but i could understand that such feature is not be added to core because most of users don’t use multiple currencies and it is obvious to them that all prices and amounts are in company’s currency

Yes, I think it’s the easies way.

Explicit is better than implicit”, so i think it will be good to show the currency symbol on the form without thinking is the user is using multicurrency or singlecurrency.

1 Like

For me, the best would be to have a dedicated widget for that that manage to put the currency symbol in the proper place depending of the currency (in front or after).
I think the widget should be smart enough to handle it with just the id of the currency, so we could use: <field name="amount" currency="('currency.currency', Eval('currency'))" widget="currency"/>. So it will keep in cache the values (symbol, position) for each id. The symbol should not be part of the editable place. The widget should be available in list and form view.

+1 for the widget :slight_smile:
How to know if currency is front or after the value?

It is defined in ir.lang as p_cs_precedes and n_cs_precedes.

To get those values, which language should be used ? Language of the party associated to the current company ? Language of the tryton client ?

It should use the value received from the user preferences which should take from the linked language.

After some discussion with @maxx, I think my proposed syntax is not the best nor easy to implement.
Indeed I think we can see this feature in a more generic way, it is about putting a symbol/unit in front or behind a numeric field. For example, it could also be used with quantity and unit.
So I think we could extend the numeric widgets (they all inherit from Integer widget) with this syntax: <field name="amount" unit="currency"/> where the content of unit attribute is the name of a Many2One field that inherit from a standard UnitMixin. The UnitMixin define a method get_unit_symbol that returns the symbol to use and the position start or end. The method has an RPC cache to limit the number of calls.
The mixin could be applied on currency.currency and product.uom.

Where should be defined the UnitMixin? In Currency module? As Product depends Company and Company needs Currency…

In trytond/model because it will be part of the standard API that the clients will be using.

https://bugs.tryton.org/issue9059

1 Like

Thanks for testing the issue and give me your comments… :slight_smile:

3 Likes

I know these images are just an example of how the fields will look, and on that point I think they look really good. :smiley:

Also, it seems that with this change the Unité and Currency columns in the Lignes will be redundant. With those columns no longer shown there will be more space for the other columns, and so the information there will be cleaner and clearer.

Overall I think this will be a really nice improvement.

1 Like

I updated to tip recently. Feel free to test. Comments are welcome.

https://bugs.tryton.org/issue9059

This topic was automatically closed after 2 days. New replies are no longer allowed.