0
votes

I am trying create a template for my own invoices - according to http://odoo.guide/report-design-workshop/ I already failed with the simplest sceleton.

When trying to print the invoice I get "Record does not exist or has been deleted."

I am just wondering how I can get more information on what is wrong here. Some kind of debug or error log. I can see anything in /var/log/odoo/odoo-server.log.

What would be the default way in odoo to track down such error?

Edit

These are my views:

Report

<?xml version="1.0"?>
<t t-name="account.netknights_report">
  <t call="report.netknights_layout">
    <t t-foreach="docs" t-as="o">
        <div class="page">
            <div class="row">
                <h3>Rechnung</h3>
            </div>
        </div>
    </t> 
  </t>
</t>

Layout

<?xml version="1.0"?>
<t t-name="report.netknights_layout">
  <t t-call="report.netknights_layout_header">
  </t>
  <t t-raw="0" />
  <t t-call="report.netknights_layout_footer">
  </t>
</t>

Header

<?xml version="1.0"?>
<t t-name="report.netknights_layout_header">
   <div class="header">
       <div class="row">
            <div class="col-xs-4 col-xs-offset-8">
                <img src="/document/images/NetKnights-800px.png" />
            </div>
       </div>
   </div>
</t>

Footer

<?xml version="1.0"?>
<t t-name="report.netknights_layout_footer">
   <!-- Header Architecture -->
<b>Bankverbindung</b>
</t>

Then I created these external identifiers:

account.netknights_report account.netknights_report ir.ui.view 831

report.netknights_layout report.netknights_layout ir.ui.view 319

report.netknights_layout_footer report.netknights_layout_footer ir.ui.view 320

report.netknights_layout_header report.netknights_layout_header ir.ui.view 321

1
Could you post the code that you already have? That might help us find the problem quicker.Bhavya
Thanks a lot for your time. I have no code and I do not want to implement any code. My top level goal is to customize the look of my printed invoice. I might get odoo wrong, but I expect it to be able to adapt the look of my prints without a line of python code. I just created the xml-report.cornelinux

1 Answers

0
votes

There may already be some logging wherever your odoo server is configured to output logging. Check your config or startup script to determine where logging is being written to.

A way you can get some logging while running your report is to define an abstract model for your report. Here is an example.

class ReportClass(models.AbstractModel):
    _name = 'report.myaddon.report_view_id'

    @api.multi
    def render_html(self, data=None):
        _logger = logging.getLogger(__name__)
        _logger.info("Creating My Report")
        report_obj = self.env['report']
        report = report_obj._get_report_from_name('myaddon.report_view_id')
        docs = self.env['myaddon.model'].browse(self._ids)
        docargs = {
            'doc_model': report.model,
            'docs': docs,
        }
        return report_obj.render('myaddon.report_view_id', docargs)

Notice the logging. These logs should appear wherever your odoo instance is configured to log to. If you are running in a development environment it might be standard output. If you have a config file or have started your server with a config file specified it should show up there. If you use _logger.info ensure you are logging info level (not warning or error) output.

From the sounds of things your report is trying to access data on a record that the system thinks is missing (sorry for stating the obvious, I am sure you already know that). Anyways this should atleast give you a start at looking at some logging.

I just noticed that you alias your records as "o" however you have a t-raw="0" which says output the raw value of the value of the variable "0", not "o". This might be a typo. Because if you really just wanted a 0 I assume you would have used

 <p>0</p> 

or something like that.

Check out this Odoo Qweb Reports. There is some decent info for reports.