diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index 28228b4ab58..663df95047b 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -193,16 +193,17 @@ class report_creator(osv.osv): if context is None: context = {} data = context.get('report_id', False) + res = super(report_creator, self).read(cr, user, ids, fields, context, load) if (not context) or 'report_id' not in context: - return super(report_creator, self).read(cr, user, ids, fields, context, load) + return res ctx = context or {} wp = '' - if data: + for data in res: + if not data.get('sql_query'): + return res if self.model_set_id: wp = [self._id_get(cr, user, data, context) + (' in (%s)' % (','.join(map(lambda x: "'" + str(x) + "'", ids))))] - report = self._sql_query_get(cr, user, [data], 'sql_query', None, ctx, where_plus = wp) - sql_query = report[data] - cr.execute(sql_query) + cr.execute(data['sql_query']) res = cr.dictfetchall() fields_get = self.fields_get(cr, user, None, context) for r in res: @@ -216,7 +217,7 @@ class report_creator(osv.osv): related_name = self.pool.get(field_dict.get('relation')).name_get(cr, user, [r[k]], context)[0] r[k] = related_name - return res + return res def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ @@ -253,9 +254,8 @@ class report_creator(osv.osv): newargs += [("count(*) " + a[1] +" " + str(a[2]))] ctx = context or {} ctx['getid'] = True - report = self._sql_query_get(cr, user, [context_id], 'sql_query', None, ctx, where_plus = newargs, limit=limit, offset=offset) - query = report[context_id] - cr.execute(query, newargs2) + sql_query = report.sql_query + cr.execute(sql_query, newargs2) result = cr.fetchall() return map(lambda x: x[0], result) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index e86434b93fa..009a4ae5631 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -665,8 +665,6 @@ class mrp_production(osv.osv): stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id, context=context) - final_product_todo = [] - produced_qty = 0 if production_mode == 'consume_produce': produced_qty = production_qty @@ -706,10 +704,7 @@ class mrp_production(osv.osv): stock_mov_obj.action_consume(cr, uid, [raw_product.id], consumed_qty, production.location_src_id.id, context=context) if production_mode == 'consume_produce': - # To produce remaining qty of final product - vals = {'state':'confirmed'} - final_product_todo = [x.id for x in production.move_created_ids] - stock_mov_obj.write(cr, uid, final_product_todo, vals) + produced_products = {} for produced_product in production.move_created_ids2: if produced_product.scrapped: diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 99a4beb8030..e0e65d3b640 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -600,7 +600,7 @@