Odoo Help

Welcome!

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

0

How to run this query on form loading?

By
vadivel
on 7/31/14, 2:00 AM 588 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--
3883
| 5 3 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--
2387
| 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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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