This question has been flagged
2 Replies
4860 Views

<openerp>
 <data>
     <report
         id="account_invoices"
         model="account.invoice"
         string="Invoices"
         report_type="qweb-pdf"
         name="account.report_invoice"  
         file="account.report_invoice"  
         attachment_use="True"

         attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','')+'.pdf')"

        />
 </data>
</openerp>

 

I need your HELP.

Thanks for advances

Avatar
Discard
Best Answer

I use in my module "account__pl":

<report
            id="account_invoices__pl"
            model="account.invoice"
            string="Invoices PL"
            report_type="qweb-pdf"
            name="account__pl.report_invoice_pl"
            file="account__pl.report_invoice_pl"
            attachment_use="True"
            attachment="(object.state in ('open','paid')) and ('IPL'+(object.number or '').replace('/','')+'.pdf')"
            multi="True"
        />

 

and in report_invoice_pl.py:

 

class report_invoice_pl(osv.AbstractModel):
    _name = 'report.account.report_invoice'
    _inherit = 'report.abstract_report'
    _template = 'account__pl.report_invoice_pl'
    _wrapped_report_class = parse_invoice_pl 

 

or, in new style reports:

 

class report_invoice(models.AbstractModel):
    _name = 'report.account.report_invoice'
    _template = 'account__pl.report_invoice_pl'
    
    @api.multi
    def render_html(self, data=None):
                                                                     
        report_obj = self.env['report']
        report = report_obj._get_report_from_name(self._template)        
       
        docargs = {
            'doc_ids': self._ids,
            'doc_model': report.model,
            'docs': self,
        }

        return report_obj.render(self._template, docargs)

class report_invoice_pl(report_invoice):
    _name = 'report.account__pl.report_invoice_pl'

 

 

Avatar
Discard
Author Best Answer

 

and in report_invoice_pl.py:

 

class report_invoice_pl(osv.AbstractModel):
    _name = 'report.account.report_invoice'
    _inherit = 'report.abstract_report'
    _template = 'account__pl.report_invoice_pl'
    _wrapped_report_class = parse_invoice_pl 

This Model used to embed old style reports

Avatar
Discard

ok, you're right, improve in yourself

Author

did you check if it works?

Author

did you check if it works?

Author

thanks for your reply!!!