Tryton - Issues



Title Can't read product in Product by Location and those products was created after forecast date
Priority bug Status resolved
Superseder Nosy List ced, resteve, reviewbot, roundup-bot
Type crash Components product_cost_history
Assigned To ced Keywords review
Reviews 49281002
View: 49281002

Created on 2018-04-09.15:13:48 by resteve, last changed by roundup-bot.

New changeset 1775711cdf84 by C├ędric Krier in branch 'default':
Do not browse records at a datetime before they were created
review49281002 updated at
msg40240 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-04-18.23:58:14
Indeed issue2613 fixed this case on old version. But I guess the internal of the ORM makes it raise the error earlier instead of returning None.
msg39933 (view) Author: [hidden] (resteve) Date: 2018-04-10.15:34:06
I found in case the effective date in stock move is before a create date product 

Read ModelSQL in product_product__history, product_template__history and ir_property__history, search create date == effective date and don't found some rows
msg39921 (view) Author: [hidden] (resteve) Date: 2018-04-09.15:13:47
Install stock and product_cost_history modules:


1- Create some products
2- Create some shipments. Date 2018-01-01
3- Create new products
4- Create some new shipments. Date 2018-03-31
5- Go to Locations. Product by Locations. Select forecast date: 2018-01-01

Get error: "You try to read records that don't exist anymore.\n(Document type: product.product)" because read() in modelsql, some products do not have cost price before 2018-03-31 (history rows are not equal sub_ids [1]).

The query is [2]

('SELECT "a"."id" FROM "product_product__history" AS "a" WHERE ((("a"."id" IN (%s))) AND (COALESCE("a"."write_date", "a"."create_date") <= %s)) 
ORDER BY COALESCE("a"."write_date", "a"."create_date") DESC, "a"."__id" DESC LIMIT 1', (142495, datetime.datetime(2018, 3, 31, 23, 59, 59, 999999)))

In this case, product ID 142495 was created 2018-03-31 and when get products by location there are not cost price in 2018-01-01

Date User Action Args
2018-04-20 18:36:29roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg40292
2018-04-19 00:01:39reviewbotsetnosy: + reviewbot
messages: + msg40241
2018-04-18 23:58:14cedsetstatus: chatting -> testing
keyword: + review
nosy: + ced
messages: + msg40240
reviews: 49281002
assignedto: ced
2018-04-10 15:34:06restevesetmessages: + msg39933
2018-04-09 15:13:48restevecreate

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