Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How can I add a new report? [Closed]

By
CK
on 4/8/13, 6:39 AM 1,341 views

The Question has been closed

by
Sudhir Arya (SA)
on 04/18/2013 05:26:30

I have written a new report named picking1 which is like picking but little different, the picking1.py like:

import time
from openerp.report import report_sxw
from openerp.osv import osv
from openerp import pooler

class picking1(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
    super(picking1, self).__init__(cr, uid, name, context=context)
    self.localcontext.update({
        'time': time,
        'get_product_desc':self.get_product_desc
    })
def get_product_desc(self,move_line):
    desc = move_line.product_id.name
    if move_line.product_id.default_code:
        desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
    return desc
report_sxw.report_sxw('report.stock.picking1.list','stock.picking','addons/stock/report/picking1.rml',parser=picking1)

(It's like picking.py, I just replace "picking" with "picking1") I put picking1.py ,picking1.rml in stock/report.

Then I add

<report auto="False" id="report_picking_list_out1" model="stock.picking.out" name="stock.picking.list" string="Delivery Slip11" rml="stock/report/picking1.rml"/>

in stock/stock_report.xml, so the "Delivery Slip11" will in "Print".

However,when I click the "Delivery Slip11",it print picking.rml instead of picking1.rml..I don't know what mistakes I make.....Is any place I have to change? Thanks....

I have written "improt picking1" in report/__init__.py

CK
on 4/8/13, 6:41 AM
0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 4/8/13, 6:49 AM

Try to change report service name in py and xml.

Change this report.stock.picking1.list name to something like this in py: report.stock.picking1.list.new.

Change this name="stock.picking1.list" name to something like this in py: name="stock.picking1.list.new".

0
CK
On 4/8/13, 7:07 AM

Thanks~ I change "name" in the stock_report.xml :

 <report id="report_picking_list_out1" model="stock.picking.out" name="stock.picking1.list" string="Delivery Slip11" rml="stock/report/picking1.rml"/>

Maybe it should have different name ,because "stock.picking.list" is exist and I print the picking1.rml is failure~~

        <report id="report_picking_list_out" model="stock.picking.out" name="stock.picking.list" string="Delivery Slip" rml="stock/report/picking.rml"/>

Now it can work as I like~~

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/8/13, 6:39 AM
Seen: 1341 times
Last updated: 3/16/15, 8:10 AM