Improve performance generating a tree view from a wizard
I realized that the performance when generating a tree (parent, child) view from a wizard like the one generated in the OpenBOMTree become slowly. It was working fine in the 5.2 version but I tested it in the 6.0 and 6.4 and it takes more time to get the tree build.
As far as I can see, the problem is that currently a read request is made for every many2one in each row in order to get the rec_name. It shouldn't be necessary because the rec_name values are already in the tree dictionary https://github.com/tryton/production/blob/develop/bom.py#L175.
This issue does not have any impact on small bills of materials, but in the big ones it really slows down a lot the process. traceback:
8258 139693818382144 [2022-06-20 09:33:08,593] INFO werkzeug * Running on http://localhost:8000 (Press CTRL+C to quit)
8258 139693584963328 [2022-06-20 09:33:14,602] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] wizard.production.bom.tree.open.create>
8258 139693584963328 [2022-06-20 09:33:14,677] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:14,679] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] wizard.production.bom.tree.open.execute>
8258 139693584963328 [2022-06-20 09:33:14,751] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:14,774] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.category.read>
8258 139693584963328 [2022-06-20 09:33:14,797] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:14,798] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:14,823] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:14,826] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:14,855] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:14,857] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product-production.bom.read>
8258 139693584963328 [2022-06-20 09:33:14,888] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:14] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,475] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] wizard.production.bom.tree.open.execute>
8258 139693584963328 [2022-06-20 09:33:20,763] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,795] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:20,815] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,816] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:20,836] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,839] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:20,866] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,867] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:20,885] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,887] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:20,906] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,907] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:20,925] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,926] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:20,945] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,946] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:20,964] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,965] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.product.read>
8258 139693584963328 [2022-06-20 09:33:20,985] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:20] "POST /demo64/ HTTP/1.1" 200 -
8258 139693584963328 [2022-06-20 09:33:20,986] INFO trytond.wsgi <JSONRequest 1@127.0.0.1 'http://localhost:8000/demo64/' [POST] model.product.uom.read>
8258 139693584963328 [2022-06-20 09:33:21,005] INFO werkzeug 127.0.0.1 - - [20/Jun/2022 09:33:21] "POST /demo64/ HTTP/1.1" 200 -