【问题标题】:OpenERP v7 Error on ReportOpenERP v7 报告错误
【发布时间】:2018-01-10 17:55:19
【问题描述】:

我添加了一个关于stock 模块的新报告(到 OpenERP v7 中),但是 rml 文件的路径对我来说似乎是正确的,当单击“打印”按钮时它显示:

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

(None, None, None)

应该是我在 .py 文件上指定的路径有错误,但我检查了又重新检查,似乎是正确的。

这是我的代码:

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'
)

我已经在那个位置有它,它可以是stock_report.xml 文件吗?

我是这样声明报告的:

<?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>

关于它的第一个报告是有错误的,我错过了什么吗?

应该没问题,因为它的声明类型与其他报告几乎相同,但它们都可以正常工作。

有什么想法吗?

提前致谢!

【问题讨论】:

  • 您不应该在自定义模块中进行自定义吗?

标签: python xml openerp odoo rml


【解决方案1】:

声明应该是这样的

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

【讨论】:

  • 太棒了!非常感谢,是的,应该是新的,我正在开发环境atm测试,再次感谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多