summaryrefslogtreecommitdiff
path: root/odoo/tools/misc.py
AgeCommit message (Collapse)Author
2018-11-29[REM] pycompat: remove python 2 shims and helpersAdrian Torres
Odoo no longer supports python 2, thus some of these helpers can and have been replaced by python 3 built-ins, therefore there is no need for them to stay defined. The removed helpers are: * izip, imap and ifilter * unichr, text_type * implements_to_string, implements_iterator * string_types, integer_types * to_native The python 2 shims have also been removed, and only the python 3 helpers have been kept, because they can still be usable (i.e. accepting both bytes and str for functions that can only accept one of the two) [REM] pyjsparser: remove PY3 shims They're no longer necessary as Odoo doesn't officially support python 2 anymore. closes odoo/odoo#28519
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2018-09-05[FIX] mail: Avoid using default value for track fields loggingToufik Benjaa
- When a tracked field is modified, a mail.message is created. When create is called its tries to fill missing values with "default values". It first tries to find the default values in the context, which may occurs. For example, modifying a tracked field on a subtask will add a key "default_parent_id" in the context, which is the parent_id of the project.task. Create will try to use "default_parent_id" for the mail.message parent_id field, which make the SQL Request invalid.
2018-08-14[MERGE] forward port branch 11.0 up to 51225c9b9f2Christophe Simonis
2018-08-14[MERGE] forward port branch saas-15 up to 52e88036f25Christophe Simonis
2018-08-14[MERGE] forward port branch saas-14 up to d4ee30b4facChristophe Simonis
2018-08-13[FIX] tools: formatLang should use cached langXavier ALT
2018-08-07[MERGE] forward port branch 11.0 up to ced9156a97eChristophe Simonis
2018-08-07[MERGE] forward port branch saas-14 up to 0c5cbbe0bb4Christophe Simonis
2018-07-23[MERGE] forward port branch 11.0 up to 219d2296d67Christophe Simonis
2018-07-19[FIX] undefined variables (potential nameerror)Xavier Morel
Backport 9ec0455abc041b855dcab18e8e185baf806b9f14 and 6a601fe6dc848cdeca2ab8429210e3b5087275d9 as they fixed various possible NameError but did so in later sub-releases.
2018-07-23[FIX] base: always preload dateutilOlivier Dony
The dateutil package uses lazy import to selectively expose its features: `parser`, `relativedelta`, `rrule`, `tz`. Depending on installed modules and order of initialization, there was no guarantee that a given feature was already loaded during the preparation of the action context. This patch ensures that we always preload the feature set we need, and only that feature set. This way we have a consistent `dateutil` lib in the action context at all times.
2018-07-23[FIX] base: always preload dateutilOlivier Dony
The dateutil package uses lazy import to selectively expose its features: `parser`, `relativedelta`, `rrule`, `tz`. Depending on installed modules and order of initialization, there was no guarantee that a given feature was already loaded during the preparation of the action context. This patch ensures that we always preload the feature set we need, and only that feature set. This way we have a consistent `dateutil` lib in the action context at all times.
2018-06-15[MERGE] forward port branch 11.0 up to b05e4d5f958Christophe Simonis
2018-06-13[MERGE] forward port branch saas-15 up to bdd051bf782Christophe Simonis
2018-06-13[MERGE] forward port branch saas-14 up to c43c5401725Christophe Simonis
2018-01-25[FIX] tools: align API of `groupby` on the one of `itertools.groupby`Raphael Collet
The function `stripped_sys_argv` was broken because of `itertools.groupby` being hidden by the local `groupby`. Aligning APIs makes the local one a valid substitution for `itertools.groupby`.
2018-01-23[FIX] models: behavior with multiple inverse/compute mixed on same fieldsRaphael Collet
2018-01-23[IMP] api: make the implementation of field protection more robustRaphael Collet
2018-01-11[MOV] mail: reorder a bit mail thread methods by categoryThibault Delavallée
As this class has grown a lot some methods have been put a bit anywhere in the file. To prepare future improvements it is easier to regroup them a bit. remove_accent from mail_alias is also moved to tools in order to separate tools from business or class specific code.
2017-12-01[MERGE] forward port branch 11.0 up to c201cf2b77cChristophe Simonis
2017-11-29[FIX] anonymization: P3 encoding issuesOlivier Laurent
2017-11-28[FIX] tools: fix location of res.lang.csv fileThibault Delavallée
It has been moved inside base/data insteaf of base/res. Let us adapt code calling it.
2017-11-16[MERGE] forward port branch 11.0 up to d279a3e6d57Christophe Simonis
2017-11-16[MERGE] forward port branch saas-16 up to 745d00362abChristophe Simonis
2017-11-15[MERGE] forward port branch saas-15 up to 73e4dacf78aChristophe Simonis
2017-11-15[MERGE] forward port branch saas-14 up to 0bf7ab45119Christophe Simonis
2017-11-15[FIX] tools: lang in formatLangNicolas Martinelli
- Install French language - Set language of Customer A to French - Create an invoice due in the past - Open the Customer Statements The customer statement of A is translated in French, but the amounts are formatted in the company's user language (English by default). We add the possiblity to take into account the lang in the context when calling `formatLang`.
2017-10-25[IMP] tools: basic spelling and grammar correctionsAndrew Latham
Closes #20391
2017-10-03[FIX] misc: Force utf-8 decoding when opening a fileChristophe Monniez
2017-09-25[IMP] tools.dumpstack: show extra thread infoOlivier Dony
By using the thread's repr() we get its type, name, daemon status and ID, all at one time. No need to include them separately. Fall back to the threadId in case the repr() is empty, which can happen for exotic threads (the gevent main thread seems to be like that)
2017-09-06[MERGE] forward port branch saas-16 up to 64d56995e04Christophe Simonis
2017-09-04[MERGE] forward port branch saas-15 up to 4d4d75709dcChristophe Simonis
2017-09-04[MERGE] forward port branch saas-14 up to 99426b95b5aChristophe Simonis
2017-08-31[FIX] tools: empty nameAdrien Peiffer (ACSONE)
Check if name isn't empty before executing regex. xlsxwriter can handle an empty name. opw-769163 Closes #18877
2017-08-20[FIX] P3: remove pycompat.{keys,items,values} helpersOlivier Dony
Now that we're closer to switching to P3 for good, these helpers have outlived their usefulness, and mostly add noise. All remaining dict.iter*() or dict.view*() must be converted to the normal keys(), values() or items() calls. Whenever the result is likely to be used for more than the scope of a loop, or when the dict needs to be modified during iteration, the calls must be wrapped in a ``list()``, to protect the new P3 semantics. Those cases are very exceptional. Also removed some dead code or improved the API to remove unnecessary conversions.
2017-08-20[FIX] P3: CSV reading & writingXavier Morel
2017-08-20[FIX] P3: text/binary handlingXavier Morel
* unichr -> pycompat (builtin removed from Python 3, ``chr`` has become unicode-aware) * Psycopg2 bytea values (binary fields) are returned as memoryviews in P3 but buffers in P2 * Both bytes and (text) strings are conventionally iterable in P3 (they have a __iter__ method), so fix up the exclusion pattern for flatten
2017-08-20[FIX] P3: text model typesXavier Morel
* remove references to basestring & unicode (use relevant pycompat helpers) * remove some str calls (either entirely or replaced by relevant helper, either text or native) * use better API to avoid unnecessary conversions * remove some XML declarations in views
2017-08-10[MERGE] forward port branch saas-16 up to 85571bb78c9Christophe Simonis
2017-08-10[MERGE] forward port branch saas-15 up to dde62073bafChristophe Simonis
2017-08-09[MERGE] forward port branch saas-14 up to 80ac087d6e9Christophe Simonis
2017-08-03[IMP] http: improve dumpstacks and remaining requests handling during tests ↵Fabien Meghazi
(#18640) This patch modifies Root#dispatch() in order to keep the httprequest url in the current thread's attribute and use if for dumpstacks and the phantomjs tests remaining requests handling. Also added a counter in order to avoid looping forever when trying to join unclosed http requests in phantomjs test suite after a phantomjs failure + added a log.warning in such a case so it's easier to troubleshoot runbot's ir.logging.
2017-07-07[MERGE] forward port branch saas-16 up to 0f2b2c4e2b9Christophe Simonis
2017-07-07[MERGE] forward port branch saas-15 up to 514a1a76d81Christophe Simonis
2017-07-07[MERGE] forward port branch saas-14 up to 5b285707693Christophe Simonis
2017-07-07[FIX] tools: ensure xlsx worksheet names are validChristophe Monniez
When xlsx is used, the worksheet name may be longer than 31 chars and raise an exception. This fix will troncate the name up to 31 chars and will remove invalid chars. Similar patch was already done at 0122c05eff95 for xlwt xlsxwriter 0.9.8 has added a parameter worksheet_class=None so adding **kw to be compatible with installs with the latest version (requirements.txt asks for version 0.9.3) Closes #18077 opw-751157
2017-06-26[FIX] P3: Unpickler.find_global -> Unpickler.find_classXavier Morel
2017-06-06[MERGE] forward port branch saas-16 up to 6f3eada2c3aChristophe Simonis
2017-06-06[MERGE] forward port branch saas-15 up to f687a27b79eChristophe Simonis