Skip to Content
Menu
This question has been flagged
3 Replies
3089 Views

I have configured a simple shipping method, which has a single price and applies to any sale order. I can select the shipping method from the dropdown menu but when I hit "Check Price" I always receive the following error message.

What's the problem? Thanks!

Error:
​Odoo Server Error

Traceback (most recent call last):
File "/opt/odoo/odoo11/odoo/http.py", line 647, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo11/odoo/http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo11/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo11/odoo/http.py", line 689, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo11/odoo/http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo11/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo11/odoo/http.py", line 332, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo11/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo11/odoo/http.py", line 512, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 934, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/odoo11/addons/web/controllers/main.py", line 922, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo11/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo11/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo11/addons/delivery/models/sale_order.py", line 28, in get_delivery_price
res = order.carrier_id.rate_shipment(order)
File "/opt/odoo/odoo11/addons/delivery/models/delivery_carrier.py", line 120, in rate_shipment
res = getattr(self, '%s_rate_shipment' % self.delivery_type)(order)
File "/opt/odoo/odoo11/addons/delivery/models/delivery_carrier.py", line 204, in fixed_rate_shipment
price = self.env['res.currency']._compute(self.company_id.currency_id, order.currency_id, price)
File "/opt/odoo/odoo11/odoo/addons/base/res/res_currency.py", line 182, in _compute
rate = self._get_conversion_rate(from_currency, to_currency)
File "/opt/odoo/odoo11/odoo/addons/base/res/res_currency.py", line 175, in _get_conversion_rate
return to_currency.rate / from_currency.rate
ZeroDivisionError: float division by zero

Avatar
Discard
Best Answer

The currency defined for your company and the sale order currency are different.
Therefore the system check and converts currency rates. If in expresion
to_currency.rate / from_currency.rate system report ZeroDivisionError: float division by zero
than value from_currency.rate must be zero.
Value from_currency is a rate of company currency.

Conlusion:
1. You verify settings of company currency (menu Settings/Comapnies/, field Currency).
2. Click on currency name and in next on button "View Rates".
3. See Rate value. Should be 1.000000.
4. Also check the exchange rate currency from the sales order.

Avatar
Discard
Best Answer

HI,

Seems to be issue of division by Zero. Make sure that you have set shipment charge as non zero number. 

You can try to reproduce this issue in odoo runbot, if you are able to reproduce, it has to be fixed by adding a validation error if the cost is not set. You can report it in odoo github:  https://github.com/odoo/odoo/issues

Thanks

Avatar
Discard
Author

well division by zero - i read this of course . And yes I have set the costs to non zero - it is obvious!

What is been calculated with the currency rate? Maybe someone can point me to the location where the calculation happens and where I can look to learn more about the error!