summaryrefslogtreecommitdiff
path: root/odoo/netsvc.py
AgeCommit message (Collapse)Author
2021-04-29[FIX] core: avoid deprecation warning in requests_toolbeltChristophe Monniez
The requests_toolbelt package < 0.9 uses `from collections import ...` which is deprecated in python 3.8 [0]. The request_toolbelt package is not a dependency of Odoo but is needed by zeep [1]. Unfortunately, the Ubuntu python3-requests-toolbelt package is still 0.8 [2]. This commit filters out the warning. [0] https://github.com/requests/toolbelt/commit/979f95266c2044893b05cb2314e94c899915748c [1] https://packages.ubuntu.com/focal/python3-zeep [2] https://packages.ubuntu.com/focal/python3-requests-toolbelt closes odoo/odoo#70137 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-03-05[FIX] core: avoid astroid imp module deprecation warningChristophe Monniez
The astroid package where version is lower than 2.5.1 uses imports the `imp` module that was deprecated in python 3.4 [0]. In Debian buster, astroid version is 2.1.0 and 2.3.3 in Ubuntu Focal. With this commit, the deprecation warning is filtered out. Note that pylint 2.5 avoid that deprecated import [1], that's the reason why the warning was not showing on current runbot Docker image. [0] https://docs.python.org/3/library/imp.html [1] https://github.com/PyCQA/pylint/commit/51c646bf70a6e0a86492bfd2ddd1885671d64d67 closes odoo/odoo#67308 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-11-27[IMP] requirements: resolve compatibility issues for 3.8 and 3.9Xavier Morel
Only updates outdated requirements which actively cause issues: * freezegun broken in 3.8 (removal of time.clock) * xlrd broken in 3.8 (removal of time.clock) * also monkeypatches xlrd.xlsx for 3.9 (removal of Element.getiterator, breaks because of defusedxml) * jinja triggers DeprecationWarning in 3.8 * pillow triggers warning in 3.9 * lxml, greenlet don't compile in 3.9 * reportlab doesn't work in 3.9 New versions try to match those of Debian Bullseye. Also adds a script to more easily compare dependency versions between the requirements files and what's in various distributions (currently supports checking against debian and ubuntu). Furthermore updates warnings filtering: * removes xlrd (mischeck was monkeypatched as noted above) * removes setuptools (was for older versions, one would hope this isn't an issue anymore) * adds babel: python-babel/babel#684 fixes the deprecation warning but is not part of any release yet * ignores error related to `random.sample` on a set, this is a diagnostics bug because recordsets implement both Sequence and Set, and the stdlib checks for Set first (bpo-42470) See #59980 Closes #61103 closes odoo/odoo#62380 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-10-27[FIX] core: avoid ofxparse DeprecationWarningThomas Dieuzeide
In current Debian version (0.19) ofxparse gives the following warning: ofxparse/ofxparse.py:40: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working return isinstance(candidate, collections.Iterable) Since we can't do anything about it, we filter it for now. ofxparse already fixed it https://github.com/jseutter/ofxparse/issues/155 A Debian bug report has been opened https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973055 closes odoo/odoo#60805 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-27[FIX] core: log full path in ir_logging when using postgresql handlerChristophe Monniez
When the PostgreSQLHandler is used to store some logs in the ir_logging table of a database, the log record pathname is truncated to keep only the relevant part of the path. In some circumstances, the path is wrongly truncated, leading to totally invalid paths. e.g.: When using an addon-path like `/data/build/enteprise` the removed part correspond to the length of `/data/build/odoo/`. The resulting path is `prise/....`. With this commit, the full path is kept. This commit is mainly a fix for the runbot logs and should not have an impact on existing databases. closes odoo/odoo#50246 X-original-commit: f3c96aa21ad0d8756fadc1608107438ba8cd6c05 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-04-22[FIX] core: improve warnings configurationXavier Morel
DeprecationWarning was configured as `once` which might be why I missed some previously: `once` means the *filter* will only signal once, meaning only one DeprecationWarning gets shown per run. Even if there are 5 *completely different* warnings getting generated by the codebase. `default` should be more suitable, I think I'd originally misunderstood it as "whatever the default is for this warning" but what it *actually* means is "print once for each (module, lineno)". An alternative could be `module` which would show the warning once per module but wouldn't trigger from different warnings in the same module.
2020-03-26[FIX] core: enable logger.runbot() when importing odoo as a libraryAdrian Torres
Before this commit, trying to use Odoo as a library without initializing the logging features would result in a crash because `Logger.runbot()` is monkey-patched inside the function `init_logger()`, which is de facto necessary for using Odoo as a lib. With this commit, we do the monkey-patch at the module-level so whenever the `netsvc` package is imported the patch is applied, which should be well before the loading of the registry starts. closes odoo/odoo#48396 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-19[FIX] core, base: leftover deprecation warningsXavier Morel
* from collections import <ABC> is deprecated, unclear why the deprecation warning didn't appear before (possibly only appears in 3.7/3.8?) either way `collections.abc` should be 3.3+ so switch everything to it. * add some more ignores on third-party packages deprecation warnings (meh) * while at it, mitigate generation of non-breaking space on some versions of Babel (in the french locale used by our tests anyway) closes odoo/odoo#47581 Related: odoo/enterprise#9214 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-16[IMP] core: improve module loading logsXavier-Do
Performances from a general point of view can be difficult to track. This commit proposes to improve logs in two ways: The current logs only use the sql_counter, wich will only be updated when a cursor is closed. In a test-enable install, this counter is actually the queries of the tests wince the install cursor is open untill the end. The first fix is to use bot sql_counter and sql_log_count to have total queries untill now on closed cursor, but also the current number of queries of the current cursor. This means that the new log format will be {nb} modules loaded in {time}, {loading_querie} (+{test_cr_queries}) queries instead of {nb} modules loaded in {time}, {tests_cr__queries}queries Nothe that in the current version, {nb} is actually the total number of loaded modules until now. This commit also add an equivalent end log by module and change the loglevel of module start on install (mainly usefull if an error occurs before anything else is logged hidding the module causing this error.) A cleaner runbot logger is also added, in order to be abble to call _logger.runbot( instead of _logger.log(25. This will clarify the purpose of such a log level. closes odoo/odoo#47283 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-02-04[IMP] enable deprecation warningsXavier Morel
2020-01-21[IMP] core: strip log_handler items before splitting themXavier Morel
Allows better formatted and commented log_handler items in configuration files: configparser allows multiline values and interspersed comments (stripping out comment lines), but while it removes indent it leaves the linebreaks, so e.g. foo = bar, # qux quux when parsed and split on "," results in `['\nbar', '\nquux']` which is obviously an issue for logging (as it assumes the leading `\n` is part of the logger name proper). Since log_handler items can be fairly long and are not necessarily self-descriptive as to *why* they were selected for re-configuration, allowing one per line & comments is helpful.
2019-12-02[REV] core: logger configuration part of ↵Xavier Morel
6044782aeffc61955b956068b0a4d58fa33303f0 Configuring the non-root logger based on --log-level had the side-effect (unclear whether it was intended or not as none of the relevant commits really documented the idea) that log-level could override log handlers being set on the root logger e.g. if `log_handler = :INFO` is set in the config file, `--log-level=warn` on the CLI will override it. This could be replicated by swapping `pseudo_config` and `logconfig`, *however* it would also make the sub-loggers override differently (currently on an exact logger match log-handler overrides log-level). The ideal fix would likely be to sequence log-level from the configuration file, log-handler from the configuration file, log-level from the CLI and log-handler from the CLI. However that doesn't really work with the current structure. closes odoo/odoo#41180 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-26[IMP] base: logging conf & logging of partner merge wizardXavier Morel
* root the base.partner.merge wizard's logger in odoo.addons so the "odoo" logger configuration properly applies to it * update the default logging configuration to set the root logger rather than independently set the odoo and werkzeug loggers closes odoo/odoo#40872 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-21[MERGE] forward port branch 12.0 up to 0e72b983c35Christophe Simonis
2019-06-21[MERGE] forward port branch saas-11.3 up to 35aeabb6477Christophe Simonis
2019-06-20[MERGE] forward port branch saas-15 up to e7fb3e2f1a2Christophe Simonis
2019-06-20[MERGE] forward port branch 10.0 up to c5c955db7acChristophe Simonis
2019-06-19[FIX] core: work around ir_logging deadlockXavier Morel
DROP CONSTRAINT (even with IF EXISTS is specified) acquires an ACCESS EXCLUSIVE lock on the table, preventing e.g. inserts in an other transaction, so ir_logging would systematically deadlock if configured to the same database and a warning would be triggered during install or update (if that ran ir.logging's init). 1. hand-roll the "IF EXISTS" bit, to avoid taking an ACCESS EXCLUSIVE lock on the table if the problematic constraint does not exist and thus doesn't need to be dropped (which by now should be the vast majority of cases). Replacing DROP CONSTRAINT with DISABLE TRIGGER does not fix the issue as *that* acquires SHARE ROW EXCLUSIVE. While that's less constraitning than ACCESS EXCLUSIVE, it still conflicts with an insert's ROW_EXCLUSIVE. 2. add a timeout to the logging INSERT anyway, the deadlock is still an issue if we're updating a database which does have the problematic constraint, and we want to preclude the possible eventual introduction of new deadlocks in the future. closes odoo/odoo#34243 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2018-11-27[REM] builtin logrotate featuresXavier Morel
It's completely FUBAR when using workers[0] and properly reimplementing it is not really worth the effort when logrotate(8) and newsyslog(8) exist (or cyclog/multilog/cronolog if you subscribe to the "logrotate and newsyslog are a design that should be consigned to history" school of thought). [0] https://stackoverflow.com/questions/34186774/why-doesnt-timedrotatingfilehandler-work-properly-and-how-to-solve-this-issuer closes odoo/odoo#29073
2018-11-08[REV] base: revert rename ir.logging type to logging_typeChristophe Monniez
This reverts commit c42a130a9892482ce72d2417f418931d2a7ecf49 and commit fb7ac56d65a0d4c634a4c9387bf25bbc229d5caa. The runbot is using cross db logging and those commit were breaking the mechanism. As a result, the master builds logs were empty. If we update the runbot to use logging_type instead, the other versions builds will be impacted hence this revert. closes odoo/odoo#28512
2018-11-07[FIX] base: logging_type remainmreficent
In fb7ac56 type field was renamed to logging_type A few were missing closes odoo/odoo#28447
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[FIX] server: fix colored query countRaphael Collet
2018-09-07[IMP] http,server: add query count and request times in logsXavierDo
When there is a performance issue, it's sometimes difficult to discover which request increased the query count or its duration. With this commit, the query count, the query time and "python and io" time are displayed in the logs at the end of each werkzeug request line. Co-authored-by: Christophe Monniez <moc@odoo.com>
2018-08-30[FIX] fatal error when trying to enable logrotateMagnus
4e5119c6e52e0364a39a7883f9df5db5441607cb didn't account for `tools.config['workers']` being `None` on windows, resulting in the entire thing crashing when trying to execute `None > 1` in Python 3. Fixes #26447
2018-05-08[MERGE] forward port branch saas-15 up to d3a040cebe1Christophe Simonis
2018-05-07[MERGE] forward port branch 10.0 up to 0aeb92ccbc7Christophe Simonis
2018-05-07[MERGE] forward port branch 9.0 up to 4e5119c6e52Christophe Simonis
2017-07-28[MERGE] forward port branch saas-16 up to b76109173a8Christophe Simonis
2017-07-28[MERGE] forward port branch saas-15 up to c0ec09e9d56Christophe Simonis
2017-07-28[MERGE] forward port branch 10.0 up to e6863851382Christophe Simonis
2017-07-27[IMP] core: capture Warnings though loggingChristophe Simonis
2017-07-26[MERGE] forward port branch saas-16 up to 46e1104ce12Christophe Simonis
2017-07-26[MERGE] forward port branch saas-15 up to 681f03e3097Christophe Simonis
2017-07-26[IMP] core: log bad queries as ERRORChristophe Simonis
Also adapt default config and config mapping.
2017-05-08[REM] odoo/report: remove deprecated stuffLaurent Smet
- RML Reports - Webkit Reports (most part already removed by 13b9982c6298021289707ed364e3c1d622a09f13) - LocalService in netsvc.py - rename attributes like rml_% to report_% - rename ir.actions.report.xml to ir.actions.report - allow rendering directly on an ir.actions.report by calling render method - remove 'controller' report_type - remove unused res.font stuff - remove print_report method in models.py (not used) - restore removed call to pdftotext process in test_reports
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
2016-11-23[REM] workflow: Remove workflow engine, documentation and testsYannick Tivisse
2016-09-02[FIX] odoo: rename imports and adapt import hooksRaphael Collet
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet