0
votes

I added a new report on stock module (into OpenERP v7), but the path to the rml file seems correct to me, when a click the 'print' button it says:

RML is not available at specified location or not enough data to print!

(None, None, None)

Should be an error in the path I specified on .py file, but I checked and re-checked and seems correct.

Here's my code:

import time
from openerp.report import report_sxw

class reporte_locacion(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(reporte_locacion, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
             'time': time,
             'qty_total':self._qty_total
        })

def _qty_total(self, objects):
    total = 0.0
    uom = objects[0].product_uom.name
    for obj in objects:
        total += obj.product_qty
    return {'quantity':total,'uom':uom}

report_sxw.report_sxw(
    'report.reporte.locacion',
    'product.product',
    'addons/stock/report/reporte_locacion.rml',
    parser=reporte_locacion,
    header='internal'
)

I already have it on that location, could it be the stock_report.xml file?

Here's how I declare the report on it:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report auto="False" id="reporte_locacion" model="product.product" name="reporte.locacion" string="Productos en almacen"/>
        <report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Stock Level Forecast"/>
        <report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking Slip" rml="stock/report/picking.rml"/>
        <report id="report_picking_list_in" model="stock.picking.in" name="stock.picking.list.in" string="Receipt Slip" rml="stock/report/picking.rml"/>
        <report id="report_picking_list_out" model="stock.picking.out" name="stock.picking.list.out" string="Delivery Slip" rml="stock/report/picking.rml"/>
        <report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
        <report auto="False"  id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Inventory Overview" rml="stock/report/lot_overview.rml"/>
        <report id="report_location_overview_all" model="stock.location" name="lot.stock.overview_all" string="Location Content" rml="stock/report/lot_overview_all.rml"/>
        <report id="report_stock_inventory_move" model="stock.inventory" name="stock.inventory.move" string="Stock Inventory" rml="stock/report/stock_inventory_move.rml"/>
    </data>
</openerp>

The first report on it being the one which is having an error, did I miss something there?

Should be fine since it's almost same declaration type as the other reports, and they all work fine though.

Any ideas?

Thanks in advance!

1
Aren't you supposed to do the customization in a custom module?sajadkk

1 Answers

2
votes

Declaration should be like this

<report id="reporte_locacion" 
        model="product.product" 
        name="reporte.locacion" 
        string="Productos en almacen" 
        rml="addons/stock/report/reporte_locacion.rml"/>