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

Clear Many2one field

By
shafeequemonp
on 7/24/14, 12:56 AM 1,235 views

I had a many2one field which shows value while i change partner_id.But the problem is that those partner who has no the value also shows the previous value assigned in many2one field.Those partner who has no the value must show the many2one field empty .How can i resolve it.. 

Here is my code:

obj = self.pool.get('bank.internal.transfer')
id1 = obj.search(cr, uid, [('partner_id','=',name)])
for i in obj.browse(cr, uid, id1, context=context):
    bank_id_= i.id
    if bank_id_:
        res['bank_id']=bank_id_
    else:
        res['bank_id']=False

 

0
shafeequemonp
On 7/24/14, 1:07 AM

Hi..its ok now...

how can u explain ur code and functionality

Odoo
on 7/24/14, 1:42 AM

Its nothing i had repositioned the 'res['bank_id']=False' to the outside of loop... obj = self.pool.get('bank.internal.transfer') id1 = obj.search(cr, uid, [('partner_id','=',name)]) res['bank_id']=False for i in obj.browse(cr, uid, id1, context=context): bank_id_= i.id if bank_id_: res['bank_id']=bank_id_

shafeequemonp
on 7/24/14, 2:01 AM

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/24/14, 12:56 AM
Seen: 1235 times
Last updated: 3/16/15, 8:10 AM