← Back to team overview

openerp-india team mailing list archive

[Bug 1018516] Re: [6.1][sale_margin] TypeError: obj must be an instance or subtype of type

 

Hello Mariano Ruiz ,

I have checked this issue with trunk as well as 6.1. 
But I did not get any traceback like yours.So would you please 
elaborate more regarding this issue.

Thanks and waiting for reply!


** Changed in: openobject-addons
       Status: New => Incomplete

-- 
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/1018516

Title:
  [6.1][sale_margin] TypeError: obj must be an instance or subtype of
  type

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  When the sale_margin is installed, and after a sale order is created,
  if you try to add a sale order line, the next error is raised:

      2012-06-27 17:28:53,038 7463 ERROR ? openerp.osv.osv: Uncaught exception
      Traceback (most recent call last):
        File "/python/openerp61/server/openerp/osv/osv.py", line 121, in wrapper
          return f(self, dbname, *args, **kwargs)
        File "/python/openerp61/server/openerp/osv/osv.py", line 176, in execute
          res = self.execute_cr(cr, uid, obj, method, *args, **kw)
        File "/python/openerp61/server/openerp/osv/osv.py", line 164, in execute_cr
          return getattr(object, method)(cr, uid, *args, **kw)
        File "/python/openerp61/server/openerp/addons/sale_layout/sale_layout.py", line 93, in create
          return super(sale_order_line, self).create(cr, user, vals, context)
        File "/python/openerp61/server/openerp/osv/orm.py", line 4194, in create
          result += self._store_get_values(cr, user, [id_new], vals.keys(), context)
        File "/python/openerp61/server/openerp/osv/orm.py", line 4255, in _store_get_values
          target_ids = [id for id in function[id_mapping_fnct_](self, cr, SUPERUSER_ID, ids, context) if id]
        File "/python/openerp61/server/openerp/addons/sale_margin/sale_margin.py", line 73, in _get_order
          return super(sale_order,self)._get_order(cr, uid, ids, context=context)
      TypeError: super(type, obj): obj must be an instance or subtype of type
      2012-06-27 17:28:53,073 7463 ERROR ? openerp.netsvc: super(type, obj): obj must be an instance or subtype of type

  If you remove the line 77 from the sale_margin.py sources, the error
  is not launched, but maybe is not the best solution:

      75    _columns = {
      76        'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and Cost Price.", store={
      77                'sale.order.line': (_get_order, ['margin'], 20),
      78                'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 20),
      79                }),
      80    }

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


References