get values in qweb template from .py function


.xml

<t t-set="source" t-value="o._get_source_details()" />
<span t-field="source.name"/>

.py

def _get_source_details(self,cr,uid,ids,context=None):
    self_bro = self.browse(cr,uid,ids)
    sale_obj = self.pool['sale.order']
    if self_bro.origin and self_bro.type == 'out_invoice':
        sale_sea = sale_obj.search(cr,uid,[('name','=',str(self_bro.origin))])
        if sale_sea:
            sale_bro = sale_obj.browse(cr,uid,sale_sea[0])
            return sale_bro
    return True
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s