Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Model Classes cross references should use IModelFactory
Description
When using IModelFactory to override existing models, other built-in models that reference these models should honour the overrides. For example:
Create a new model factory and a model for MOrderLine lets call it MyMOrderLine, when using the Client or Web interface MyMOrderLine is used. However other model classes don't use modelfactory and directly reference the original MOrderLine (e.g. MInOut line 1303 uses org.compiere.model.MOrderLine)
All references to Model classes should be instantiated using ModelFactory.
It is a massive change indeed, EventHandler can be considered a viable workaround and the wiki can be updated to clarify that ModelFactory should not be used to override built-in Models and instead should only be used for custom Models. Please close this issue if there is no other better solution.
Carlos Ruiz April 8, 2015 at 5:30 PM
it sounds like a massive change to core classes - I think in such case is better to use EventHandler to modify the behavior
When using IModelFactory to override existing models, other built-in models that reference these models should honour the overrides. For example:
Create a new model factory and a model for MOrderLine lets call it MyMOrderLine, when using the Client or Web interface MyMOrderLine is used. However other model classes don't use modelfactory and directly reference the original MOrderLine (e.g. MInOut line 1303 uses org.compiere.model.MOrderLine)
All references to Model classes should be instantiated using ModelFactory.