Issue 9059

Title
Add symbol widget
Priority
feature
Status
resolved
Nosy list
ced, mrichez, pokoli, reviewbot, roundup-bot, tbruyere
Assigned to
mrichez
Keywords
review

Created on 2020-02-12.09:27:43 by mrichez, last changed 1 month ago by roundup-bot.

Files

File name Uploaded Type Details
2020-10-07_09-25.png mrichez, 2020-10-07.09:32:38 image/png view
2020-10-07_10-03.png mrichez, 2020-10-07.10:07:53 image/png view
2020-10-07_10-04.png mrichez, 2020-10-07.10:08:00 image/png view
Capture d’écran du 2020-02-12 09-27-22.png mrichez, 2020-02-12.09:27:43 image/png view

Messages

New changeset 05ef7864c30f by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/tryton-env/rev/05ef7864c30f
New changeset 4b2f3943f786 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/trytond/rev/4b2f3943f786
New changeset 950ea9913fee by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/tryton/rev/950ea9913fee
New changeset 1f85e96c0a8f by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/sao/rev/1f85e96c0a8f
New changeset abdf99ed067b by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/stock_supply/rev/abdf99ed067b
New changeset 3d1c711ee840 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/stock_secondary_unit/rev/3d1c711ee840
New changeset 18e2ce2bc895 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/stock_assign_manual/rev/18e2ce2bc895
New changeset b3a812230160 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/stock/rev/b3a812230160
New changeset cf0f86aa135b by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/sale_subscription/rev/cf0f86aa135b
New changeset 1f6beacf913c by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/sale_secondary_unit/rev/1f6beacf913c
New changeset 07c95a3988db by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/sale_opportunity/rev/07c95a3988db
New changeset 01df1c4401a8 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/sale/rev/01df1c4401a8
New changeset 7535936ae6a3 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/purchase_secondary_unit/rev/7535936ae6a3
New changeset f8de39ea0fbe by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/purchase_requisition/rev/f8de39ea0fbe
New changeset 3a352f084376 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/purchase_request/rev/3a352f084376
New changeset 6a6b4ef53946 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/purchase/rev/6a6b4ef53946
New changeset 62a4dbf21078 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/project_revenue/rev/62a4dbf21078
New changeset 32859d21e9fc by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/project_invoice/rev/32859d21e9fc
New changeset 5fa6035477e6 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/production/rev/5fa6035477e6
New changeset 4a3959012292 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/product/rev/4a3959012292
New changeset 26b152cfcb9c by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/currency/rev/26b152cfcb9c
New changeset 08411d358af1 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/account_statement/rev/08411d358af1
New changeset 7a97a877817c by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/account_payment/rev/7a97a877817c
New changeset 1f9ce6dda52c by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/account_invoice/rev/1f9ce6dda52c
New changeset a725643793fa by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/account_asset/rev/a725643793fa
New changeset 57d2c74e8999 by Cédric Krier in branch 'default':
Add symbol widget
https://hg.tryton.org/modules/account/rev/57d2c74e8999
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-07.14:25:05
On 2020-10-07 13:52, Maxime Richez wrote:
> Forget previous message, error happens when creating a new sale_line:
>   …
>   File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/integer.py", line 70, in display
>     symbol, position = self.field.get_symbol(self.record, self.symbol)
> 
> AttributeError: 'NoneType' object has no attribute 'get_symbol'

