Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3007 Tampilan

I am working on customizing the purchase module, in which i need to save the content of the purchase order in a newly created table whenever the purchase order is confirmed. I have developed a module in order to save the content to the table using create function but finally i got some errors. Please any one give some idea how to clear this error

This is the code

class inherit_purchase_update(models.Model):
    
    _inherit='purchase.order'
    

    def wkf_confirm_order(self, cr, uid, ids, context=None):
        id1=ids
        recs= self.pool.get('purchase.order.line').browse(cr,uid,id1,context=context)
        recd= self.pool.get('purchase.update').browse(cr,uid,ids,context=context)
        for rec in recs:
            cust_id=rec.partner_id.id
            price_unit= rec.price_unit
            prod_id= rec.product_id.id
            date_order=rec.order_id.date_order
            prod_qty= rec.product_qty
            rec1=recd.create(cr,uid,{'partner_id':cust_id,'date':date_order,'product_id':prod_id,'price_unit':price_unit,'product_qty':prod_qty})

ValueError: "create() takes exactly 2 arguments (4 given)" while evaluating u'wkf_confirm_order()'

 

Avatar
Buang

plz purchase it immediatly

Penulis

I got every values but the problem is while inserting into the tables

Jawaban Terbai

Try the following:

recd=self.pool.get('purchase.update')

for rec in recs:
            cust_id=rec.partner_id.id
            price_unit= rec.price_unit
            prod_id= rec.product_id.id
            date_order=rec.order_id.date_order
            prod_qty= rec.product_qty
            rec1=recd.create(cr,uid,                        
                {'partner_id':cust_id,'date':date_order,'product_id':prod_id,'price_unit':price_unit
                ,'product_qty':prod_qty})

Avatar
Buang
Penulis

Thanks Emipro Technologies Pvt. Ltd i got it , can u help me in learning odoo i am new to this field

Practically, we can help solving your problems via this forum, otherwise it is somewhat difficult to manage other communications, but we will try our best to help you out. Hope you understand. Thank you.