...and for those who search and find this thread first instead of one of the other ones, the answer is "no" because in most cases you only earn miles on codeshares if both the marketing and operating carriers are OneWorld partners (e.g., British Airways operated by Iberia). There's slightly different rules per oneworld carrier which you can see
here, though.