0
votes

This is my function. I am able to create a new quatation on clicking a button in my indent form and also able to see the indent sequence in quatation. But I am not able to update product line in indent in purchase order line. Can any1 help me out here..? @api.multi

  1. def action_rfq(self):
  2. rfq_obj = self.env['purchase.order']
  3. for order in self.product_lines:
  4. rfq_id = rfq_obj.create({
  5. 'series': self.name,
  6. 'order_line': ({
  7. 'product_id': order.product_id.id, 'name': order.name, 'product_qty': order.product_uom_qty, 'product_uom': order.product_uom.id, 'price_unit': order.price_unit, 'date_planned': datetime.now(), 'order_id': order.indent_id.id, }) })

                                    'product_id': order.product_id.id,
                                    'name': order.name,
                                    'product_qty': order.product_uom_qty,
                                    'product_uom': order.product_uom.id,
                                    'price_unit': order.price_unit,
                                    'date_planned': datetime.now(),
                                    'order_id': order.indent_id.id,
                                    })
                            })
            return rfq_id
    
1

1 Answers

0
votes

Hello Gautam, It would be late now ,but can be helpfull for others.You want to update product line in indent in purchase order line ...so for updating the order line you have to call the write function and pass the product value like this...

order_line_obj = self.env['purchase.order.line']

first create the obj of purchase .order.line

browse_obj=order_line_obj.browse(int(active_id))

After creating the object call browse object and pass the id of present record

order_line_id=browse_obj.write({'name':hotel_name})

After doing this call the write function with browse object.and doing so your record will be updated.