Odoo Module Postgres Migrations

Hello! This is a follow up now that we are able to build the backend JAR from here:

I have configured the Odoo module to connect to a Postgres instance and I believe it’s connecting properly. However, I don’t see in the code where database migrations are being run to create the tables it uses. My logs are showing the following:

 [Metadata.Odoo] Activate. Odoo [localhost:8069;PW ok] Postgres [<REDACTED RDS URL>:5432;PW ok] Database [openems]
[Metadata.Odoo] Unable to mark Edges offline. PSQLException: ERROR: relation "openems_device" does not exist
  Position: 8
org.postgresql.util.PSQLException: ERROR: relation "openems_device" does not exist
  Position: 8
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2712)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2400)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:367)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:177)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
	at io.openems.backend.metadata.odoo.postgres.InitializeEdgesWorker.markAllEdgesAsOffline(InitializeEdgesWorker.java:64)
	at io.openems.backend.metadata.odoo.postgres.InitializeEdgesWorker.lambda$start$0(InitializeEdgesWorker.java:43)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

I’m unsure how to proceed as I don’t see anything that stands out in the Getting Started guide about this.

what you are looking for is the postgresDB - for this you need the Odoo OpenEMS Implementation which is currently under construction to work properly with openems on GitHub :wink:

Remember to publish your Code as in the Licenses of the Repository :slight_smile:

Hi @Sn0w3y Thanks for the message. Can we contribute code etc to help make this available to the community? We would be happy to invest time to help.

Yes, on GitHub. fork the original Repo and make changes then, upload it to your Repository and propose the Changes as a PullRequest.

Hi @Sn0w3y thank you.

Sorry I should have asked… we are happy to contribute. Is there a way for us to discuss the requirements. It sounds like some design work has been completed. I would just want to make sure we are building what everyone needs and could use.

OpenEMS does not directly manage the database schema in Postgres. This is done by Odoos Object Relational Mapping (ORM). Once you install the Odoo OpenEMS module, it should automatically create the database table openems_device.

You can see the expected result also in our Gitpod Live-Demo: Dashboard

The part that is currently missing in the public repository is an extension to the OpenEMS Odoo module that handles the App-Center, e.g. creating a shipping note, invoice etc. for OpenEMS Apps or validating keys via Odoo. We plan to share this module as well, but need some time cleaning it up.

Everything outside of App-Center should work with whats available as open source.

Regards,
Stefan

2 Likes

Apologies for not following up sooner. Thank you for the guidance, it was very helpful.

We were able to use the Bitnami Odoo helm chart and add the required OpenEMS plugins by following the gitpod simulation example. Thank you!

1 Like