summaryrefslogtreecommitdiff
path: root/odoo
AgeCommit message (Collapse)Author
2025-02-08[FIX] base: prevent error on duplicating multiple recordsaamo-odoo
This error occurs when attempting to duplicate two actions in 'Server Actions'. Steps to reproduce: - Search 'Server Actions' - Select any two Actions and 'Duplicate' Traceback: ValueError: Expected singleton: ir.actions.server(606, 701) After this commit: We are now able to duplicate multiple records. sentry-6218495006 closes odoo/odoo#194118 Signed-off-by: Raphael Collet <rco@odoo.com>
2025-02-07[FIX] odoo/tools: error processing Factur-X XMLJulia Elizondo
closes odoo/odoo#196599 X-original-commit: cfe602426aac9ddb446de1e265062cd8d0c990bc Related: odoo/enterprise#78598 Signed-off-by: Laurent Smet (las) <las@odoo.com>
2025-02-06[IMP] delivery: update `hs_code` field help text and pot filesMohammad Abdulmoneim
Since HS Code field is now also used in USPS connector, the help text of `hs_code` field on `product_template` needs to be updated. Also the POT file containing module titles and descriptions is updated. Task-3759325 closes odoo/odoo#196770 X-original-commit: bcd172900049d1a24e3b9ac15030c0b1e8661558 Related: odoo/enterprise#78698 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Mohammad Abdulmoneim (abdu) <abdu@odoo.com>
2025-02-06[IMP] base: add python 3.13 support for safe_evalFlorian Vranckx
This commit adds python 3.13 opcodes that would be necessary to use safe_eval and qweb closes odoo/odoo#196794 X-original-commit: 594e4afffe6f9f6ab14de82622ccd10e9f23d4d6 Signed-off-by: Walravens Mathieu (wama) <wama@odoo.com> Signed-off-by: Florian Vranckx (flvr) <flvr@odoo.com>
2025-02-05[FIX] core: event more private `_model_classes`Mathieu Walravens
This attribute is an internal optimisation of the ORM to fasten the loading of the registry. It is in no way meant to be part of the API and be used by developers in modules. opw-4548156
2025-02-05[FIX] http: remove cache headers in static files for wkhtmltopdfHubert Van De Walle
Steps to reproduce ================== - Activate the assets debug mode - Print a report => The footer is missing Cause of the issue ================== The sames fonts are used in the header and footer. A first request is made ```http GET /web/static/fonts/lato/Lato-Reg-webfont.woff HTTP/1.1 Accept: */* Cookie: REDACTED Connection: Keep-Alive Accept-Encoding: gzip Accept-Language: en-US,* User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) wkhtmltopdf Safari/534.34 HTTP/1.0 200 OK Server: Werkzeug/2.0.2 Python/3.11.11 Etag: "1710849406-32964-706485214" Expires: Tue, 28 Jan 2025 13:18:36 GMT Content-Disposition: inline; filename=Lato-Bla-webfont.woff Content-Type: application/font-woff Date: Tue, 28 Jan 2025 13:18:36 GMT Last-Modified: Tue, 19 Mar 2024 11:56:46 GMT Content-Length: 32964 Cache-Control: no-cache, max-age=0 Accept-Ranges: bytes ``` The second request from the footer is ```http GET /web/static/fonts/lato/Lato-Reg-webfont.woff HTTP/1.1 Cache-Control: no-cache Pragma: no-cache If-Modified-Since: Tue, 19 Mar 2024 11:56:46 GMT User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) wkhtmltopdf Safari/534.34 Cookie: REDACTED Connection: Keep-Alive Accept-Encoding: gzip If-None-Match: "1710849406-32964-706485214" Accept: */* Accept-Language: en-US,* HTTP/1.0 304 NOT MODIFIED Server: Werkzeug/2.0.2 Python/3.11.11 Date: Tue, 28 Jan 2025 13:18:36 GMT Accept-Ranges: bytes Content-Disposition: inline; filename=Lato-Bla-webfont.woff Cache-Control: no-cache, max-age=0 Expires: Tue, 28 Jan 2025 13:18:36 GMT Etag: "1710849406-32964-706485214" ``` When running wkhtmltopdf manually, we obtain the following output: ``` Warning: Received createRequest signal on a disposed ResourceObject's NetworkAccessManager. This might be an indication of an iframe taking too long to load. ``` This indicates that wkhtmltopdf is not handling the cache headers correctly and fails to recognize the fact that it should reuse the previously received version of the file. Solution ======== In production, odoo should run behind a reverse proxy that handles static files, and the debug assets mode should not be used. Nevertheless, since wkhtmltopdf misinterprets cache headers, we simply remove them in case opw-4413445 closes odoo/odoo#196346 X-original-commit: fa592893642ceb9f2dbfa2d0a34a5970a685dc06 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com> Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2025-02-03[FIX] core: log useful connection closesNicolas Martinelli
On a server with low activity, the log is bloated with messages containing `[...] Closed 0 connections`. It is only useful to know if a connection was closed, so we skip logging otherwise. closes odoo/odoo#196204 X-original-commit: 628847715b71359f8e1250c154de289cec231737 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2025-02-03[FIX] rpc: re-raise exceptions for http.pyKrzysztof Magusiak (krma)
Exceptions in RPC are handled and a Response is returned directly. It is a different behaviour than jsonrpc where the exception is raised and the dispatcher wraps it is a Response after logging the exception. The xmlrpc code should also raise an exception so that it can be handled in http.py. Adding here a way to detect if a Response was already generated for an exception in the exception handler of HTTP. closes odoo/odoo#194693 Related: #193208 X-original-commit: c660dad74ed9a967371f48374269dfe23b305f00 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2025-02-03[FIX] base: Fix a traceback with the partner merging wizardYannis Burkhalter
Before this commit, the partner merging wizard doesn't support fields of type reference, because this type of file is never used by Odoo on model res.partner. This will never happend in native Odoo, but some external addons can trigger this traceback. closes odoo/odoo#196014 X-original-commit: b5c6b1b35b59c43c2809ee57a6cd88ac5de7e1e7 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2025-02-03[FIX] base: fallback first currency ratewilliam-andre
When creating a new database or activating a new currency, the first rate fetched will often be set only starting "today". This can lead to issues when creating invoices in the past, especially if the conversion rate is very different from 1. Instead of only using a fallback on 1, we also fallback on the oldest rate in the database if available. closes odoo/odoo#195520 X-original-commit: 4243bb88cf0b31c5ab85f92ddcf60670d2c0230b Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
2025-02-03[FIX] core: restrict policy cloneMathieu Walravens
Restrict developers to use private attributes of the policy class of the stdlib email to have a better control of the API allowed to be used by developers opw-4539555
2025-02-02[FIX] core: copy urllib poolmanager pool classesMathieu Walravens
To have a similar behavior for both `pool_classes_by_scheme` and `key_fn_by_scheme` https://github.com/urllib3/urllib3/blob/0e7e0df0586573d51c78076d4871050783bec7c8/src/urllib3/poolmanager.py#L213-L214 opw-4522337
2025-02-02[I18N] Update translation terms from TransifexOdoo Translation Bot
2025-01-31[FIX] base,web: save update_related_model_idBruno Boi
Before this commit, the resource_ref field of a server action can disappear when the action is saved. This is due to the following: - the update_related_model_id is a computed stored READONLY field which leads to it not being included in the web_save rpc and is therefore not saved on the record The fix consists to ensure the update_related_model_id is saved by making it readonly=False, which is usually what we want when we have a computed stored field. closes odoo/odoo#195367 Task: opw-4513803 X-original-commit: 13f95cf90b0e77e44f924afec98116ee7cf341d7 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com> Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2025-01-31[FIX] base: prevent branding on wrapped nodes identified by xpath($0)Serge Bayet (seba)
The $0 placeholder in templates is highly useful, but it is not considered when saving a view. For instance, the search icon in the shop search bar has an incorrect xpath: `/data/xpath[3]/form/t[1]/div[1]/button[1]/i[1]`, where the inner `t[1]` actually points to another view through a `<t>$0</t>` containing the inherited view. The method responsible for handling this replacement fails when the element is editable, causing a crash. This commit ensures that when an xpath jumps to another template, it disallows the branding. task-3609835 closes odoo/odoo#195875 X-original-commit: 64e43e52338ec8d7e08b4749b1bbeb21691419c6 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Serge Bayet (seba) <seba@odoo.com>
2025-01-30[IMP] base: improve test_uncommented_invisible_field error messagecro
closes odoo/odoo#195605 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com> Signed-off-by: Christophe Rosolino (cro) <cro@odoo.com>
2025-01-29[FIX] web: respect X2many field context when order is presentEnric Tobella
Issue: If we have a X2many that allows to have inactive records (with `context={'active_test': False}` on the field definition) and we specify a specific order for this X2many in this view, web_read won't respect the context of the field and will filter out inactive records. This is because to apply a specific order in the web_read, we use search(), which will filter out inactive records from the `corecords` recordset. Fix: We fix this by forcing active_test=False before calling search and reapplying the previous context immediately after. Closes #194311 closes odoo/odoo#195408 X-original-commit: 2205b526cb1487a5208ce96cbaa855ffb762e646 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2025-01-29[IMP] core: add allow_hierachy_operators description on FieldRémy Voet (ryv)
This commit adds a description on relational fields which indicates whether it is appropriate to use the child_of/parent_of operators on them. task-4492974 Part-of: odoo/odoo#194909 Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2025-01-29[FIX] http: multidict deepcopyMathieu Walravens
opw-4481451
2025-01-29[FIX] models: incorrect string unquoteMathieu Walravens
Before this commit: Calling `_check_company_domain` with a string will always transform it to an unquoted string, which is not alwaysintended, and result in syntax erorrs when executing SQL queries. After this commit: Do not unquote regular string and keep unquoted string as unquoted. opw-todo
2025-01-29[FIX] base: fix warning message for company checkcro
closes odoo/odoo#193918 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2025-01-29[FIX] test_lint: fix comprehension issue when assignedFlorian Vranckx
this commit add support for comprenhension expression on assign node add various pylint fixup closes odoo/odoo#195486 X-original-commit: 7ca897bb97168ac28c6218679aae3aac0c68a5ae Related: odoo/enterprise#78021 Signed-off-by: Florian Vranckx (flvr) <flvr@odoo.com>
2025-01-29[I18N] *: manually sync Greek translationsTiffany Chang (tic)
Due to the sync being broken the past 2 weeks, manually pull the Greek translations since translations have been added to it recently. closes odoo/odoo#195424 Related: odoo/enterprise#77967 Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
2025-01-27[I18N] *: re-export pot filesTiffany Chang (tic)
One had a duplicate msgid (i.e. broke the sync) and needed to be re-exported, so re-export them all to fix all other out of date pot files. closes odoo/odoo#195292 Related: odoo/enterprise#77875 Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2025-01-24[FIX] core: inherit translations better when upgradeChong Wang (cwg)
Before: The typofix feature treats terms in the old and new values with similar text content as the same term, migrating the translations of the old term to the new term. For example The old value has the mapping: 'Draft': 'Brouillon' The new value contains the term: '<span invisible="name or name_placeholder or quick_edit_mode">Draft</span>' Since the old term and the new term share the same text content, 'Draft', after `write`, the new term reuses the old translation of 'Draft'. However, the translation 'Brouillon' is always visible, unlike its en_US counterpart. This behavior is acceptable in non-upgrade mode because the user writes the en_US value and is responsible for verifying translations afterward. However, it is problematic during upgrades because users cannot easily identify which records have changed and need to be rechecked. After: 'state' is removed from MODIFIER_ATTRS since it is not customized by Odoo The translation inheritance behavior can be described as below Translations can be inherited after `write` from old terms to new terms which share the very close text contents 1. when `write` in production mode, text contents for translation terms are more important than the HTML/XML structures of them, and the old term translations should be remained as much as possible. Because * the writing user is responsible to recheck all translations after `write`. * it is easier for the writing user to copy technical HTML/XML structures than translate text contents for a language they may not know. * the feature can also be used as typofix when the only small diff is the text content 2. when `write` in upgrade time, the HTML/XML structure is more important than the text content, and the new term structure should be remained as much as possible. Because * HTML/XML structures might be changed a lot after upgrade, which may contain behavior relevant diff (e.g. `invisible`), even if text contents are not changed. * users have no idea which records' values are changed during upgrade and are hard to recheck their translations. * new terms are highly likely to be correctly translated in the latest po files which will be imported during upgrade. * the typofix feature can still be remained when the only small diff is the text content Based on the above feature analysis, we use the below new strategy 1. translations can be inherited only if the old source term and the new source term share the same HTML/XML structure 2. translations can be inherited only if the old translation term and the new source term share the same HTML/XML structure 3. when translations are inherited, MODIFIER_ATTRS will be synchronized with the new source term, other attributes will be copied from the source term if available. closes odoo/odoo#195055 Forward-port-of: #194181 X-original-commit: 90aa858c271a45a862ea7c6bc38cb7b928db99a3 Signed-off-by: Raphael Collet <rco@odoo.com> Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2025-01-23[IMP] odoo: add config for cron connection timeWilliam Braeckman
Adds a configuration that can be used to mitigate PostgreSQL transactional errors with long-living connections and the `LISTEN/NOTIFY`[1] functionality by re-establishing the database connection periodically. In the case that a connection outlives the transaction wraparound[2] mechanism of postgres, the `LISTEN/NOTIFY` internal queue might contain references to transactions that have already been deleted by the system's (or a manual) `VACUUM`[3] as it has its own transaction validity mechanisms (roughly comparing transaction ids). This can be reproduced by: - Triggering a wraparound _AND_ cleaning of pg_xact between the cron's `LISTEN` + `COMMIT` and its recyling. - Having done at least one `NOTIFY` during that time period (?). - Try to `LISTEN` to the same channel on the same database (transaction id must be < than the first connection's transaction id). The following is an example error message: ``` ERROR database odoo.service.server: Worker (3194772) Exception occurred, exiting... Traceback (most recent call last): File "/home/user/odoo/service/server.py", line 1089, in run self.start() File "/home/user/odoo/service/server.py", line 1235, in start self.dbcursor.commit() File "/home/user/odoo/sql_db.py", line 480, in commit result = self._cnx.commit() ^^^^^^^^^^^^^^^^^^ psycopg2.errors.UndefinedFile: could not access status of transaction 1194816979 DETAIL: Could not open file "pg_xact/0473": No such file or directory. ``` [1: LISTEN/NOTIFY](https://www.postgresql.org/docs/current/sql-notify.html) [2: wraparound](https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND) [3: VACUUM](https://www.postgresql.org/docs/17/sql-vacuum.html) [LISTEN/NOTIFY code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c) [Connection being kept](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L2167-L2191) [See more](https://www.postgresql.org/message-id/flat/VE1PR03MB531295B1BDCFE422441B15FD92499%40VE1PR03MB5312.eurprd03.prod.outlook.com#7e36d1fdca921b5292e92c7017984ffa) closes odoo/odoo#194937 X-original-commit: 278ce01fe1882ea424032dcf97c4d345816be96e Related: odoo/documentation#11835 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com> Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2025-01-23[FIX] mail,base: avoid creep in tag_quoteRenaud Thiry
Since html_normalize is now run multiple times on the same body in mail it has become apparent that the heuristics for tag_quote are not suited to multiple passes on the same body. tag_quote is used to detect and tag nodes in a document that are likely mail signatures. So that they may be hidden in the front-end. The detection of the signature using the "-- <br>" sets the parent of the element where is is detected to be a "quote container". However a quote container will set all of its children to be quotes too. If the signature is in the main div of the email, as is the case in most templates this means the whole content is marked as being inside a "quote container". Because the processing of the elements is done in order of their appearance in the document, this does not lead to the entire document becoming a quote the first time html_normalize is called. As the signature is typically the last element, the "container" attribute is only set after the whole body was already processed. However if the body is normalized again, the main div is now marked as a "quote container" and the whole body becomes a quote. - `<div><p>body</p><div>--<br>John</div></div>` - `<div quote-container><p>body</p><div quote>--<br quote>John</div></div>` - `<div quote-container><p quote>body</p><div quote>--<br quote>John</div></div>` We now check whether a quoted sibling exists in the container before marking a node as "quote". All nodes following the original quote and their children will be quoted as before, all nodes before will not be quoted anymore. triggered by 24731938f75358fd3c72b91465b72ab80d62d208 task-4381505 Part-of: odoo/odoo#194722 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2025-01-23[IMP] mail: quote blank spacesRenaud Thiry
Blank spaces following a quoted node should also be quoted. This avoids having long trailing spaces below a signature and having unquoted blank spaces between two quoted blocks task-4381505 X-original-commit: 118b1a26eee9e2187adfdb324196ec1e08da8709 Part-of: odoo/odoo#194722 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2025-01-23[IMP] mail: improve quote reply detectionRenaud Thiry
We update quote detection for gmail and outlook: - gmail has simple wrapper divs with explicit classes - outlook has a mix of div ids and simple pattern-based quoting (everything under "<hr><div id="divRplyFwdMsg"/> seems to be considered a quote) Previously gmail just used blockquote, which still works but does not capture "On xx:xx:xx X <X@gmail.com> wrote:" headers, which are caught for outlook. Previously outlook had a wrapper div around divRplyFwdMsg which would set data-o-mail-quote-container on it, and propagate to children. However it seems that outer div was either removed or is not always present, a heuristic is thus needed. task-4381505 X-original-commit: 34f19e4c0518f359856974209bc4c8670477af59 Part-of: odoo/odoo#194722 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2025-01-23[FIX] cli/*: fix script converting tree to list (regression)Gorash
since the pr https://github.com/odoo/odoo/pull/189883, the file updates made are not consistent: 'list<editable="bottom">'. closes odoo/odoo#194319 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2025-01-21[IMP] core: disable downloading during toursXavier Morel
It's not *entirely* clear which and when, but some tours apparently trigger downloads, which by default will make a mess of the user's Downloads folder when running tests locally. This has mostly been observed in 18.0 / master with Studio exports but there are a few others as well (e.g. a few reports). Either way, seems like a good idea to just configure chrome to block them. closes odoo/odoo#194486 X-original-commit: 4d57b5408239a8492e58153675d688c387d3bc28 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2025-01-21[IMP] cli: allow to bypass obfuscate confirmation (for scripts)Laurent Desausoi
closes odoo/odoo#194212 X-original-commit: d82f0168857c5dffeb24ab6cf0786141e7e2779c Signed-off-by: Fabien Meghazi (fme) <fme@odoo.com> Signed-off-by: Laurent Desausoi (lade) <lade@odoo.com>
2025-01-21[FIX] test_http: missing tagged post-installJulien Castiaux
closes odoo/odoo#193832 closes odoo/odoo#194034 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2025-01-21[FIX] test_http: call new_test_user in setUpClassJulien Castiaux
new_test_user must hash the provided password, which can take up to 1 full second on a slow laptop. Calling the function in setUp makes running the tests painfully slow, calling the function in a setUpClass instead speeds everything up. Part-of: odoo/odoo#194034 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2025-01-20[FIX] core: http.route accepts any Iterable, not only listJulien Castiaux
The docstring of `@route` states that it accepts any iterable for the `route` and `methods` argument, but several places in the source code wrongly expected a list, and broke if it was a tuple. closes odoo/odoo#193869 X-original-commit: a97a2232e1dec1a8a318df562d8e5b19779a33d9 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2025-01-20[FIX] base: no-demo for TestQwebFieldContactRémy Voet (ryv)
'TestQwebFieldContact' used a demo to work, but we want to test independent of demo data. closes odoo/odoo#194120 X-original-commit: a49ab2d5a23185155c05ff61ef1fa5d07b857218 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2025-01-19[I18N] Update translation terms from TransifexOdoo Translation Bot
2025-01-17[FIX] core: JS tests / tours needing focusXavier Morel
Apparently in normal mode (and thus the new headless mode) Chrome does not focus the document. The `activeElement` is correctly set, but `document.hasFocus()` always returns `false` and per-element focus events are suppressed. That makes tests testing or needing focus fail in the new headless mode as well as well as impossible (or at least frustrating) to `debug`. Enabling "focus emulation", which corresponds to the "Emulate a focused page" UI option, seems to resolve the issue. Fixes reliably failing tests - `/im_livechat:ExternalTestSuite.test_external_livechat` - `/account:TestUI.test_01_account_tax_groups_tour` - `/account_accountant:TestBankRecWidget.test_tour_bank_rec_widget` - `/web_editor:TestOdooEditor.test_odoo_editor_suite` Backport of: odoo/odoo@0aaf98b77feaa15f5eb30e1c251f5765e8afbfa5 closes odoo/odoo#194161 X-original-commit: fa22211d92b66a12f351122d74f2f9f132f6662b Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com> Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2025-01-16[FIX] base: allow automated actions to link m2m fieldsLevi Siuzdak (sile)
Versions -------- - 16.0 (fix issue) - 17.0+ (skip useless constraint) Commit 3871ae2c6c45 enabled automated m2m CRUD in 17.0+ Steps ----- 1. Create an automated action on a Model with tags (e.g. Contact); 2. set trigger to On Creation; 3. in data to write, have evaluation type to Value; 4. fill in the value (e.g. 1); 5. create a record that would trigger the automation. Issue ----- > ValueError: Wrong value for res.partner.category_id: 1 Cause ----- In the `eval_value` method, the `many2many` type doesn't get covered. Solution -------- 1. Have `eval_value` handle `many2many` values (linking them to relevant record, and existing as a single expression per column). 2. Undo 09a6df204f2a which disallowed writing by reference for many2many fields. This change makes writing by reference possible as well, and allows you to select the desired record, instead of having to manually fill in its ID. opw-4054461 closes odoo/odoo#193855 X-original-commit: a2223e12c79125de190c629f9d3be00124f3288b Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com> Signed-off-by: Levi Siuzdak <sile@odoo.com>
2025-01-16[FIX] tests: use devtools emulated devices for Chrome viewport sizePierre Paridans
To run tours or unit tests, we instrument Chrome and run it headlessly. One of the arguments passed while doing so is the "window size" it needs to use to emulate desktop-like or mobile-like screen sizes. Newer versions of Chrome sometimes introduce slight variation between the Chrome's window size and its viewport size (due to changes in the interface layout...). While often not a deal-breaker, Chrome 128 forces a min-width for the window greater than the breakpoint we use for smaller/mobile-like testing (e.g. 375px, which matches a small smartphone). This commit changes the way we instrument Chrome to use a specific size by using the DevTools' Emulated Device (aka. "responsive mode"). It allows to apply a very specific viewport's size independently of the actual Chrome's window size, which makes it way more predictable than before. Note: this change is part of the preparation to support the "new" headless mode, which becomes the default starting with Chrome 128. Reference: - https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride closes odoo/odoo#193876 X-original-commit: 0b9a0f6a674bda00f3329eb590bb968e7de362d0 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2025-01-16[FIX] core: fix inverse x2many field in create()Rémy Voet (ryv)
If we have an inverse method on a stored x2many field, calling create({..., 'x2many': [Command.create({...})]}) returns a record X, for which X.x2many is a recordset with 2 records: one with a real id, and one with a NewId without origin. This is wrong on at least two levels: we have two records instead of one, and it breaks an implicit invariants of the ORM: don't mix real and new ids in the same recordset. The reason for this behavior is that the field value is pushed to the cache before calling its inverse method, and the conversion of the command creates a new record. To avoid this issue, we don't call _update_cache() for stored fields because we are sure that the cache has already been set in _create() and not invalidated by modified(). closes odoo/odoo#193256 Related: odoo/enterprise#77012 Signed-off-by: Raphael Collet <rco@odoo.com>
2025-01-15[FIX] core: fix typofix translationChong Wang (cwg)
The get_text_content is not powerful enough to extract translated attributes. As a result, get_text_content will return empty string '' for terms whose translated contents are only in attributes. When the result is used to build the mapping text2terms, users will get strange result after write. opw-4147913 closes odoo/odoo#193678 X-original-commit: 4133952a9e1d37b8ff9c5bdd6f0da38e5b5c72f1 Signed-off-by: Raphael Collet <rco@odoo.com> Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
2025-01-14[FIX] base: fix access error to currencies when in child companyArnaud Sibille
Steps to reproduce (db with Accounting installed): - create a child company - give a user (e.g. Marc Demo) access to the child company, set their "Accounting" rights to "Accountant" and "Administration" to None. - log as this user and select only the child company in the company selector. - try to access "Accounting/Configuration/Accounting/Currencies" -> Access Error It is happening as in the `res.currency` model, several methods try to access the root company, but there's only the child company in `allowed_company_ids` from the context. The fix here is to: 1) When accessing the root company in order the get its currency, just access the currency of the child company, as it is the same. 2) Use sudo when accessing other fields from the root company. opw-4352595 closes odoo/odoo#192982 X-original-commit: e46c77a004ef723090e1491dc28a41200a990500 Signed-off-by: William André (wan) <wan@odoo.com>
2025-01-14[FIX] base: website is not shown in the contact qweb widgetRémy Voet (ryv)
Steps to reproduce: - Render the Contact qweb widget with fields ["phone", "website"] ```py Contact = self.env["ir.qweb.field.contact"] partner = self.env["res.partner"].create( { "name": "Test Partner", "phone": "1234567890", "website": "https://www.example.com", } ) result = Contact.value_to_html(partner, {"fields": ["phone", "website"]}) ``` Result: - The website is not shown This is a regression introduced in 9e53aea, in combination with some buggy behavior in the qweb compilation. Somehow the `t-elif` condition is applying on the next element instead on itself, hiding the website element. I did not investigate further to find the root cause, though. Switching to a `t-if` condition works around the issue. closes odoo/odoo#193461 X-original-commit: 8263316 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2025-01-13[FIX] tools,spreadsheet_dashboard_*: export all spreadsheet translationsDylan Kiss (dyki)
Currently, the extractor looking for terms to translate in spreadsheet files was specifically looking for files ending in "_spreadsheet.json". However, since this version there were new spreadsheets added that ended in "_spreadsheet.osheet.json". The translation extractor couldn't find these and the terms were never extracted, resulting in missing translations. This commit searches for both filename patterns to export the terms. We also make sure that file references are only extracted once per term per file. closes odoo/odoo#193054 X-original-commit: c0443a6383c5160c2eb46e36b2e96f7d8bfa8474 Related: odoo/enterprise#76820 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2025-01-13[FIX] base, mail, *: fix issues with avatar routeSébastien Theys
* = im_livechat, portal, test_discuss_full, test_mail, web Validating access in controllers based on generic queries is slow, so it needs to be removed. It also grants more access than necessary, effectively making some avatars fully public depending on hard to track states or relations, when it only needs to be available in a specific context. Access could be validated with more specific queries instead, for example for a specific thread. While that solves the biggest performance issue, it's still not the fastest, but more importantly it requires a lot of contextual info to be forwarded to the route. And having one route per thread removes the ability to cache the avatar between various context (in particular from one channel to the next). Also avatar are not always displayed in the context of threads, so it doesn't fully resolve the issue and requires to think about more conditions and more contexts. The generic token of the target record could be used when it exists, but the token could be used to leak other information (portal, ...), and it doesn't always exist. This commit introduces a solution resolving all issues, with almost no drawback. The access is granted through a token which is specific to displaying the avatar. The token is only given when necessary, so minimal access is granted in all cases. The token is the same in all contexts, allowing caching. Validating the token is much faster than making queries. The token has an expiration date to minimize data access in time, but it can be refreshed at any time if the user can still access the source of the token. closes odoo/odoo#187799 Related: odoo/enterprise#74167 Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2025-01-13[FIX] base: no properties in server action pathNicolas Lempereur
Scenario: create a server action that updates a properties Result: traceback error is raised Issue: server action does not handle updating record properties Fix: ignore the error in _stringify_path method, so the more legible ValidationError from _traverse_path is raised instead. Note: without the fix, the added test failed with "KeyError: 'discussion_color_code'", with the fix it doesn't fail (and there is a "ValidationError: 'The path to the field to update contains a non-relational field (attributes) that is not the last field in …'"). opw-4339633 closes odoo/odoo#193313 X-original-commit: f7bf7fb3be37e9efca6062a8255ec44a1ee54c6f Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com> Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2024-11-11[IMP] base: replace frozendict by ReadonlyDictMathieu Walravens
opw-4475143
2025-01-12[I18N] Update translation terms from TransifexOdoo Translation Bot
2025-01-11[FIX] base: append suffix to duplicated server action nameElijah Tay (elct)
Before this commit: When a user duplicates a server action, the new action retains the exact same name as the original. After this commit: Duplicated server actions are assigned a name with the suffix "(copy)" to differentiate them from the original action. closes odoo/odoo#193258 X-original-commit: 70640a5bcb0cb316147a6f65c97ce6b4a1da7034 Signed-off-by: Raphael Collet <rco@odoo.com> Signed-off-by: Elijah Chong Tay (elct) <elct@odoo.com>