This is a code I'm using in one of my modules. Use it as example by changing the values of the vals dict with your own values
vals = {
'name': self.name,
'date_order': self.appointment_date,
'partner_id': self.patient.partner_id.id,
'user_id': self.doctor.partner_id.user_id.id,
'order_line': [[0, 0, {
'name': self.consultations.name,
'price_unit': self.consultations.list_price,
'product_id': self.consultations.id,
}]],
}
if pricelist_id:
vals['pricelist_id'] = pricelist_id.id
vals['currency_id'] = pricelist_id.currency_id.id
self.sale_id = self.env['sale.order'].create(vals)