← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 731035] Re: Reference UoM for category should be checked for uniqueness

 

I disagree with your agreement to the first part :) that it isn't necessary,
for multiple reference UOM especially in the unit case.

Roll, PCE, EA, Unit all mean the same mathematically, but some make no sense
when applied to other products.  And in length,  metre and lineal metre
while they mean the same, convention dictates some products sold by the
metre, others by the lineal.

e.g a roll of building paper vs a piece of building paper.  just as a piece
of furniture vs a roll of furniture. makes no sense to be restricted to one
choice.

Would a better answer be to change the wording to "Equal to Reference Unit"
and then raise the bug on the one report expecting a single result.

On Tue, Mar 8, 2011 at 10:54 PM, Olivier Dony (OpenERP) <
731035@xxxxxxxxxxxxxxxxxx> wrote:

> Indeed, the crash of reports due to multiple reference UoM for a
> category needs to be prevented or fixed.
>
> I guess it is never really necessary to have multiple units in the same
> UoM category that have the same conversion rate, as that makes them
> equal to each other. We could add a unique constraint on (category_id,
> factor) so that only one UoM in each category is allowed to have the
> same conversion rate. This will also prevent having 2 reference UoMs
> with factor = 1.0.
>
> I don't agree about the second part where you say that it should be
> forbidden to delete a reference UoM if there are other UoM. The reference
> UoM does not need to be explicitly defined, as per definition its factor is
> 1.0. If you have 2 UoM in the same category, let's say A (factor=0.5) and B
> (factor=0.1) you can easily convert from one to the other because you know
> their factor (against the implicit reference 1.0), without needing an
> explicit reference UoM. For example:  5.0 A = ((5.0/0.5)*0.1) B = 1.0 B
> This is more convenient if the reference UoM should never be used directly.
>
> ** Changed in: openobject-addons
>   Importance: Undecided => Low
>
> ** Changed in: openobject-addons
>       Status: New => Confirmed
>
> ** Changed in: openobject-addons
>     Assignee: (unassigned) => OpenERP R&D Addons Team 2
> (openerp-dev-addons2)
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Addons.
> https://bugs.launchpad.net/bugs/731035
>
> Title:
>  Reference UoM for category should be checked for uniqueness
>
> Status in OpenERP Modules (addons):
>  Confirmed
>
> Bug description:
>  Currently any UoM can be set as a reference for a given category which
>  seems to be wrong (meaning one category can have several UoM
>  references). By conception it is dubious and actually it makes some
>  reports crashes like account_invoice_report with the following error
>  message:
>
>  Traceback (most recent call last):
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/netsvc.py", line
> 489, in dispatch
>      result = ExportService.getService(service_name).dispatch(method, auth,
> params)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/service/web_services.py",
> line 599, in dispatch
>      res = fn(db, uid, *params)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 122, in wrapper
>      return f(self, dbname, *args, **kwargs)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 176, in execute
>      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 167, in execute_cr
>      return getattr(object, method)(cr, uid, *args, **kw)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py",
> line 1735, in search
>      return self._search(cr, user, args, offset=offset, limit=limit,
> order=order, context=context, count=count)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py",
> line 3981, in _search
>      cr.execute('SELECT "%s".id FROM ' % self._table + from_clause +
> where_str + order_by + limit_str + offset_str, where_clause_params)Traceback
> (most recent call last):
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/netsvc.py", line
> 489, in dispatch
>      result = ExportService.getService(service_name).dispatch(method, auth,
> params)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/service/web_services.py",
> line 599, in dispatch
>      res = fn(db, uid, *params)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 122, in wrapper
>      return f(self, dbname, *args, **kwargs)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 176, in execute
>      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py",
> line 167, in execute_cr
>      return getattr(object, method)(cr, uid, *args, **kw)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py",
> line 1735, in search
>      return self._search(cr, user, args, offset=offset, limit=limit,
> order=order, context=context, count=count)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py",
> line 3981, in _search
>      cr.execute('SELECT "%s".id FROM ' % self._table + from_clause +
> where_str + order_by + limit_str + offset_str, where_clause_params)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line
> 78, in wrapper
>      return f(self, *args, **kwargs)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line
> 131, in execute
>      res = self._obj.execute(query, params)
>  ProgrammingError: more than one row returned by a subquery used as an
> expression
>
>
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line
> 78, in wrapper
>      return f(self, *args, **kwargs)
>    File
> "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line
> 131, in execute
>      res = self._obj.execute(query, params)
>  ProgrammingError: more than one row returned by a subquery used as an
> expression
>
>
>  Uniqueness should be checked when the UoM is created/modified. Even more,
> you should not be able to delete the reference of a category if other UoM
> depend on it.
>

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/731035

Title:
  Reference UoM for category should be checked for uniqueness

Status in OpenERP Modules (addons):
  Confirmed

Bug description:
  Currently any UoM can be set as a reference for a given category which
  seems to be wrong (meaning one category can have several UoM
  references). By conception it is dubious and actually it makes some
  reports crashes like account_invoice_report with the following error
  message:

  Traceback (most recent call last):
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/netsvc.py", line 489, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/service/web_services.py", line 599, in dispatch
      res = fn(db, uid, *params)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py", line 1735, in search
      return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py", line 3981, in _search
      cr.execute('SELECT "%s".id FROM ' % self._table + from_clause + where_str + order_by + limit_str + offset_str, where_clause_params)Traceback (most recent call last):
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/netsvc.py", line 489, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/service/web_services.py", line 599, in dispatch
      res = fn(db, uid, *params)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py", line 1735, in search
      return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/osv/orm.py", line 3981, in _search
      cr.execute('SELECT "%s".id FROM ' % self._table + from_clause + where_str + order_by + limit_str + offset_str, where_clause_params)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  ProgrammingError: more than one row returned by a subquery used as an expression

  
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line 78, in wrapper
      return f(self, *args, **kwargs)
    File "/usr/local/lib/python2.6/dist-packages/openerp-server_9000/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  ProgrammingError: more than one row returned by a subquery used as an expression

  
  Uniqueness should be checked when the UoM is created/modified. Even more, you should not be able to delete the reference of a category if other UoM depend on it.



Follow ups

References