Technical mailing list archives


Re: New api: Related fields issue

- 2014年09月25日 08時42分15秒
Hi all,

I want to generate report in excel format instead rml.
is anyone aware any module which converts reports in excel format ?  

Thanks & Regards || ERP Developer || +91 8097423668

<img border="0" width="152" height="55" src="cid:image001.png@01CEA034.64CD6910" alt="png">

On 25 September 2014 18:07, Maxim Litnitskiy <> wrote:
Sorry all the list for spam :-)
Forgot the magic keywords pause_request = fields.Boolean(related='active_session.pause_request').
Probably I need to sleep more then 3 hours per nignt :-)

2014-09-25 15:54 GMT+04:00 Maxim Litnitskiy <>:
Hi guys!
    def _get_active_session(self):
        """Get open session"""
        session =[
            ('state', 'in', ['running', 'paused'])],
            order='create_date desc', limit=1)
        self.active_session = session
        print 'SESSION', self.active_session
        print 'SESSION PAUSE', self.active_session.pause_request

This code gets the latest session object according to criteria.

To be able to get from views active_session fields I added to the model:

active_session = fields.Many2one('asterisk.dialer.session', compute='_get_active_session')
cancel_request = fields.Boolean('active_session.cancel_request')
pause_request = fields.Boolean('active_session.pause_request')

(I was surpised I cannot do in view: <button name='pause' type='object' string='Pause' attrs="{'invisible': [('active_session.pause_request','!=',True)]}"/>, cannot I chain fields in views?)

But Related field does not work. When there is no active_session self.active_session.pause_request returns False but self.pause_request returns True.
How can it be?


Post to: