Metadata deploy error when starting module

Hi,

We are having this error when starting our custom module and we have records on drug_orders table on the database:

org.openmrs.api.CannotUpdateObjectInUseException: Order.frequency.cannot.edit

We have traced it back to this line: https://github.com/openmrs/openmrs-module-metadatadeploy/blob/master/api-1.10/src/main/java/org/openmrs/module/metadatadeploy/handler/impl/OrderFrequencyDeployHandler.java#L26

Since OrderService has a validation that does not allow to update an OrderFrequency entity that is already in use by a DrugOrder. See: https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java#L805

Can you please give guidance on the best way to solve this problem?

We are using latest snapshot of reference application 2.9.

Thank you,

@mseaton

That looks like a problem in the metadatadeploy module. A quick fix would be for the metadatadeploy module to first check if the order frequency is in use, before attempting to save it.

1 Like

Hi @dkayiwa, we created this issue https://issues.openmrs.org/browse/RA-1554 and submited a PR . Can you help with the merging? https://github.com/openmrs/openmrs-module-metadatadeploy/pull/6

I have put some comments on the pull request.

1 Like

Thank you @dkayiwa Just fixed the commit message.

Can you also claim the ticket and do the JIRA workflow as advised here? https://wiki.openmrs.org/display/docs/Pull+Request+Tips