Hi guys!..
I’m experiencing a weird behavior in the sale_price_list module after migrating to version 6.0.
I’m getting the following AssertionError:
75286 123145509908480 [2021-06-28 23:38:22,432] ERROR trytond.protocols.dispatcher <class 'trytond.pool.product.product'>.read(*([6, 7, 8, 10, 12, 14, 16, 17, 19], ['active', 'code', 'cost_price_uom', 'default_uom', 'default_uom_digits', 'forecast_quantity', 'list_price_uom', 'name', 'quantity', 'sale_price_uom', 'template', 'default_uom.rec_name', 'template.rec_name', 'rec_name', '_timestamp', '_write', '_delete'], {'client': 'cb554993-dc45-4806-9232-008280d15465', 'shops': [2], 'shop': 2, 'shop.rec_name': 'Tienda Principal', 'company_filter': 'one', 'company': None, 'company.rec_name': 'Distribuciones Siglo 21', 'language': 'es_419', 'language_direction': 'ltr', 'groups': [1, 19, 14, 5, 8, 2, 20, 16, 6, 21, 3, 12, 28, 22, 15, 4, 29, 31, 25, 10, 26, 9, 13, 27, 23, 24, 17, 18, 30, 11], 'locale': {'date': '%d/%m/%Y', 'grouping': [3, 3, 0], 'decimal_point': '.', 'thousands_sep': ','}, 'company_work_time': {'h': 3600, 'm': 60, 's': 1, 'Y': 6912000, 'M': 576000, 'w': 144000, 'd': 28800}, 'price_list': 1, 'locations': [4], 'stock_date_end': None, 'stock_skip_warehouse': True, 'currency': 143, 'customer': 23, 'sale_date': None, 'uom': 1, 'taxes': [], 'quantity': None}), **{}) from testuser3@127.0.0.1/hworks_testacc/
Traceback (most recent call last):
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/model/modelsql.py", line 868, in read
sub_ids, cls, field_list, values=sub_results)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/model/fields/function.py", line 105, in get
return dict((name, call(name)) for name in names)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/model/fields/function.py", line 105, in <genexpr>
return dict((name, call(name)) for name in names)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/model/fields/function.py", line 98, in call
return method(records, name)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/modules/sale/product.py", line 111, in get_sale_price_uom
return cls.get_sale_price(products, quantity=quantity)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/modules/sale/product.py", line 147, in get_sale_price
quantity=quantity)
File "/Users/fflores/PycharmProjects/tryton-env/trytond/trytond/modules/sale_price_list/product.py", line 24, in _get_sale_unit_price
assert price_list.company == User(Transaction().user).company
AssertionError
I did a basic debugging with a breakpoint in the assert sentence finding that the company of the user is evaluated to None (I’ve verified that the user has indeed that company as main company)… even more strange is the fact that some times after the program stops in the breakpoint, it starts workin properly (as if the object is updating it’s property after the evaluation of the assert)… I’ve checked the response time of the database and is in the order of a few milliseconds (to make sure that it’s not due to some kind of timeout from the db or something similar)…
Have you seen something similar?.. any clues to find a solution?
Thanks in advance,