summaryrefslogtreecommitdiff
path: root/odoo/cli
AgeCommit message (Collapse)Author
2020-10-19[FIX] *: update document linksSwapnesh Shah
Before this commit, links to the documentation were referenced the previous version, 13.0, instead of the current one, 14.0. Eventhough there is a redirection done by NGINX of a "versionless" URL to the latest one (e.g. /documentation/user/general/auth/google.html -> /documentation/user/14.0/general/auth/google.html as of today), the goal is to keep links owrking for users that will still be using the 14.0 in three years (and should not endup on the 17.0 doc). closes odoo/odoo#59554 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-04-17[FIX] module.py: Remove useless path initializationJulien Castiaux
The `initialize_sys_path` is the function responsible of getting the custom Odoo import hooks to work, i.e. addons import via `import odoo.addons`. This function is called by some other module related functions to ensure the paths are correctly setup. We are confident it is useless to re-initialize the path in many places. The `load_openerp_module` function is called during server bootup by both `odoo-bin server` and `odoo-bin shell`, both command parse the configuration before starting the server which initialize the paths already. Most call to `get_module`, `get_module_path` and `get_resource_path` are done in models or controllers where a registry is setup already. There is one notable exception which is the subcommand discovery done during the bootup, for that specific case, we initialize the paths with a partially loaded configuration. closes odoo/odoo#49715 Task: 2200956 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-06-09[ADD] odoo-bin cloc cli subcommand.Antony Lesuisse
Odoo cloc is a tool to count the number of relevant lines written in Python, Javascript or XML. This can be used as rough metric for pricing maintenance of customizations. It has two modes of operation, either by providing a path: odoo-bin cloc -p module_path Or by providing the name of a database: odoo-bin cloc --addons-path=dirs -d database In the latter mode, only the custom code is accounted for. Both modes can be used simultaneously. Files that cannot be parsed are shown at the end of the report. Parsing can fail due to syntax errors or excessive file size. closes odoo/odoo#52635 X-original-commit: ae858c3ac66267b4726db459032b91a6be1cc1d6 Related: odoo/enterprise#11018 Signed-off-by: Olivier Dony (odo) <odo@openerp.com> Co-authored-by: Thibault Francois <tfr@odoo.com> Co-authored-by: Antoine Vandevenne (anv) <anv@odoo.com>
2020-03-30[IMP] core, base: add tooling to populate databaseXavier-Do
Some use case like testing performance or upgrade scripts required a database with prefilled data, covering basic corner cases. A solution can be to create data a procedural way. This commit proposes an API to easily populate a model, usually by giving a list of possible values for each field or by giving a compute method that will be based on raw values of other fields. The basic way to define how to populate a new field is to override `_populate_factories`, a method that returns a sequence of pairs `(field_name, factory)`. The definition of a field is a "factory", a function that returns a neverending iterator combining its value(s) with the values of the iterator given in parameter. Some factory helpers are given in `tools.populate.py`: - `iterate(vals, weighs)` ensures that one record is created for each value by iterating on them, then resumes as `random.choice` on those vals following weights once the first iteration is finished. - `cartesian(vals, weights)` makes a cartesian product of its own values with the values of its input iterator, then resumes as a randomized generator. - `compute(function)` calls the given function with the current values dict and a random object, and assigns the current field to the returned value. - ... Each iterator yields dictionaries of field values, and the factory should add a value for the current field(s). The yielded dictionaries also contain a pseudo_field `"__complete"`, that indicates whether this step is some randomized data to reach the expected count of records. A falsy value indicates that the iterator is still covering mandatory cases. This indicates whether a cartesian product is finished, or an `iterate` has consumed all its values. The order of the factories is quite important, since some computed fields may need other fields to be defined, and `cartesian` factories should always be at the beginning to avoid having too many combination. That is why the factories are given as a list of pairs instead of a dictionary; this makes it easier to insert elements at any place. Example: field A: cartesian([T, F]) field B: cartesian([0, 1]) field C: iterate([a, b, c, d, e]) field D: compute(1-B) _c is shortcut for __complete _ is a random value, or result of a random value ``` iter | root | field A | field B | field C | field D | result 0 {_c:F} {... A:T} {... B:0} {...C:a} {...D:1} T,0,a,1 complete:False {... B:1} {...C:b} {...D:0} T,1,b,0 complete:False {... A:F} {... B:0} {...C:c} {...D:1} F,0,c,1 complete:False {... B:1} {...C:d} {...D:0} F,1,d,0 complete:False 1 {_c:T} {... A:_} {... B:_} {...C:e,_c:F} {...D:_} _,_,e,_ complete:False 2 {_c:T} {... A:_} {... B:_} {...C:_} {...D:_} _,_,_,_ complete:True ``` X-original-commit: 4c0182dafa584853ed83a166096f45c33c06a245
2020-02-04[IMP] core: rename upgrades-paths to upgrade-pathXavier-Do
Since this option is soon to be used, this rename is a last tweek to make it more logical to use since it will point to a single upgrade dir most of the time. closes odoo/odoo#44593 X-original-commit: 1c8e2809fb296abce6114b7da906d48a240df418 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-11-21[FIX] scaffold: clean the templates:Denis Ledoux
- Add blank lines at end of python files (pep8) - Easier uncomment (entire blocks, and no remaining whitespaces in empty lines) - Add `_description` to model to avoid the warning telling it's missing - Correct compute field, `self.value` raised an `ensure_one` issue - Change access so the user can add/edit/delete records in the web interface by default - Correct the server action, `self` is not in the server action context. closes odoo/odoo#40659 X-original-commit: 622615771d0a6f8544f6810f30df46aea0e0fb9c Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2019-11-19[IMP] base: explicitly pass parameters for translation methodsMartin Trigaux
Instead of relying on the context content, pass explicit values for overwrite and create_empty_translations applu this to trans_load and trans_load_data Adapt the test that was trying to create empty translations.
2019-10-24[FIX] command: typo in unknown command exit messageAdrien Horgnies
closes odoo/odoo#39260 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-10-03[FIX] v13 urlsmreficent
Was still pointing to old links closes odoo/odoo#37859 Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2019-09-16[IMP] module.py: deprecate openerpJulien Castiaux
[PEP-594] is deprecating the `imp` module, that module is used in `module.py` in order to dynamically import addons using any of the `odoo.addons` or `openerp.addons` import anchor. We are deprecating `openerp` module/addons imports in v13 in order to remove the support in v14 and greatly simplify how modules/addons are loaded. If you are still using the old `import openerp` or `import openerp.addons`, `import odoo` and `import odoo.addons` are drop-in replacements. The `odoo.modules.module.ad_paths` addon paths list has been deprecated too. The list is now accessible on `odoo.addons.__path__` where they are now directly loaded [2]. See also: [PEP-594]: https://python.org/dev/peps/pep-0594/ [2]: https://packaging.python.org/guides/packaging-namespace-packages/ closes odoo/odoo#36597 Task: 2003936 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-08-05[IMP] ORM: Add new --upgrades-paths CLI optionLaurent Contzen
This commit adds a new way to use upgrades scripts folders whithout needing to symlink them to an hardcoded path. The folders specified in --upgrades-paths is then being used by migration.py to find and execute migrations scripts per module specified in the -u CLI option. The folder needs to have the following structure: - <upgrades_paths folder 1> - <module1 name> - <version1> - <script1> - <script2> - ... - <scriptn> - <version2> - <scripts> - <module2 name> - <versions> - <scripts> - ... - <upgrades_paths folder 2> - ... Update odoo/tools/config.py Co-Authored-By: Olivier Dony <odony@users.noreply.github.com>
2018-11-14[FIX] base_import_module, cli: deployNicolas Martinelli
The use of the `deploy` command always fails because of an incorrect CSRF token since commit 9bae56acd4ebe2b1. Indeed, the latter re-introduces the session rotation, i.e. the session ID is changed at authentication. Practically, what happens server-side is: - authentication - generate CSRF token - create the response with the token and a change of session ID At this point, the token generated is not correct anymore since it is based on the 'old' session ID. Therefore, when it is reused at uploading, an error is raised. It is actually possible to simplify the process by performing the authentication and the file upload in a single request. There is indeed no real use of extracting the authentication, since the request is then only used to upload the module. opw-1902863 closes odoo/odoo#28653
2018-10-17[FIX] doc: correct links to categoriesSwapnesh Shah
Was pointing to a file that no longer exists Fixes odoo/odoo#27741 closes odoo/odoo#27755
2018-09-24[IMP] core: require install mode for db bootstrapOlivier Dony
The registry loading system should not alter databases unless it is asked to do so, by a module installation or update instruction. This property should hold true as well for database bootstrap, and this is what this commit changes.. In order to avoid any behavior change for command-line users, an implicit `-i base` is assumed when starting the server from the command-line with `-d <db>`, causing the db boostrap to happen if the database did not exist yet.
2018-08-21[IMP] cli: allows to run odoo with openshiftAkram Ben Aissi
For containers using random uids[1], use the higher level method getpass.getuser which as the same effect but also looks consider the environment variables to determine the user name. Details from http://blog.dscpl.com.au/2015/12/unknown-user-when-running-docker.html CLA signature for akram Closes #26452 [1] openshift or docker as explained at http://blog.dscpl.com.au/2015/12/random-user-ids-when-running-docker.html
2018-04-18[REF] odoo: adapt scaffolding templatesqsm-odoo
2018-02-05[MERGE] forward port branch 11.0 up to aed8f453467Christophe Simonis
2018-02-05[MERGE] forward port branch saas-16 up to b503e79722aChristophe Simonis
2018-02-05[MERGE] forward port branch saas-15 up to 81003c82e0aChristophe Simonis
2018-02-05[MERGE] forward port branch 9.0 up to b08185fc66aChristophe Simonis
2017-11-09[IMP] server,db: coherently handle PGUSER env variableChristophe Monniez
When Odoo is started with a db_user using 'postgres', the process exits with a status 1. However, this can be bypassed when the PGUSER environment variable is used. This commit will prevent the usage of the 'postgres' for the environment variable too. Also, when trying to list db's, various methods where used to find a suitable postgres user to get this list. In fact, as the db cursor is available, a user is already at work. So, in order to avoid code duplication (e.g. verify user from environment variables), this commit removes those various method and get the db user from the cursor.
2017-10-30[FIX] core: mode of output file for t9n exportxmo-odoo
trans_export has been decided to use a *bytes* output buffer as some of the output formats are text-ish (e.g. po) but others are definitely binary content (e.g. XML). Therefore, when calling trans_export with a *file*, it needs to be open in *binary mode*. Fixes #20555
2017-09-20[FIX] odoo shell: P3 compatibility when reading script from stdinChristophe Simonis
2017-08-20[FIX] P3: CSV reading & writingXavier Morel
2017-07-31[MERGE] forward port branch saas-16 up to 09d698d05faChristophe Simonis
2017-07-31[MERGE] forward port branch saas-15 up to a6900c43b44Christophe Simonis
2017-07-31[FIX] server: don't crash in case we can't check if a database existsFabien Meghazi
In case Postresgl access rights prevents the pguser to access `pg_database`, the server should not crash when trying to create the database because the pguser does not have the right to check if the database exists and he won't be able to create a new database anyway. However the database might exists and in such a case the flow should continue. This patch allows the flow to be resumed in such a case, and in case the database did not actually exists, a warning will tell the user that it was not possible to check if the db existed and the registry for this database will fail to be loaded afterward.
2017-07-03[FIX] scaffold: small fix in templateFabien Pinckaers
2017-05-12[FIX] P3: exec keyword -> builtin functionXavier Morel
2017-05-11[FIX] P3: metaclasses handlingxmo-odoo
* cross-version metaclass spec * more formally deprecate browse_record and browse_null since they were using metaclasses anyway * update docstrings referencing the latter
2017-05-10[FIX] P3: list -> iterable builtins (#16811)xmo-odoo
In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
2017-04-28[FIX] Various P3-related import changesxmo-odoo
* LDAP import: python-ldap is not python3-compatible, pyldap is Warning: only supported from debian Stretch (current testing)? https://packages.debian.org/search?searchon=names&keywords=pyldap * implicitly relative imports * imports of moved or removed stdlib modules issue #8530
2017-04-25[FIX] print statement -> functionxmo-odoo
In Python 3, ``print`` becomes a builtin function. This is available in Python 2 by importing the ``print_function`` feature from ``__future__``, the feature is conveniently still available in Python 3 (it just does nothing). Fixers: libfuturize.fixes.fix_print_with_import #8530
2017-04-25[MERGE] forward port branch saas-15 up to ab68a1c6740Christophe Simonis
2017-04-21[IMP] cli: extract the project's path from active virtualenv (closes: #16512)Daniel Reis
The start command takes the default dbname from the path. But when running inside a virtualenv, it is a better default to take the dbname from the virtualenv's path.
2017-04-18[MERGE] forward port branch saas-15 up to 780064ea89dChristophe Simonis
2017-04-14[FIX] odoo-bin shell: force rollback on exitChristophe Simonis
Each REPL python shell behave differently depending on the exit method. Force a rollback at the end to avoid inconsitent behavior. Thanks to Harry Jollenbeck for the report: https://www.odoo.com/groups/59/26318707
2017-04-11[#8530] convert exception handlers to except..as syntaxXavier Morel
Futurize fixers: * lib2to3.fixes.fix_except
2016-11-14[FIX] cli: correct link to module categories fileUku Lagle
As the folder openerp no longer exists Closes #14263
2016-11-14[FIX] cli: correct templates for scafoldYenthe V.G
Convert openerp to odoo Closes #14129
2016-09-30[FIX] core: handle gevent on command line correctlyChristophe Simonis
2016-09-30[REF] cli: renamed .rc configuration fileSimon Lejeune
A fallback for .openerp_serverrc has been implemented. If both are present, Odoo will crash and report.
2016-09-30[REF] cli: rename odoo.py to setup_dev.pySimon Lejeune
and move it under the setup package. Since the rename of the openerp directory into odoo, having a script named "odoo.py" conflicts with a package named "odoo".
2016-09-19[ADD] shell: add support for more REPLs in shell modeFabien Meghazi
2016-09-07[FIX] in all python code, rename `openerp` to `odoo`Raphael Collet
2016-09-05[IMP] support v10 manifest file naming conventionOlivier Dony
- As of v10, manifest files should be named `__manifest__.py` - For backwards-compatibility, __openerp__.py manifest files will still be supported for the time being - Limited refactoring, to add support for the 2 different naming conventions - All textual references to __openerp_.py updated in documentation and examples
2016-09-02[FIX] odoo: rename imports and adapt import hooksRaphael Collet
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet