Skip to Content
Menu
This question has been flagged
1 Reply
6955 Views

hi i use this code to make a query to print report

def print_report(self, cr, uid, ids, context=None):

        form_data = self.read(cr, uid, ids)

        cr.execute("SELECT * \
                FROM stock_move ")
        res = self.cr.dictfetchall()
        idp = self.pool.get('stock.move').search(cr, uid, [], context=context)
        datas = {
             'ids': idp,
             'model': 'product.product',
             'form': form_data,
            'query': res,
        }

        return {
                'name': 'Current Inventory',
                'res_model': 'stock.move',
                'context': context,
            'type': 'ir.actions.report.xml',
            'report_name': 'moves.report.viera',
            'datas': datas,
        }

but i have this error

'moves_report' object has no attribute 'cr'

Avatar
Discard
Best Answer

Hi,

replace

res = self.cr.dictfetchall()

with

res = cr.dictfetchall()
Avatar
Discard
Author

الحمد لله ... واشكرك يا اخى