Message 77856

Author
resteve
Date
2022-09-01.11:54:28
Message id
77856

Content

In case get_sale_price() return currency is None [1], not call compute_shipment_cost because require from_currency.

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 159, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/sale_rule/sale.py", line 71, in quote
    super(Sale, cls).quote(sales)
  File "/trytond/model/modelview.py", line 775, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/model/workflow.py", line 37, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/trytond/modules/sale_shipment_cost/sale.py", line 191, in quote
    removed.extend(sale.set_shipment_cost())
  File "/trytond/modules/sale_shipment_cost/sale.py", line 233, in set_shipment_cost
    cost = self.compute_shipment_cost()
  File "/trytond/modules/sale_shipment_cost/sale.py", line 227, in compute_shipment_cost
    return Currency.compute(
  File "/trytond/modules/currency/currency.py", line 185, in compute
    from_currency = cls(int(from_currency))
  File "/trytond/model/model.py", line 300, in __int__
    return int(self.id)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Debug:

> /home/raimon/projectes/nandev/xxxx/trytond/trytond/modules/sale_shipment_cost/sale.py(227)compute_shipment_cost()
-> with Transaction().set_context(date=date):
(Pdb) currency_id
(Pdb) self.carrier.get_sale_price()
(0, None)

[1] https://github.com/tryton/sale_shipment_cost/blob/29234bea560f3ee0bf62f3777b20f062e9eb4c74/sale.py#L232

History
Date User Action Args
2022-09-01 11:54:28restevesetmessageid: <1662026068.4279869.QJOGKSETQ6X3WYK5.issue11684@tryton.org>
2022-09-01 11:54:28restevelinkissue11684 messages
2022-09-01 11:54:28restevecreate

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