[SalesForce] Error: Compile Error: Illegal assignment from Id to Opportunity at line 9 column 16

i am trying to pass opportunity id in to opportunity lookup in orde bt getting this error. can anyone plz help me.

error-Error: Compile Error: Illegal assignment from Id to Opportunity
at line 9 column 16

public class order_Creation
{
    public static void osCreated(List<Opportunity> op)
    {
       List <Order> orderToInsert = new List <Order>(); 
            for(Opportunity o : op){        
         if(o.StageName == 'Closed Won' && o.RecordTypeId == '01228000000EyCa'){      
               Order v = new Order();
               v.Opportunity = o.id;         
               v.Account = o.Account; 
               v.EffectiveDate = System.today();
               v.ContractId = o.Contract_Number__c;
               v.Status = 'Draft'; 
               orderToInsert.add(v);
         }
       }

        insert orderToInsert;


   }

}

Best Answer

You need to update

v.Opportunity = o.id;         
v.Account = o.Account; 

to

v.OpportunityId = o.id;         
v.AccountId = o.Account; 

Always you can use workbench to check all the object field API name.

https://workbench.developerforce.com/