Odoo Help


odoo8. Reports and variables transfering

on 12/22/14, 9:39 AM 953 views

hi everyone.

I'm making a report in Odoo 8 and my htm file has such code lines:

<TD CLASS="R37C4"><SPAN STYLE="white-space:nowrap;">${line.price_unit or ''}</SPAN></TD>

it works and I get my pdf after compilation. But, I can get acces only to the "sale.order" model and dependencies. But i need to get the access to another model, stock.quant. There is no dependency between these models. How can I get it? Thank you.



| 6 5 7
Lodz, Poland

On 1/11/15, 3:39 PM

You create report parser like this (see method currency_text):

<span t-if="o.currency_id" t-esc="currency_text(o.amount_total, o.currency_id.name, o.partner_id.lang or 'pl_PL')"/>

class report_invoice(models.AbstractModel):
    _name = 'report.account.report_invoice'
    _template = 'account__pl.report_invoice_pl'

    def currency_text(self, sum, currency, language):
        return currency_to_text(sum, currency, language)

    def render_html(self, data=None):
        report_obj = self.env['report']
        report = report_obj._get_report_from_name(self._template)        
        docargs = {
            'currency_text': self.currency_text,        
            'doc_ids': self._ids,
            'doc_model': report.model,
            'docs': self,

        return report_obj.render(self._template, docargs)

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 12/22/14, 9:39 AM
Seen: 953 times
Last updated: 2/13/17, 6:00 PM