Odoo Help

0

How to run this query on form loading?

By
vadivel
on 7/31/14, 2:00 AM 662 views

Hi Friends,

I have wrote onchange function for the journals to viewed for different type of name fields.But the query retruns the values only after executing query in pgadmin

    def onchange_sequence(self, cr, uid, id, sequence_type, context=None):
        res = []
        if sequence_type:
#            value =  super(invoice_changes, self).onchange_sequence(cr, uid, id, sequence_type, context)
            cr.execute('select jl.journal_id\
                            from journal_type as jt\
                            left join journal_lines as jl on(jl.journ_id = jt.id)\
                            left join account_invoice as ai on (ai.sequence_type = jt.id)\
                            left join res_company as rc on (rc.id = jt.company_id)\
                            where ai.sequence_type = %s', (sequence_type,))
            for result in cr.fetchall():
                print "\n\n resultssssssssssssssssssssssssssssssssssssssssssssssss",result
                res.append(result[0])
            return {
                'domain': {
                      'journal_id': [('id', 'in', res)]
            } }
        return {}

 

please help me to resolve this problem

0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
4002
| 5 4 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 7/31/14, 6:21 AM

Does sequence_type  value is set with _defaults, so that the on_change can be triggered when value is available.  

If not try with adding a default value for sequence_type 

0

Ludo - Neobis

--Ludo - Neobis--
2397
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 7/31/14, 3:23 AM

Well ... your super method call is above your query, so maybe you should switch that around? Chances are I'm not really getting what you are trying to achieve.

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.

Register

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

1 follower(s)

Stats

Asked: 7/31/14, 2:00 AM
Seen: 662 times
Last updated: 3/16/15, 8:10 AM