Issue 10244

Title
Crash if list_price is None
Priority
bug
Status
chatting
Nosy list
albertca, ced, pokoli
Assigned to
Keywords

Created on 2021-04-01.17:13:58 by albertca, last changed 1 month ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-05-21.22:47:16

Idem for cost_price.
I think the proper solution is to reuse the same design as account_used because for me it must raise an error if there is no price defined instead of using a default value (which will probably be zero).

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-04-04.08:05:07

To properly solve the issue all modules should be reviewed to ensure that they do not crash when the list price is not set. Then we can make the list price not required.

Author: [hidden] (albertca)
Date: 2021-04-01.17:13:57

Although list_price field is defined as required in product.template:

https://hg.tryton.org/modules/product/file/tip/product.py#l74

This cannot really be enforced because it is MultiValue. So a product created from company A will have list_price set to NULL on company B.

This will cause crash on get_sale_price() if there needs to be a currency conversion:

https://hg.tryton.org/modules/sale/file/tip/product.py#l158

I think we should:

  • Make list_price not required (we already removed the required attribute from cost_price)
  • Either do not supply None to currency's compute() or make compute() return None if the value to convert is None
History
Date User Action Args
2021-05-21 22:47:16cedsetcomponent: - sale
messages: + msg67775
nosy: + ced
2021-04-04 08:05:07pokolisetmessages: + msg66061
nosy: + pokoli
status: unread -> chatting
2021-04-01 17:13:58albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)