After 7.0 update prices are not fetched in sales

After my update to 7.0, when creating sales lines prices are no longer fetched; this happens on goods and services as well. Products are salable, do have uom etc, I can see no changes there, nor did I do such manually.

There is one exception:
I have a “drop shipment” product with attribute “purchase on sale” and a drop shipment supplier configured - this product works allright in sale.

2nd observation, may be connected or not:
When entering prices manually and trying to create a picklist, this error is thrown:

  File "/trytond/model/modelstorage.py", line 1620, in __getattr__
    field = self._fields[name]
KeyError: 'uom'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/genshi/template/eval.py", line 301, in lookup_attr
    val = getattr(obj, key)
  File "/trytond/model/modelstorage.py", line 1622, in __getattr__
    raise AttributeError('"%s" has no attribute "%s"' % (self, name))
AttributeError: "stock.move,2164" has no attribute "uom"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/genshi/template/eval.py", line 307, in lookup_attr
    val = obj[key]
TypeError: 'stock.move' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 109, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 43, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 75, in wrapper
    return func(request, *args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 197, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 196, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/stock/shipment.py", line 3043, in execute
    return super(ShipmentReport, cls).execute(ids, data)
  File "/trytond/report/report.py", line 244, in execute
    oext, content = cls._execute(
  File "/trytond/report/report.py", line 265, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 367, in render
    data = template.generate(**report_context).render()
  File "/relatorio/templates/base.py", line 16, in render
    return self.serializer(
  File "/relatorio/templates/opendocument.py", line 1157, in __call__
    output_encode(
  File "/genshi/output.py", line 60, in encode
    for chunk in iterator:
  File "/genshi/output.py", line 243, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 674, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 779, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/genshi/output.py", line 598, in __call__
    for ev in stream:
  File "/relatorio/templates/opendocument.py", line 1053, in __call__
    for kind, data, pos in stream:
  File "/genshi/filters/i18n.py", line 789, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/base.py", line 641, in _include
    for event in stream:
  File "/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "/genshi/template/base.py", line 601, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/base.py", line 290, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/genshi/template/eval.py", line 160, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 381, in <Expression '__relatorio_escape_invalid_chars(format_number_symbol(move.quantity, user.language, move.uom, digits=move.uom.digits))'>
  File "/genshi/template/eval.py", line 309, in lookup_attr
    val = cls.undefined(key, owner=obj)
  File "/genshi/template/eval.py", line 397, in undefined
    raise UndefinedError(key, owner=owner)
genshi.template.eval.UndefinedError: Pool().get('stock.move')(2164) has no member named "uom"

Fault: Pool().get('stock.move')(2164) has no member named "uom"

3rd observation (may be connected or not):
When trying to create a price list, this error is thrown:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 109, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 43, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 75, in wrapper
    return func(request, *args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 197, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 196, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/report/report.py", line 244, in execute
    oext, content = cls._execute(
  File "/trytond/report/report.py", line 265, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 367, in render
    data = template.generate(**report_context).render()
  File "/relatorio/templates/base.py", line 16, in render
    return self.serializer(
  File "/relatorio/templates/opendocument.py", line 1157, in __call__
    output_encode(
  File "/genshi/output.py", line 60, in encode
    for chunk in iterator:
  File "/genshi/output.py", line 243, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 674, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 779, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/genshi/output.py", line 598, in __call__
    for ev in stream:
  File "/relatorio/templates/opendocument.py", line 1053, in __call__
    for kind, data, pos in stream:
  File "/genshi/filters/i18n.py", line 789, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/base.py", line 641, in _include
    for event in stream:
  File "/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "/genshi/template/base.py", line 581, in _flatten
    for kind, data, pos in stream:
  File "/genshi/template/directives.py", line 369, in __call__
    iterable = _eval_expr(self.expr, ctxt, vars)
  File "/genshi/template/base.py", line 290, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/genshi/template/eval.py", line 160, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 332, in <Expression 'iter(itertools.groupby(sorted(price_list.lines, key=lambda x:x.sequence or 0), lambda x: x.product.account_category.rec_name if x.product else x.category.rec_name))'>
  File "/genshi/template/eval.py", line 294, in lookup_name
    val = cls.undefined(name)
  File "/genshi/template/eval.py", line 397, in undefined
    raise UndefinedError(key, owner=owner)
genshi.template.eval.UndefinedError: "itertools" not defined

Fault: "itertools" not defined

What can I do?

Cheers,
Wolf

Do you use price lists? Then, list_price have been introduced in the formula. I still need to make my research about the new usage, but change unit_price in the formula to list_price work for me. There was a note on this on the migration.

AttributeError: “stock.move,2164” has no attribute “uom”

uom field from stock move have been renamed to unit. So you need to change the reports that use uom and use unit instead.
For example you have this line in the report:

format_number_symbol(move.quantity, user.language, move.uom, digits=move.uom.digits))

Which should be:

format_number_symbol(move.quantity, user.language, move.unit, digits=move.unit.digits))

The last traceback does not seam to appear on creating a new price list. It seems it’s on rendering some custom report. If you need itertools for you report you will need to include it with the context of the report.

Thank you! - This actually helps for goods, but it does not for services.

Well, valued Master @pokoli, from your writing I could not come to the step Adrià explained. Update instructions are one of the most nerdish bits in Tryton, it’s close ti impossible to make use of them.

My admiration, again. Works perfectly.
But again: Why is such info not contained in upgrade info? -
(Just a dream - a little script which walks through all the report templates and checks for all these changes… ?? - Yes, a dream only…)

Blush… I don’t actually remember where the price list report came from. You’re right, these is a “itertools” statement in it (fods file here). What should I do with it?

Thank you so much - you made my day. It’s always a little shocking if you want to do some work and see your main tool is not working.

Cheers,
Wolf

I don’t know any relevant change that can affect services and not goods. Good luck debugging.

I do not know, we all can make mistakes or miss some information. Feel free to add this uom->unit change on the release or migration topic.
What I normally do on migrations, if it helps you as advice, apart from the migration steps I check the version release, because there are the sections for “Changes for impl. and developers” and “Changes for SysAdmin”.

Sorry, I will make you wake up from that dream. It’s not easy to detect those uom. Why? So many cases:

  • product.default_uom, product.purchase_uom and other still exist and other fields using uom. So the parser/replacer should
  • you can have uom fields on some customization, which did not change and can still be used in reports.
  • you should handle other types of reports apart from odt (html…), each with it’s own peculiarities, and also you have not supported types on core, like jasper reports.

I’m sure I’m still missing some other cases. So do you still think that such script it’s worth the cost?

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.