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'];
$counter->load_relationship('hnsc_pc_aos_product_categories');
$counter->hnsc_pc_aos_product_categories->add($category_id);
$counter->load_relationship('hnsc_pc_accounts');
$counter->hnsc_pc_accounts->add($account_id);
$counter->save();
}
Thanks in advance,
Sam