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: pop() takes at most 1 argument (2 given)

By
N
on 5/15/13, 4:46 PM 3,256 views
    def create(self, cr, uid, vals, context=None):
    id = super(sale_order, self).create(cr, uid, vals, context)
            order_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('order_id', '=', id)], context=context)
    for i in self.browse(cr,uid,order_line_ids, context=context):
                    self.pool.get('sale.order.section').create(cr, uid,(0,0,{'order_line':i.id}))
    return id

I get the error TypeError: pop() takes at most 1 argument (2 given) when i want to create the sale order. It comes from the line :

                        self.pool.get('sale.order.section').create(cr, uid,(0,0,{'order_line':i.id}))

Where is the problem ?

That's ok thanks a lot !!

N
on 5/15/13, 5:29 PM

I edit my answer . if it works thankyou to mark this question as resolved.

Borni DHIFI
on 5/15/13, 5:45 PM
0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/15/13, 5:06 PM

Hi ,

try to divise your code in clear lines.

try with this code :

   section_pool=self.pool.get('sale.order.section') 
   order_line_pool=self.pool.get('sale.order.line') 
   for order_line_id in order_line_ids
       order_line =order_line_pool.browse(cr,uid,order_line_id)
       section = {         
                  'order_line':order_line.id,
                  'name' : order_line.name,
                  'number' : 0,                               
                   #others fields
                   }
        section_pool.create(cr, uid, section )

Thanks.

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

0 follower(s)

Stats

Asked: 5/15/13, 4:46 PM
Seen: 3256 times
Last updated: 3/16/15, 8:10 AM