تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
20041 أدوات العرض

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)

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
مارس 15
7249
0
يناير 24
1911
1
سبتمبر 21
7489
2
سبتمبر 18
13833
1
أبريل 17
4735