This has already been fixed in Set 20.
Author: [hidden] (mrichez)
Date: 2020-10-07.13:52:25
Forget previous message, error happens when creating a new sale_line:
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 339, in _sig_new
    self._new_single()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 355, in _new_single
    WinForm(self.screen, lambda a: update_sequence(), new=True,
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/win_form.py", line 38, in __init__
    self.screen.switch_view(view_type=view_type)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 549, in switch_view
    self.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 937, in display
    view.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form.py", line 531, in display
    widget.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/float.py", line 28, in display
    super(Float, self).display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/integer.py", line 70, in display
    symbol, position = self.field.get_symbol(self.record, self.symbol)

AttributeError: 'NoneType' object has no attribute 'get_symbol'
Author: [hidden] (mrichez)
Date: 2020-10-07.13:51:17
Retried with another clean sqlite database and no problem...
Author: [hidden] (mrichez)
Date: 2020-10-07.13:46:07
Another error when trying to create a new sale (just applied symbols on this module): 
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/form.py", line 366, in sig_new
    self.screen.new()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 626, in new
    self.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 937, in display
    view.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form.py", line 531, in display
    widget.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 527, in display
    self.screen.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 937, in display
    view.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form.py", line 531, in display
    widget.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/float.py", line 28, in display
    super(Float, self).display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/integer.py", line 70, in display
    symbol, position = self.field.get_symbol(self.record, self.symbol)

AttributeError: 'NoneType' object has no attribute 'get_symbol'
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-10-07.10:59:19
It is a problem in the implementation of the theme: issue9689
Author: [hidden] (mrichez)
Date: 2020-10-07.10:07:53
In Sao, borders of the fields with symbols are not regulars (rounded on one side, no border on the top except the part with symbol, dotted line on bottom except part with the symbol) See pictures 2020-10-07_10-03.png and 2020-10-07_10-04.png
Author: [hidden] (mrichez)
Date: 2020-10-07.09:32:38
Made some tests this morning, got an error on the form when removing unit:
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/many2one.py", line 189, in sig_edit
    self.field.set_client(self.record, self.value_from_id(None, ''))
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/field.py", line 490, in set_client
    super(M2OField, self).set_client(record, value,
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/field.py", line 163, in set_client
    record.signal('record-changed')
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/signal_event.py", line 15, in signal
    fnct(self, signal_data, *data)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/group.py", line 431, in _record_changed
    self.signal('group-changed', record)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/signal_event.py", line 15, in signal
    fnct(self, signal_data, *data)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/field.py", line 551, in _group_changed
    parent.signal('record-changed')
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/signal_event.py", line 15, in signal
    fnct(self, signal_data, *data)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/group.py", line 431, in _record_changed
    self.signal('group-changed', record)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/signal_event.py", line 15, in signal
    fnct(self, signal_data, *data)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 446, in _group_changed
    self.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 937, in display
    view.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form.py", line 531, in display
    widget.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 527, in display
    self.screen.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/screen/screen.py", line 937, in display
    view.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form.py", line 531, in display
    widget.display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/float.py", line 28, in display
    super(Float, self).display()
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/view/form_gtk/integer.py", line 70, in display
    symbol, position = self.field.get_symbol(self.record, self.symbol)
  File "/home/mrichez/Workspace/tryton/issues/issue_currency_widget_new/tryton/tryton/gui/window/view_form/model/field.py", line 362, in get_symbol
    if value < 0:

TypeError: '<' not supported between instances of 'NoneType' and 'int'

Other remark, as the symbol field is readonly maybe it should be greyed like for amount (see picture 2020-10-07_09-25.png) ?
Author: [hidden] (mrichez)
Date: 2020-04-24.12:04:08
Added second issue to apply symbol widget in most of modules concerned
Author: [hidden] (mrichez)
Date: 2020-03-30.20:19:24
>* Why the untaxed_amount, taxes_amount and total amount of sale do not include >the currency symbol?
>I think we should also update the following modules to follow the same design: >account, account_asset, account_payment, account_invoice, stock, >sale_subscription, production, project_revenue, *_secondary_unit

Indeed, i add currency/unit symbol on some fields in purchase/sale module for testing purposes.But, before to go on with all modules, i would to know if what i've done in the backend is the correct way and don't imply a lot of changes.
Then, i don't know which fields i could remove from display (treeview/form) in existing models (maybe unit or currency fields should become invisible if all of the fields will have their symbol next their value and so those columns/field become useless for the user... 

>* Do we realy want to show the currency symbol on the unit price? As far as the >amount uses more digits than the currency, i'm not sure if it really makes >sense. Indeed on the report the currency is only shown for the line's amount.
  
Don't know, this enhancement is useful for the user when he is watching a form without the currency/unit field and then price or amount or quantity fields are "meaningless" without the symbol... but i'm hoping some help to tell me where it is useful to add the symbol. Thanks!
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-03-30.17:19:16
Thanks for sharing an screenshot. Just some comments about it: 

* Why the untaxed_amount, taxes_amount and total amount of sale do not include the currency symbol?
* Do we realy want to show the currency symbol on the unit price? As far as the amount uses more digits than the currency, i'm not sure if it really makes sense. Indeed on the report the currency is only shown for the line's amount.  

I think we should also update the following modules to follow the same design: account, account_asset, account_payment, account_invoice, stock, sale_subscription, production, project_revenue, *_secondary_unit
Author: [hidden] (mrichez)
Date: 2020-02-12.13:42:45
>I also think we should find a way to make unit looks more attached to the entry >as in sao we will use .input-group-addon
Which way? All content is in Gtk.HBox... Should i use a Gtk.Frame?
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-12.09:41:16
I also think we should find a way to make unit looks more attached to the entry as in sao we will use .input-group-addon
Author: [hidden] (mrichez)
Date: 2020-02-12.09:32:46
Need help with the Sao part... this is not working because of asynchronous call and don't know how to solve it. Thanks!
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-02-12.09:31:27
I think we need few space between the widget and the unit.
Author: [hidden] (mrichez)
Date: 2020-02-12.09:27:43
Following https://discuss.tryton.org/t/displaying-currency-on-line-form/2258/12
This is widget will display the symbol linked to the field in unit attribute of the displayed field.
Example:
<field name="amount" unit="currency"/>
"currency" is M2O field and his model inherit from the UnitMixin
History
Date User Action Args
2020-10-09 19:11:58roundup-botsetmessages: + msg60741
2020-10-09 19:11:48roundup-botsetmessages: + msg60740
2020-10-09 19:11:46roundup-botsetmessages: + msg60739
2020-10-09 19:11:45roundup-botsetmessages: + msg60738
2020-10-09 19:11:39roundup-botsetmessages: + msg60737
2020-10-09 19:11:35roundup-botsetmessages: + msg60736
2020-10-09 19:11:29roundup-botsetmessages: + msg60735
2020-10-09 19:11:26roundup-botsetmessages: + msg60734
2020-10-09 19:11:22roundup-botsetmessages: + msg60733
2020-10-09 19:11:20roundup-botsetmessages: + msg60732
2020-10-09 19:11:17roundup-botsetmessages: + msg60731
2020-10-09 19:11:14roundup-botsetmessages: + msg60730
2020-10-09 19:11:12roundup-botsetmessages: + msg60729
2020-10-09 19:11:09roundup-botsetmessages: + msg60728
2020-10-09 19:11:07roundup-botsetmessages: + msg60727
2020-10-09 19:11:05roundup-botsetmessages: + msg60726
2020-10-09 19:11:02roundup-botsetmessages: + msg60725
2020-10-09 19:10:59roundup-botsetmessages: + msg60724
2020-10-09 19:10:54roundup-botsetmessages: + msg60723
2020-10-09 19:10:45roundup-botsetmessages: + msg60722
2020-10-09 19:10:36roundup-botsetmessages: + msg60721
2020-10-09 19:10:28roundup-botsetmessages: + msg60720
2020-10-09 19:10:19roundup-botsetmessages: + msg60719
2020-10-09 19:10:16roundup-botsetmessages: + msg60718
2020-10-09 19:10:10roundup-botsetmessages: + msg60717
2020-10-09 19:10:03roundup-botsetmessages: + msg60716
2020-10-09 19:09:59roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg60715
2020-10-09 18:33:39reviewbotsetmessages: + msg60712
2020-10-09 17:51:45reviewbotsetmessages: + msg60708
2020-10-09 16:01:47reviewbotsetmessages: + msg60706
2020-10-07 16:03:21reviewbotsetmessages: + msg60631
2020-10-07 15:57:19reviewbotsetmessages: + msg60630
2020-10-07 14:28:28reviewbotsetmessages: + msg60627
2020-10-07 14:25:05cedsetmessages: + msg60626
2020-10-07 14:02:55reviewbotsetmessages: + msg60625
2020-10-07 13:52:26mrichezsetmessages: + msg60624
2020-10-07 13:51:18mrichezsetmessages: + msg60623
2020-10-07 13:46:07mrichezsetmessages: + msg60622
2020-10-07 10:59:19cedsetmessages: + msg60615
2020-10-07 10:08:00mrichezsetfiles: + 2020-10-07_10-04.png
2020-10-07 10:07:54mrichezsetfiles: + 2020-10-07_10-03.png
messages: + msg60613
2020-10-07 09:59:39reviewbotsetmessages: + msg60612
2020-10-07 09:32:38mrichezsetfiles: + 2020-10-07_09-25.png
messages: + msg60611
2020-10-07 00:55:22reviewbotsetmessages: + msg60610
2020-10-06 17:56:44reviewbotsetmessages: + msg60607
2020-10-06 16:57:42reviewbotsetmessages: + msg60606
2020-09-11 15:27:49reviewbotsetmessages: + msg60060
2020-09-04 13:44:15reviewbotsetmessages: + msg59955
2020-09-04 12:06:47reviewbotsetmessages: + msg59951
2020-07-17 15:04:15reviewbotsetmessages: + msg59360
2020-07-17 11:08:40reviewbotsetmessages: + msg59359
2020-06-26 16:18:09reviewbotsetmessages: + msg58889
2020-06-15 17:07:58reviewbotsetmessages: + msg58719
2020-06-12 11:35:43reviewbotsetmessages: + msg58657
2020-05-11 13:35:32reviewbotsetmessages: + msg57950
2020-05-11 13:31:38reviewbotsetmessages: + msg57949
2020-04-24 13:06:36mrichezsetreviews: 276871002 -> 276871002, 325141002
2020-04-24 12:04:09mrichezsetmessages: + msg57415
2020-04-22 10:09:12reviewbotsetmessages: + msg57364
2020-04-08 16:04:09reviewbotsetmessages: + msg56942
2020-04-07 15:30:15reviewbotsetmessages: + msg56940
2020-04-06 16:02:31reviewbotsetmessages: + msg56927
2020-03-30 20:19:25mrichezsetmessages: + msg56800
2020-03-30 17:19:17pokolisetmessages: + msg56797
type: feature request
nosy: + pokoli
2020-03-19 10:59:04reviewbotsetmessages: + msg56395
2020-03-19 10:50:12mrichezsetstatus: in-progress -> testing
2020-02-18 15:15:55reviewbotsetmessages: + msg55459
2020-02-14 14:49:02reviewbotsetmessages: + msg55367
2020-02-13 09:49:24reviewbotsetmessages: + msg55356
2020-02-12 13:42:46mrichezsetmessages: + msg55349
2020-02-12 09:58:25reviewbotsetnosy: + reviewbot
messages: + msg55348
2020-02-12 09:58:22reviewbotsetreviews: 276871002
keyword: + review
2020-02-12 09:41:16cedsetmessages: + msg55347
2020-02-12 09:32:47mrichezsetmessages: + msg55346
2020-02-12 09:31:28cedsetnosy: + ced
messages: + msg55345
2020-02-12 09:27:43mrichezcreate