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

TypeError: 'builtin_function_or_method' object is not iterable ,,,why? for a custom button code

By
Odoo
on 4/13/15, 7:37 AM 2,063 views

When I try to use same functionality of copy method I got below error 

TypeError: 'builtin_function_or_method' object is not iterable for a custom code need a help...


This is my code-------------------


<button class="oe_inline oe_stat_button"

icon="gtk-cancel" type="object" string="Revised Quotation" name="my_fun" />

==========================================

def my_fun(self, cr, uid, ids, default={}, context=None):

print "inside revision_quote####################"

order = self.browse(cr, uid, id, context=context)

self.write(cr, uid, id, {'rev_no':order.rev_no+1}, context=context)

if not default:

default = {}

default.update({'name':"REV"+str(order.rev_no)+' '+str(self.pool.get('sale.order').browse(cr, uid, id, context=context).name)[-5:]})

#default.clear()

return super(sale_order, self).copy(cr, uid, id, default, context=context)

0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 4/17/15, 6:11 AM

Got the anser from Refferd link

def revised_quote(self, cr, uid, id, default=None, context=None):

default={}

print "inside revision_quote####################"

order = self.browse(cr, uid, id, context=context)

self.write(cr, uid, id, {'rev_no':order.rev_no+1}, context=context)

if not default:

default = {}

default.update({'name':"REV"+str(order.rev_no)+' '+str(self.pool.get('sale.order').browse(cr, uid, id, context=context).name)[-5:]})

#raise osv.except_osv(_('Warning!'), _('You are Revised Existind Quotation'))

#default.clear()

test=self.copy(cr, uid, id[0], default=default, context=context)

return test

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: 4/13/15, 7:37 AM
Seen: 2063 times
Last updated: 4/17/15, 6:12 AM