Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[initdb] add user and lang options #101

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

MAG-Florian-Chevalier
Copy link

@MAG-Florian-Chevalier
Copy link
Author

Hi @sbidoul,

Here is our first proposal to add the option to set username, password, language and all those options with the initdb command. At the moment, country and language seem to be working fine but login, password and phone aren't.
If you have any advice on this it will be welcomed.

Regards

@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2021

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.69%. Comparing base (fd022cc) to head (5410eb0).
Report is 91 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   93.19%   92.69%   -0.51%     
==========================================
  Files          14       14              
  Lines         896      903       +7     
  Branches      149      157       +8     
==========================================
+ Hits          835      837       +2     
- Misses         43       45       +2     
- Partials       18       21       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flotho
Copy link

flotho commented Sep 24, 2021

Hi @sbidoul ,
We're trying to understand why you use the registry to create the database .
We found this method exp_create_database https://github.com/OCA/OCB/blob/14.0/odoo/service/db.py#L125 that doing everything needed.
Could you explain us what's hiding behind the Registry usage. We're suspecting that it is needed for managing the cache db or something like this.
Any advice here would be appreciated.
Regards

@sbidoul
Copy link
Member

sbidoul commented Sep 24, 2021

exp_create_db calls _initialize_db which does Registry.new too, so it's quite similar in behaviour ?

Otherwise, I don't remember why _initialize_db was not used, sorry.

@flotho
Copy link

flotho commented Sep 24, 2021

Hi @sbidoul ,

So if we continue in the direction of using this method there https://github.com/acsone/click-odoo-contrib/pull/101/files#diff-7ef2b7bba0483174747437d28282a83c065ceb8bed4021ed382ebdacc021ce91R72 could it be a valid contribution for you or do you have some requirements to share with us?

Regards

* add new params for initdb. add login password lang and country

* fix no cache with specific modules

* fix no cache with specific modules
@MAG-Florian-Chevalier MAG-Florian-Chevalier marked this pull request as ready for review October 15, 2021 12:17
@MAG-Florian-Chevalier MAG-Florian-Chevalier changed the title [WIP] add user and lang options add user and lang options Oct 15, 2021
@MAG-Florian-Chevalier MAG-Florian-Chevalier changed the title add user and lang options [initdb] add user and lang options Oct 15, 2021
@MAG-Florian-Chevalier
Copy link
Author

ping @sbidoul PR is ready for review

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comment.

This would need tests.

if new_database:
odoo_createdb(new_database, demo, module_names, False)
odoo_createdb_without_cache(new_database, demo,module_names, lang, password, login, country, phone)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the cache options, controls the caching of database templates. This apparently merely disables _save_installed_checksums, which I think is good to preserve in this branch too.

Actually, there should be no reason to not cache in this case, and this should be doable easily by including lang, password, etc in the addons_hash() function, like the demo flag is already handled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that phone was not supported in older Odoo versions ?

README.rst Outdated
--login TEXT Set admin login.
Imcompatibility with --cache. [default: admin]
--country TEXT Set default country.
Imcompatibility with --cache. [default: GB]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GB the default for Odoo ?

@flotho
Copy link

flotho commented Oct 18, 2021

Hi @sbidoul thanks for your feedback, @gaelTorrecillas and @MAG-Florian-Chevalier will have a look to your comments

@sbidoul
Copy link
Member

sbidoul commented Oct 18, 2021

And thanks for contributing :)

@flotho
Copy link

flotho commented Oct 19, 2021

And thanks for contributing :)

we're fan of your modules, so we're contributing

@MAG-Florian-Chevalier
Copy link
Author

Hi @sbidoul, we've changed the code according to your comments.
We have tested this in v12 and v14 and everything seems fine.

@flotho
Copy link

flotho commented Nov 5, 2021

ping @sbidoul , any chance to have an additional review

@sbidoul
Copy link
Member

sbidoul commented Nov 17, 2021

Sorry for the delay I've been very busy on other things. I'll get back to this as soon as I can. In the meantime can you look at the test failures?

@sbidoul
Copy link
Member

sbidoul commented Dec 4, 2021

Hi,

I had a quick look at the tests.

  • There is a pre-commit check failing. I recommend running pre-commit install in your local checkout so the pre-commit checks will run locally before pushing.
  • I would not worry about the failing test on 8.0. I think I'll drop python 2 support. The previous versions will still be there for those who need it.
  • You need to investigate the test failures on Odoo 13,14,15

@flotho
Copy link

flotho commented Dec 30, 2021

Hi @sbidoul a great thanks for this feedback

@flotho
Copy link

flotho commented Dec 30, 2021

@gaelTorrecillas @MAG-Florian-Chevalier could you have a look to this please

@takuyozora
Copy link

Hi, this PR could be really useful, any change that it will be merged soon ? Thanks !

@omerahmed1994
Copy link

Hi, this PR could be really useful, any change that it will be merged soon ? Thanks !

+1

@sbidoul
Copy link
Member

sbidoul commented Nov 19, 2024

I had lost track of this, sorry for the delay.

This would need tests.

Also, I think there should be a warning or an error (not sure) if these new options are used with --cache, otherwise they will be silently ignored and that will be confusing for users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants