Yep, just book the AA codeshare, and it earns just like any other AA flight. 100% miles (and, of course, 100% elite qualifying mileage) plus elite bonuses. Codeshares are definitely the way to go.
The downside is that quite often the AA codeshares cost substantially more than the operating airline code. But if the cost differential is minimal, book the codeshare.