hexya-erp / hexya-base

Deprecated. See the new hexya-addons organisation
https://github.com/hexya-addons
Other
11 stars 7 forks source link

Error while initializing, [error pq: null value in column "currency_id" violates not-null constraint #1

Closed twokaybee closed 6 years ago

twokaybee commented 6 years ago

Hi,

I am getting the following error while trying to start Hexya server for the very first time.

pq: null value in column "currency_id" violates not-null constraint

I did check the db and found the currency table and rate table both were empty. Could anyone help me on this. Detailed log attached. hexya.log

npiganeau commented 6 years ago

Hi,

Thanks for your interest in Hexya. The currency table should be populated when you run hexya updatedb.

Which hexya module did you import ?

twokaybee commented 6 years ago

Hi, thank you for your reply.

I actually followed the installation guidelines from http://hexya.io/docs/install/ In the steps provided, I checked out the demo project. But I skipped the step listed under 4.2 of the document. So, basically it's the demo project repository only.

npiganeau commented 6 years ago

Ok. I'll have a look. Actually there is a lot of ongoing work on hexya-base and hexya-addons to be abls to create a demo site in a few weeks and it is possible that the current "version" is broken.

You can also try to modify your DemoProject/config/project.go to import github.com/hexya-erp/hexya-addons/account instead of sale. Then drop your DB and run hexya generate hexya updatedb and hexya server again.

twokaybee commented 6 years ago

Ok, I will check and revert back after working on the modifications recommended. I would like to recommend creating branches and keeping the master always stable.

twokaybee commented 6 years ago

@npiganeau I tried the same what you mentioned in your previous comment and failed to load the same. Please check the ss.

image

twokaybee commented 6 years ago

Hi,

Any update on this issue? If it will take time to resolve, I would be glad to know any work-around, such as providing a backup of a working database?

npiganeau commented 6 years ago

Hi,

I have several ongoing works, but right now it should work with the latest commits from all repos:

go get -u github.com/hexya-erp/hexya
go get -u -d github.com/hexya-erp/hexya-base
go get -u -d github.com/hexya-erp/hexya-addons
go get -u github.com/hexya-erp/hexya-demo

Then:

Warning: modules are now defined in the hexya.toml config file. Install documentation has been updated, but make sure to clear cache in your browser if you read it from hexya.io. The demo project is updated too.

inigofu commented 6 years ago

I have tried with the new instructions several times and get the same when trying to start hexya server. I have seen that the updatedb proccess. also it says "Database updated sucessfully", during the process it gets the following error. image

npiganeau commented 6 years ago

Sounds like both of you are running Windows while I'm on Linux. I'll have to try it. Which version of pg are you using?

inigofu commented 6 years ago

I'am using postgres 10.1

twokaybee commented 6 years ago

I am using 9.6

twokaybee commented 6 years ago

@npiganeau could you please share your dev env setup?

npiganeau commented 6 years ago

Ok, I found the pb. It had to do with the automatic call to Init() methods of models at bootstrap. I didn't see it on my side because I didn't drop my DB.

It's now fixed. Please let me know if it is OK for you so that I can close the issue.

npiganeau commented 6 years ago

For the record my dev setup is:

twokaybee commented 6 years ago

Sure will have a look and let you know soon.

On 18-Jan-2018 3:23 AM, "Nicolas PIGANEAU" notifications@github.com wrote:

Ok, I found the pb. It had to do with the automatic call to Init() methods of models at bootstrap. I didn't see it on my side because I didn't drop my DB.

It's now fixed. Please let me know if it is OK for you so that I can close the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hexya-erp/hexya-base/issues/1#issuecomment-358460318, or mute the thread https://github.com/notifications/unsubscribe-auth/AfaAkY6LM5TQJjhz4ldLzsTq4nwgFOBzks5tLmvlgaJpZM4RKwgg .

twokaybee commented 6 years ago

Hi @npiganeau , for me, the issue still persists on windows. I did checkout all the modules from scratch and tried. Please find attached log file.

inigofu commented 6 years ago

I am also getting the same error.

npiganeau commented 6 years ago

@twokaybee sorry, I don't see your log

inigofu commented 6 years ago

I have been debuging and the problema seems to be that the csv file with currency data in base module are not loaded to database. So in line 61 of the 000hexya.go file "euro := pool.Currency().Search(env, pool.Currency().HexyaExternalID().Equals("base_EUR"))" it tries to find the euro it gets a null value and in the next sentence in creates a company with null currency.

How do we impor the csv?

twokaybee commented 6 years ago

Sorry for the mistake, please find attached. hexya_new.log

npiganeau commented 6 years ago

CSV should have been imported by hexya updatedb. Don't hesitate to drop DB before (and recreate) since updatedb is not fully reliable on db updates.

I'll have a look too.

npiganeau commented 6 years ago

I guess it's something like the symlink that fails on Windows and I don't catch the error (shame on me !).

Try running hexya updatedb in an admin shell to see if it's a permission related issue.

npiganeau commented 6 years ago

Yes, that's it: on windows non-admin users are not allowed to create symlinks.

Here is what I did:

Can you pull the changes with go get -u github.com/hexya-erp/hexya and check please ?

twokaybee commented 6 years ago

Yes, will update you back.

On 19-Jan-2018 3:28 AM, "Nicolas PIGANEAU" notifications@github.com wrote:

Yes, that's it: on windows non-admin users are not allowed to create symlinks.

Here is what I did:

  • I've changed the symlinking to be done in hexya generate, so it means that hexya generate must be done as admin on windows.
  • hexya updatedb and hexya server do not need admin privileges anymore.

Can you pull the changes with go get -u github.com/hexya-erp/hexya and check please ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hexya-erp/hexya-base/issues/1#issuecomment-358795324, or mute the thread https://github.com/notifications/unsubscribe-auth/AfaAkewf0-d54Ro3vpqhFJzdqq2Zk6lRks5tL76PgaJpZM4RKwgg .

inigofu commented 6 years ago

It work for me executing hexya updatedb as admin before the update. With the latest versión now when starting server I get "Unknown parent menu ID, [parentID sale_teams_menu_sale_config caller BootStrap]"

npiganeau commented 6 years ago

After you downloaded the new version, you need to run hexya generate (as admin) again before running hexya server.

After running hexya generate you should have inside hexya/hexya/server the following folders:

and inside each folder you should have symlinks to the folder of the same name in each package (e.g. hexya/hexya/data/base should be a symlink to hexya-base/base/data)

npiganeau commented 6 years ago

BTW to speed up hexya startup, you can run go install ./... inside the hexya-erp/hexya folder after you have run hexya generate. This will take a while, but following calls to hexya updatedb or hexya server should be much quicker.

This hack will no longer be necessary with go 1.10

twokaybee commented 6 years ago

@npiganeau I am also having the same issue reported by @inigofu . Log file attached, below the listing of hexya/hexya/server.

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       19-01-2018     16:25                data
d-----       19-01-2018     16:25                i18n
d-----       19-01-2018     16:25                resources
d-----       19-01-2018     16:25                static
d-----       19-01-2018     16:25                templates
-a----       19-01-2018     16:24           2738 context.go
-a----       19-01-2018     16:24           4722 modules.go
-a----       19-01-2018     16:24           4270 routes.go
-a----       19-01-2018     16:24           3895 server.go

The views folder is missing from server folder and is present in hexya/hexya/. However, the titled issue '"error pq: null value in column "currency_id"' is fixed. hexya_190118.log

npiganeau commented 6 years ago

My mistake, there shouldn't be a views folder, so that's OK.

Problem is that saleTeams/resources folder is not symlinked. I'll check why.

npiganeau commented 6 years ago

It should work now (hopefully...). Update hexya and run hexya generate again. You should have a subfolder saleTeams inside the resources dir.

inigofu commented 6 years ago

Now is working. Thanks.

twokaybee commented 6 years ago

Hi @npiganeau , now its working fine. Thanks for your support.

npiganeau commented 6 years ago

Thanks for your feedback