Automatic relationship creation

Happy new year all!

I was just wondering if someone knew of a resource explaining how Sugar/SuiteCRM automatically generates a relationship when creating a record in a related Module, I have a custom module related (hnsc_PC) to AOS_Invoices which I am also using to capture some summary data related to the Account when an Invoice is paid. I want to create the record in hnsc_PC with a Logic Hook when the invoice is saved, however I do not want the hnsc_PC record to be related to the invoice.

Just wondering if someone could enlighten me on why the record is being related and if anyone had a suggestion for the best way to remove the relationship.

if($account_id != NULL){
						$counter = new hnsc_PC();
						$counter->count = $row['product_qty'];

Thanks in advance,


Managed to sort this out by simply loading and deleting the relationship from the invoice in an after save logic hook. I still haven’t found any documentation around why it was generating the relationship in the first place (I am assuming it is intended functionality as generally it would be very useful.)