Issue 10244

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

Created on 2021-04-01.17:13:58 by albertca, last changed 2 weeks ago by pokoli.

Messages

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) Tryton committer
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-04-04 08:05:07pokolisetmessages: + msg66061
nosy: + pokoli
status: unread -> chatting
2021-04-01 17:13:58albertcacreate