Revert to OLD api to avoid bug fat bug found by Brother Jean-de-Dieu
This commit is contained in:
@@ -20,22 +20,28 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp import models, api
|
from openerp.osv import orm
|
||||||
|
|
||||||
|
# KEEP THIS IN OLD API for the moment
|
||||||
|
# Otherwise, you will have trouble in the pagination of kanban view and
|
||||||
|
# the counter for number of records in list view
|
||||||
|
# Bug found at the Barroux Abbey on 29/5/2015
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(orm.Model):
|
||||||
_inherit = 'product.template'
|
_inherit = 'product.template'
|
||||||
|
|
||||||
@api.model
|
|
||||||
def search(
|
def search(
|
||||||
self, args, offset=0, limit=None, order=None, count=False):
|
self, cr, uid, args, offset=0, limit=None, order=None,
|
||||||
seller_id = self.env.context.get('search_default_seller_id')
|
context=None, count=False):
|
||||||
|
seller_id = context.get('search_default_seller_id')
|
||||||
if seller_id:
|
if seller_id:
|
||||||
sellers = self.env['product.supplierinfo'].search(
|
seller_ids = self.pool['product.supplierinfo'].search(
|
||||||
[('name', '=', seller_id)])
|
cr, uid, [('name', '=', seller_id)], context=context)
|
||||||
for argument in args:
|
for argument in args:
|
||||||
if isinstance(argument, list) and argument[0] == 'seller_ids':
|
if isinstance(argument, list) and argument[0] == 'seller_ids':
|
||||||
args.remove(argument)
|
args.remove(argument)
|
||||||
args.append((('seller_ids', 'in', sellers.ids)))
|
args.append((('seller_ids', 'in', seller_ids)))
|
||||||
return super(ProductTemplate, self).search(
|
res = super(ProductTemplate, self).search(
|
||||||
args, offset=offset, limit=limit, order=order, count=count)
|
cr, uid, args, offset=offset, limit=limit, order=order, count=count,
|
||||||
|
context=context)
|
||||||
|
return res
|
||||||
|
|||||||
Reference in New Issue
Block a user