Changing Opportunity/Quote relationship from 1:M to M:M

My customer has defined a requirement where the same quote be linked to multiple opportunities. I have looked at the current definition of AOS Quotes and have noticed that current relationship does not support this as it is currently one opportunity can have many quotes. And when I look into this further I see that this relationship has not been defined with a separate relationship table but rather that the opportunity_id field is stored in the aos_quotes table.

So I am wondering if anyone has any ideas as to the best way to modify this relationship?


Editing those “false relationships” (it’s just a field pointing to the other table) can be hard, if there are many references in the code using that relationship - I am not sure if this is the case here, but it is likely.

You could try just setting up a new 1:M relationship between those two modules, and see if that works well for your requirement. You might discover some parts don’t work as expected (where SuiteCRM is looking at the opportunity_id field) but you can try to fix those one by one.

If you are creating Relationships via Studio then a new relationship would be best.
For Coding the Relationship yourself you have to Create Link fields in both Modules Vardefs and Create a MetaData file to define relationship.
See examples in the SuiteCRM code for opportunities or leads module vardefs and inside metadata folder located on the root.