Skip to Content
Menu
This question has been flagged
1 Reply
2990 Views

I can't run a sales report on Odoo 11. If I click the menu option, an error pops up saying Odoo Server Error. I only have 3 Sales Orders entered. Products, price lists and customers were imported from CSV files.

My environment is: 
Ubuntu 16.04
Odoo 11 installed via apt-get.
VM running on Mac host
Nothing else running on VM
Everything updated to latest
Only standard apps installed.

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 650, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 692, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 936, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 934, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 687, in call_kw
    return call_kw_model(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 672, in call_kw_model
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1908, in read_group
    result = self._read_group_raw(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1998, in _read_group_raw
    self._cr.execute(query, where_clause_params)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 232, in execute
    res = self._obj.execute(query, params)
psycopg2.DataError: division by zero
Avatar
Discard

How you resolved this issue? Can you please explain little bit?

Thank you.

Author Best Answer

Perhaps someone could help me in where to look. I have imported products, and not all fields are filled in all products. Could that cause the issue?

I have changed the log to Debug and found this;

odoo.api: call sale.report().read_group(domain=[['state', 'not in', ['draft', 'cancel', 'sent']]], fields=['date', 'price_subtotal'], groupby=['date'], lazy=False)
2018-10-24 13:31:20,387 7358 ERROR odoo-7p5 odoo.sql_db: bad query: b'\n            SELECT min("sale_report".id) AS id, count("sale_report".id) AS "__count" , sum("sale_report"."price_subtotal") AS "price_subtotal" ,date_trunc(\'month\', timezone(\'Africa/Johannesburg\', timezone(\'UTC\',"sale_report"."date"))) as "date" \n            FROM "sale_report"\n            WHERE (("sale_report"."state" not in (\'draft\',\'cancel\',\'sent\')) OR "sale_report"."state" IS NULL)\n            GROUP BY date_trunc(\'month\', timezone(\'Africa/Johannesburg\', timezone(\'UTC\',"sale_report"."date")))\n            ORDER BY "date"\n            \n            \n        '
ERROR: division by zero


Avatar
Discard
Author

I have solved it. If your currency has a rate of 0.000 then it will divide by zero. Only took me 4 weeks. Found the solution here: https://www.bountysource.com/issues/40740857-8-0-odoo-error-division-by-zero