FYI, since the modX class extends the xPDO class, you can call any of the methods with $modx->methodName().
First, your custom tables have to be set up to work with xPDO.
If your tables are in the MODX database but with a different table prefix (both highly recommended), you don't need the dsn specification and you don't need to instantiate $xpdo, since $xpdo will already exist and be connected.
If you haven't set the tables up for xPDO, this might help:
http://bobsguides.com/custom-db-tables.html, although if your tables are related (which it looks like they are) you'll have to edit the schemas manually to specify the aliases before generating the class and map files (though you don't have to do that right away, you can still get objects from either table with xPDO after running the script on the page in the link).
There's a deeper explanation here:
http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/using-custom-database-tables-in-your-3rd-party-components.
You'll also need to load your classes with loadClass() before calling any xPDO methods for them.
It's not mandatory, but if it's not too late, I'd recommend that instead of a stock number and a product number, you use a primary key, autoincrement field called 'id' for both. If your tables exist and have a lot of products in them, at least make product number and stock number the primary keys.
I haven't really answered your question, but without the steps above, an answer wouldn't help you.
There's an introduction to getting objects with xPDO here:
http://bobsguides.com/revolution-objects.html
I hope this helps more than it confuses you. It's not as difficult as it sounds.