Tryton - Issues

 

Issue8586

Title Price list formula fails with None values
Priority bug Status resolved
Superseder Do not allow to assign unknonw field on model
View: 8567
Nosy List ced, pokoli, reviewbot, roundup-bot
Type crash Components sale_price_list, trytond
Assigned To ced Keywords backport, review
Reviews 282041002
View: 282041002

Created on 2019-08-19.19:19:23 by pokoli, last changed by roundup-bot.

Messages
New changeset a7b999158c0e by Cédric Krier in branch 'default':
Ensure context is correctly set when initializing Model
https://hg.tryton.org/tryton-env/rev/a7b999158c0e
New changeset 42f9ed36b8e9 by Cédric Krier in branch 'default':
Ensure context is correctly set when initializing Model
https://hg.tryton.org/trytond/rev/42f9ed36b8e9
review282041002 updated at https://codereview.tryton.org/282041002/#ps252071002
review282041002 updated at https://codereview.tryton.org/282041002/#ps270181002
msg51541 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-28.17:48:05
Here is review282041002 which goes with the double loop because ordering will be much more complicated and will not really remove the double assignation if fields are mutually dependent.
It fixes the issue on sale_price_list. To be back-ported, we need to apply first the fixes of issue8567. Because the change enforce that values are existing fields.
msg51370 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-20.10:39:22
This is because you added 'company' in the context of the product field on the sale line.
When the product attribute is set by the on_change call, the record in instantiate_context does not have yet the parent sale company. So the product is instantiated with a None company.
I think the iteration over kwargs in Model.__init__ should be sorted using the depends and probably setting the _parent first (but using the same sorting for the parent fields).

And I think, for the product field on sale line, I think the parent used in context should be added as depends.

Another option may be to set the kwargs values twice.
msg51365 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-08-20.09:30:54
After some debugging I just noticed that I'm not able to reproduce the issue on every run of the test suite and the issue is related to product.list_price returning None when the value is required. 

This is solved by adding a browse in product.get_sale_price in sale module, but I'm this seems like a work arround and not the proper solution. 

Any idea why the product.list_price will return None when the value? If can confirm that the company is properly set on the context.
msg51361 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-08-19.20:38:19
I just need some more time to investigate in order to provide a fix.

Please be patient!
msg51360 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-19.20:10:31
So rev 98034d452d8e5a67daf9494ab052abb278f357fb must be fixed or reverted.
msg51358 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2019-08-19.19:19:22
See https://drone.tryton.org/tryton/modules.sale_price_list/73/21
History
Date User Action Args
2019-09-09 22:42:19roundup-botsetmessages: + msg51766
2019-09-09 22:42:13roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg51765
2019-08-29 18:59:30reviewbotsetmessages: + msg51567
2019-08-28 18:01:58reviewbotsetnosy: + reviewbot
messages: + msg51542
2019-08-28 17:48:11cedsetkeyword: + backport
2019-08-28 17:48:05cedsetstatus: chatting -> testing
keyword: + review
messages: + msg51541
reviews: 282041002
assignedto: pokoli -> ced
superseder: + Do not allow to assign unknonw field on model
2019-08-20 10:51:58cedsetcomponent: + trytond
2019-08-20 10:39:22cedsetmessages: + msg51370
2019-08-20 09:30:54pokolisettype: crash
messages: + msg51365
2019-08-19 20:38:20pokolisetassignedto: pokoli
messages: + msg51361

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