← Back to team overview

openerp-india team mailing list archive

[Bug 1235140] Re: [V7] : Product margins have an issue

 

*** This bug is a duplicate of bug 1146866 ***
    https://bugs.launchpad.net/bugs/1146866

** This bug has been marked a duplicate of bug 1146866
   [Trunk/7.0/6.1]product_margin division by zero exception

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1235140

Title:
  [V7] : Product margins have an issue

Status in OpenERP Addons (modules):
  New

Bug description:
  Hello,

  Tested with latest V7 on rnbt.
  Create one or two invoice of xyz products with 0 qty.
  validate those invoices.
  Go to xyz product form view and with help of more button open product margin wizard
  set period and open & Paid  invoice state click on 'Open Margins'.

  Output:

  Client Traceback (most recent call last):
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/http.py", line 204, in dispatch
      response["result"] = method(self, **self.params)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/controllers/main.py", line 1054, in search_read
      return self.do_search_read(req, model, fields, offset, limit, domain, sort)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/controllers/main.py", line 1089, in do_search_read
      records = Model.read(ids, fields or False, req.context)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/session.py", line 42, in proxy
      result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/session.py", line 30, in proxy_method
      result = self.session.send(self.service_name, method, *args)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/session.py", line 103, in send
      raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

  Server Traceback (most recent call last):
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/web/session.py", line 89, in send
      return openerp.netsvc.dispatch_rpc(service_name, method, args)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/netsvc.py", line 292, in dispatch_rpc
      result = ExportService.getService(service_name).dispatch(method, params)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/service/web_services.py", line 626, in dispatch
      res = fn(db, uid, *params)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/osv.py", line 188, in execute_kw
      return self.execute(db, uid, obj, method, *args, **kw or {})
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/osv.py", line 131, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/osv.py", line 197, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/audittrail/audittrail.py", line 514, in execute_cr
      return fct_src(cr, uid, model, method, *args, **kw)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/osv.py", line 185, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/orm.py", line 3608, in read
      result = self._read_flat(cr, user, select, fields, context, load)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/orm.py", line 3716, in _read_flat
      res2 = self._columns[val[0]].get(cr, self, ids, val, user, context=context, values=res)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/osv/fields.py", line 1133, in get
      result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/addons/product_margin/product_margin.py", line 68, in _product_margin
      cr.execute(sqlstr, (val.id, states, invoice_types, date_from, date_to))
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/sql_db.py", line 161, in wrapper
      return f(self, *args, **kwargs)
    File "/home/odoo/runbot/static/openerp-dev-7-0-21760/server/openerp/sql_db.py", line 226, in execute
      res = self._obj.execute(query, params)
  DataError: division by zero

  This error will raised because of wrong query. we can not assume that
  all time we get qty will be one or more then one. we can set null if
  when we apply a division in query.

  Thanks & regards,
  Devishree(DBR)

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1235140/+subscriptions


References