Issue 11684

Title
compute_shipment_cost when from_currency is not null
Priority
bug
Status
resolved
Nosy list
ced, resteve, reviewbot, roundup-bot, yangoon
Assigned to
ced
Keywords
review

Created on 2022-09-01.11:54:28 by resteve, last changed 5 days ago by roundup-bot.

Messages

New changeset 052735012a26 by Cédric Krier in branch '6.4':
Do not compute price if no currency is set
https://hg.tryton.org/modules/carrier_percentage/rev/052735012a26

New changeset 20bdecddb038 by Cédric Krier in branch '6.2':
Do not compute price if no currency is set
https://hg.tryton.org/modules/carrier_percentage/rev/20bdecddb038

New changeset 85cc25cab7fb by Cédric Krier in branch '6.0':
Do not compute price if no currency is set
https://hg.tryton.org/modules/carrier_percentage/rev/85cc25cab7fb

New changeset dc6d71a65a74 by Cédric Krier in branch '5.0':
Do not compute price if no currency is set
https://hg.tryton.org/modules/carrier_percentage/rev/dc6d71a65a74
New changeset 33cb0aeccd0a by Cédric Krier in branch 'default':
Do not compute price if no currency is set
https://hg.tryton.org/tryton-env/rev/33cb0aeccd0a
New changeset 04a83e8ba9b4 by Cédric Krier in branch 'default':
Do not compute price if no currency is set
https://hg.tryton.org/modules/carrier_percentage/rev/04a83e8ba9b4
Author: [hidden] (resteve)
Date: 2022-09-01.11:54:28

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-29 16:56:21roundup-botsetkeyword: - backport
messages: + msg78405
2022-09-25 20:22:09roundup-botsetmessages: + msg78298
2022-09-25 20:22:04roundup-botsetmessages: + msg78297
nosy: + roundup-bot
status: testing -> resolved
2022-09-25 20:20:53cedsetkeyword: + backport
2022-09-16 00:47:17reviewbotsetmessages: + msg78176
nosy: + reviewbot
2022-09-16 00:45:59cedsetassignedto: ced
component: + carrier_percentage, - sale_shipment_cost
keyword: + review
nosy: + ced
reviews: 435831003
status: chatting -> testing
2022-09-01 15:03:32yangoonsetnosy: + yangoon
2022-09-01 11:54:28restevecreate