################
Wizard method
################
def button_confirm (self): 
                        view = self.env.ref ('purchase_update_price.purchase_update_price_wizard_form') 
                        return { 
                            'name': _ ("Purchase Update Price"), 
                            'view_mode': 'form', 
                            'view_id': view.id, 
                            'res_id': view.id, 
                            'view_type': 'form', 
                            'res_model': 'purchase.update.price .wizard ',
                            'type': 'ir.actions.act_window',
                            'target': 'new', 
                                }
###################
purchase order line field
###################
    def update_purchase_price (self): 
        active_pro = self.env ["purchase.order"]. browse (self.env.context.get ("active_id")). search ([]) [0]  
        return active_pro.order_line 
    order_line = fields.Many2many ('purchase.order.line', string = 'Available Products' 
                                  , default = update_purchase_price)
#Still i am getting empty list with only labels not values in my wizard why?
 
                        
are you expecting to show the purchase order lines in the order_line field ? if so how you tried to do it? if you are looking for the way, you can do it from the default_get method of the wizard model.
Yes exactly thats what i am trying to do.
I fetched the order_line by
active_pro = self.env ["purchase.order"]. browse (self.env.context.get ("active_id")). search ([]) [0]
but its not apprearing in wizard i don't know why i set this function as a default value for a field order_line
@api.model
def default_get(self, fields):
res = super(PurchaseUpdatePriceWizard, self).default_get(fields)
active_pro = self.env["purchase.order"].browse(self.env.context.get("active_id")).search([])[0]
new_line = []
for product in active_pro.order_line:
line = (0, 0, {
'order_id': product.order_id,
'product_id': product.product_id,
'name': product.name,
'company_id': product.company_id,
'product_uom_category_id': product.product_uom_category_id
})
new_line.append(line)
res.update({
'order_line': new_line
})
return res
order_line = fields.Many2many('purchase.order.line', string='Available Products')
#used default_get also still empty list