Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: New api: Related fields issue

by
vijay
- 09/25/2014 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

vijay.maurya@bistasolutions.com || ERP Developer || +91 8097423668

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

www.bistasolutions.com

www.erpincloud.com



On 25 September 2014 18:07, Maxim Litnitskiy <litnimaxster@gmail.com> 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 <litnimaxster@gmail.com>:
Hi guys!

    @api.one
    def _get_active_session(self):
        """Get open session"""
        session = self.sessions.search([
            ('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?

Thanks.


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe