Have a piece of code that throws an Error
In browsers not powered by V8, the stack trace won't be formatted and the Error
type won't appear in the crash manager modal report.
This happens because Error.prototype.stack is non-standard, although most
browsers have an implementation of it. Chrome for example automatically formats
the Error.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Errorhttps://v8.dev/docs/stack-trace-api\#compatibility
After this commit, the Error is formatted in the crash manager report, the same
way as Chrome does it.
task-2191727
closesodoo/odoo#56318
X-original-commit: dbf670f2e0ec797aeaf998aa28b32afbdd2c3b4c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Hardik Prajapati <hap@odoo.com>
This commit adapts the BasicModel to combine calls to `default_get` and
(first) `onchange`. When creating a new record, we now only call
`onchange`, which thus return default values and potential onchange
values.
Tests (and the MockServer) have been adapted accordingly.
NOTE 1. If the `default_get` within the `onchange` returns a value for
a field that is not in the view, we ignore it, and it won't be saved.
Before, that value was kept and sent upon save. This change in behavior
may prove problematic, although the overall risk is small. Decision has
been made to keep heavy comments and code snippets if we were to revert
back somehow to the previous situation.
NOTE 2. Putting a context on a many2one field may change the value
returned by `name_get` for that field. By default, the calls to
`name_get` are done by `onchange`. If the context on a field must be
used for `name_get`, one has to set the option `always_reload` to `True`
on the field. In that case, every `onchange` that changes the value
will trigger an extra `name_get`.
NOTE 3. Suppose that a one2many field has a list view with field A, and
a form view without field A. When adding a line, we now send all known
fields (main view and inline views) to the `onchange`, which may return
a default value for A. The value will appear on the list view, but not
in the form view. The former behavior was to call `default_get` with
the fields that occur in the form view only, and therefore field A would
be left to value `False`.
NOTE 4. A test surprisingly adds an extra call to `read`. The test was
actually wrong before. With the changes in MockServer, we now correctly
receive a command `[6, false, [1]]`, whereas before we received `[1]`,
which isn't a valid command, and which was ignored. As a consequence,
an extra `read` is done, whereas the test asserts it shouldn't. But it
already didn't work before (I checked by sending the correct command).
This needs to be bugfixed elsewhere (task-id-2323491): in a o2m with a
onchange and default order records on an other page than the first
should not trigger a `read`.
Task 2261084
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
When you hover on the "Start Typing" text in autocomplete dropdown,
it will not visible as its CSS overwrite with the rule and change the text color
as white.
With this commit, we have added the css rule for specifically "Start typing"
dropdown item and its looks consistent as other dropdown items.
Task : 2311983
closesodoo/odoo#56233
X-original-commit: ee8739361830981539127b269363a6fcbfcd840c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Before this commit: if there are modifiers based on field which hides
one page and show another and if active page get invisible then instead
of first page second page gets focus, consider following example,
`<form>
<field name="boolean"/>
<page name="page1" attrs='{"invisible": [["bar", "=", false]]}'></page>
<page name="page2" attrs='{"invisible": [["bar", "=", true]]}'></page>
<page name="page3"></page>
</form>`
Consider the initial boolean value to be true; initially the first page
will be visible. But when "bar" is unchecked then page1 will be hidden
and page3 will get the focus as page2 is still not visible: it will be
after the computaion/application of all modifiers, which is currently
done after the rendering of a tab page.
Now: the first visible tab is focused on rendering (same as before) but
also after all modifiers have been updated.
closesodoo/odoo#56209
X-original-commit: 10365572aa3629e9b19d2b29726b351275de9f52
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Ipsita Borisagar <ibo@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit will add a bus in the web.config config that allows
to trigger events.
The first use case is the trigger of the size_changed event that
is triggered each time the size of the screen changed of bootstrap
breakpoint.
task-2276740
PR #53175
The "quick create" form now renders the kanban quick_create buttons on
its own. This means that the form handles them as regular form buttons,
hence including them in its keyboard navigation.
Part of task: 2314864
closesodoo/odoo#55787
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
In saas-13.4, if a searchpanel_default_XXXX value was found in the
context to be used as the default value of a searchpanel category
(select="one" field), then the value shown to be active for that
category would always be that value even if another value would have
been selected at some point. This was due to the fact that the
activeValueId was reset at each reload of the category to be that
default value.
In saas-13.5, the problem has been solved by 7ff2e5822f.
The present commit is simply the forward port of a test that covers the
situation described above.
closesodoo/odoo#56042
Task: 2259602
X-original-commit: bdf4fe44652668274030bb6fda25cb564f15c3a6
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
PURPOSE
Be able to remove some measures from graph / pivot views. Currently fields
are automatically added but some of them make no sense.
SPECIFICATIONS
Add the possibility to not display some fields in the measures dropdown for
the graph and pivot views.
When a field is not displayed in the measures of a pivot views we remove them
also from the list of groupable fields.
LINKS
Task ID-2288381
Community PR #54774
Enterprise PR odoo/enterprise#11970
Upgrade PR odoo/upgrade#1519
Currently, only List and Kanban view supports the action helper and
display the folder icon with the helper text.
With this commit we have also provided the action helper support for
other views. The logic for no content helper has been moved in
abstract_renderer.js so that it can be accessed by all views. This was
done mainly to give the action helper to the gantt view.
closesodoo/odoo#53902
Task: 2284779
Related: odoo/enterprise#11563
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit, the action helper (if any) was not displayed when
archiving all records of the last non empty column of a kanban view
(making empty that view).
With the present commit, the action helper is now correctly displayed in
that situation.
Task ID: 2247788
closesodoo/odoo#50557
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
/web/action/load is the public controller that Should be used by the
webclient to fetch actions
_for_xml_id is the default access method on actions that implements
fields filtering to avoid leaking server action code or other
information not needed by the webclient
Implementing whitelist of fields that can be access per model
New module for supporting two-factor authentication via time-base
one-time-password (TOTP).
Users (including portal users) can choose to enable two-factor auth in
their user account settings, by scanning a QR code and adding it to an
authenticator app, such as Google Auth, 1Password, etc.
When two-factor is enabled, password-based non-interactive RPC is only
possible by using API keys.
Co-authored-by: Olivier Dony <odo@odoo.com>
Follow-up on 6edb749534, where default
`autocomplete` values were introduced as default for password fields,
according to the new autofill specs.
This patch allows developers to force the "autocomplete" attribute value
on password fields, in case there really is a need for a value that is
not `new-password` (which BTW now triggers the password generator wizard
in many browsers).
It is useful for example when a backend form really needs to ask the
user for their current password, so the correct `autocomplete`
value is `current-password`, as on the login form.
Before this, invalidations to the UID cache is not synchronised
between workers because it's an ad-hoc solution (so a user changing
their password or an admin disabling a user would only lock out an
attacker currently using the API of one of possibly several
workers). Shift the entire thing to ormcache which already has proper
support for synchronising cache invalidation between workers.
Also simplify the cache invalidation mess in Users.write because the
caches have been unified into a single registry-level LRU, so the
half-dozen cache clears on specific ormcached methods & models is
pretty much the same as repeatedly calling clear_caches on the current
model.
**However** registry.cache is trivially accessible from server actions
and safe_eval as long as they provide access to a model (through
`model.pool.cache`). Which is common, and an issue given we're very
much putting sensible data in there.
Fix this by renaming `Registry.cache` to `Registry.__cache`, this
requires few editions and mangled names are not accessible from
safe_eval contexts.
The alternative would have been to add more bespoke handling of the
uid cache to hook it into the cache invalidation propagation
machinery.
After discussion with (@)odony, fixing LRU access and using that seems
cleaner and less error-prone.
Note on lazy_property
=====================
Make Registry.cache / Registry.__cache into a regular attribute: the
overhead of the LRU is not that high (compared to that of the registry
itself), it's rare that we *don't* need it, and it's assumed to be a
persisted attribute (it's not just a cache) so making it a normal
attribute seems fine; and lazy_property doesn't work for mangled
names: the name of the property is mangled using the name of the
definition class, but the name of the symbol (fget) is not mangled so
lazy_property would set the __cache attribute but then Python would
lookup _Registry__cache, creating a new cache every access.
And we can't (always) mangle things correctly on `__get__(obj,
owner)`: `owner` is just `type(obj)`, meaning in the case of
inheritance the type we get is the type through which the property is
accessed rather than the one it's defined on. So it would work in the
cases where no inheritance is involved (such as Registry.__cache) but
not in general (lest we want to play around walking the MRO ourselves
to find the definition source, which doesn't seem worth it).
lazy_property *could* be made to work properly on Python 3.6+: the
descriptor protocol gains `__set_name__(name, owner)`, which is called
with the properly mangled name — and with the definition class to boot
(though there might still be issues when overriding lazy properties as
the override will be mangled & named differently... or maybe that's a
feature?). However we're still supporting 3.5 at this point, AFAIK, so
that's not an option. Plus it feels unnecessary / not very useful.
However add an assertion to `lazy_property` so it signals when we try
to use it on a mangled method (as otherwise it kinda sorta work in the
sense that the property / object is accessible but is in effect a
slower way to write a regular property).
Add an option to display the language selection inline or with a
dropdown. Add an option to choose if language labels are flags, text
or both.
Part of https://github.com/odoo/odoo/pull/55300
task-2203383
Co-authored-by: qsm-odoo <qsm@odoo.com>
In pivot view, a cell data is determined by his row/column key which
are the value chain of field values to get to that row/column.
If you had a grouping with value in a cell and then close the grouping,
you could somehow get the old value back wrongly on next grouping
operations.
This happened because:
- the key was computed based on the value (eg. for relational field the
record ID) but without the field name.
- succeeding read_group only fill existing values.
eg. If on pivot view we had a salesperson with same ID as product
category, if we closed salesperson grouping then opened product
category grouping, we could possibly get the cell value to the product
category that has the same ID as the salesperson.
With this changeset, we clear the cell data corresponding to a grouping
that has been closed.
Added test without the fix would fail by displaying data of a previous
read_group that should have been cleared inbetween.
opw-2262306
closes#55129closesodoo/odoo#55936
X-original-commit: f1df73adca4955561814d4b8e90a62d7d50c1c33
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Before this commit, click on the divider in the menu 'Measures' of the
pivot control panel would cause a crash. The present commit fixes that
situation.
We also bring another small correction: the menu won't close if one
clicks on the measure list but not exactly on a menu item or the
divider.
closesodoo/odoo#55902
X-original-commit: aad9f3fd7499ef8b660cc25fea840a34d70f75a6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Improve mock server:
- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data
Other changes done in mail (or dependents) that are not just related to tests:
- remove `direct_partner` from formatter result
->`correspondent` can be computed from other keys, especially `members`
- fix `livechat_visitor` convertData
-> only process if there is value
- add `current_partner` and `current_user_id` as `init_messaging` result
-> easier to mock than session
- remove usage of `need_moderation`
-> that was just a search indirection to `moderation_status`
- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
-> to be consistent with field name
- add name in result of `mail_partner_format`
-> sometimes display_name is not the same
- remove usage of `is_moderator`
-> that was just an indirection to `moderation_channel_ids`
Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171
closesodoo/odoo#55854
X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
With this commit, the timezone (in the user's preferences) is
automatically set to the timezone of its browser the first time
this user logs in.
Task 2207715
closesodoo/odoo#55726
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Before this commit, the field badge could overflow from its boundaries
and have part of its pill/text hidden.
Now, the "overflow" mixin has been applied and the badge is properly
contained.
closesodoo/odoo#55806
X-original-commit: f4b672bfcf21c7c7f0b6071a8dd18bd6e966266b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
A previous commit has paved the way for displaying sample data in the
reporting views. The present commit brings the required changes in
community to have sample data in dashboard views.
Task ID: 2282196
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
A previous commit has paved the way for displaying sample data in the
reporting views. The present commit brings the required changes to have
sample data in pivot views.
Task ID: 2282196
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
A previous commit has paved the way for displaying sample data in the
reporting views. The present commit brings the required changes to have
sample data in graph views.
Task ID: 2282196
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
The present commit brings the global changes necessary to have sample
data in the reporting views. This includes several modifications/
fixes of the sample server (many of them for better visual results).
Task ID: 2282196
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
This commit changes the API of the SampleServer's mock
registry s.t. one can register a mocked version of a method,
whatever the model. The former API required a specific
model to be specified, and only applied on this model.
However, in order to enable the sample data feature on the
cohort view, the 'get_cohort_data' method needs to be
mocked, whatever the concerned model.
One can now register mocked methods for a specific
model only (with key 'model/method') or for every
models (with key 'method').
Task ID: 2282196
The SampleServer picks a random value for selection fields. As a
consequence, field 'activity_exception_decoration' is always set,
either to 'warning' or 'danger'. When this field is set, widget
'ListActivity' (set on 'activity_ids') displays 'Warning', whatever
the value of 'activity_ids'. This means that with sample data, the
next activity field always displays "Warning", which is not great.
This special case has been handled in web, as it is the first (and
only) one. In the future, if we have to implement several special
cases like that, we'll setup a proper hook to allow external
modules to define them from the outside.
Task 2316726
closesodoo/odoo#55703
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Before this commit, the search panel was subject to some inconsistencies
when dealing with a category having enabled counters and with a filter
defining a "domain" attribute. Indeed, the counters could be in an
incorrect state if the right filters/categories were not loaded first,
with no simple way in doing so.
The search panel being complex enough as it is, we decided to disable
all categories' counters in the presence of a filter having a "domain"
attribute regardless of said domain.
closesodoo/odoo#55734
X-original-commit: e78f777bd8ccb314b85451cbc8d1dd9109997d7a
Related: odoo/enterprise#12341
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit adds smart date inputs for date and datetime fields.
The goal of smart date input is to provide the user some shortcuts
when setting dates.
The rule is [+-]\d+[dwmy]?
So we can enter inputs like:
+3 to have today + 3 days
-2w to have today - 2 weeks
+1y to have today + 1 year
+5m to have today + 5 months
-4d to have today - 4 days
closesodoo/odoo#55602
Task: 2270347
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Form sheet with hidden overflow (added to improve ribbon widget css) prevents
emoji button from showing emoji list when clicked. This commit attempts to
show the complete emoji dropdown by removing overflow from the sheet container.
IMPORTANT : This override won't affect ribbon since the hidden overflow was
added on the widget itself.
Task ID-2224393
PR #49096
This commit adds the parameter `scales` in the calendar view's template.
This parameter can be used to choose which mode(s) is/are allowed.
This commit also refactors the way we manage calendar scales.
Before scales were defined in model and renderer, now it's defined
in the view and given to model, controller and renderer by params.
Task: 2193921
This commit reworks the mini calendar's style to make it look like
the months in year mode.
It also reworks the style of the calendar's popover in modes day,
week and month to reduce the differences with the year popover.
Task: 2193921
This commit adds a new year scale to the calendar view.
It comes with a new view in the calendar, this view displays a
4x3 grid which cells are month views.
Task: 2193921
This commit optimizes calendar view especially for year mode
- remove/add events has replaced by an event source and refetch.
- do not re-render events when navigating date
Task: 2193921
before this commit, when change view from graph view to pivot view or any other
view and come back to graph view, Measures button disappear, it's only
appearing if we refresh the page.
after this commit, restore previous view state when switching back to graph
view, this was because measures button is rendered in fragment and when
switching between views, as graph view element was destroyed and re-rendered
so measures button will be mounted in fragment as update method of
ComponentWrapper will render it from previous mountArgs, so to avoid this issue
push measures element in DOM.
task-2250051
closesodoo/odoo#55666
X-original-commit: 40c709fb0abe7721d1650af9bd1d17dc8453895a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit, the "fields" object given to the control panel was
altered by the view (e.g. dashboard populates it with its aggregates).
As a result the control panel and its subcomponents had an altered
object with more or less fields than expected.
Now, the initial "fields" object is given to avoid such problems.
Task 2312074
closesodoo/odoo#55640
X-original-commit: 472b314614dc3dd9db880f4cb60c2eda89cce6b4
Related: odoo/enterprise#12310
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Having maps in its state, the search panel has to serialise its state
before sending it via exportState. Before this commit, this was done
on the state object in place, causing issues if the model was restored
without an imported state (no re-serialisation hence having a wrong
state).
Now, the exported object is deep-copied from the original state.
Task 2312131
closesodoo/odoo#55393
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
PURPOSE
Before this commit, when you used the 'image' widget when the record name was
``..`` (double dots) it couldn't retrieve the image since the double dots was
decoded as the parent directory shortcut. After this commit, the double dots
will be replaced by -- with the downside to loose the true record name.
SPECIFICATIONS
Replace the .. (double dots) with -- in the filename.
Using .. may seem like a strange use case but if you actually try to find
a partner called ".." in a production database, you might be surprised ...
LINKS
Task ID-2241513 (eLearning onboarding and testing)
PR #55567
X-original-commit: dcb7a924c36cd3f3aeef891ddd8830bd66322025
From the Sale app create a new Quotation with a long customer
reference. Click on "Save" and then Print.
In the generated report the fields relative to the order details are not
correctly displayed: the general font size is scaled down to make the
text fit the page which is not the correct behavior.
The font size should remain fixed and all the element
should be visible, eventually spanning over multiple lines.
This is due to the broken bootstrap support of QtWebKit, used by
wkhtmltopdf to generate pdf reports.
In particular the new flexbox style introduced in the library is not
supported and every element based on it will be ill-displayed.
The solution is to fall back to the subset of supported features to
implement a different solution, which keep everything on one line but
avoid the font resizing and every possible overflow.
opw-2261573
closesodoo/odoo#55555
X-original-commit: 2dd3ed327aad6fecdcfd4b53c4338bf47e44401b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Issue
- Sales > Create a quotation
- Click on quotation date or start
writing in it
On chrome, if addresses autocomplete is enable
and have data to show, a dropdown will overflow
on the datepicker
Cause
This is mainly a chrome issue and the only way
to solve it without a fix is to disable the
autocomplete totally which is not really a
solution since we want the autocomplete on
adresses
Solution
Add the autocomplete off on datepicker field
OPW-2308278
closesodoo/odoo#55470
X-original-commit: b40fef968ab000870574ae45ba482288cdf94ad1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Currently, when form view is opened in edit mode and if you proceed
through the tab(keyboard) then focus is skiped on radio field.
For Ex: in project when you procceed through the tab it will skip the
visibility field radio.
The issue occurs because the radio is inherited from the selection
field and in selection field the focus is set on 'select' while
there is no method to set the focus in radio and radio does not have
'select' element it has 'input'
So in this commit, override the method getFocusableElement in radio
widget and set the focus on 'input' instead of 'select'.
closes odoo/odoo#52073
Taskid: 2252798
Closes: #52073
Related: odoo/upgrade#1430
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
With this commit, the FormRenderer no longer directly extends
the WidgetAdapterMixin. It doesn't need to as its parent class
(the BasicRenderer) already uses it. Worse, they both called
WidgetAdapterMixin.on_attach_callback, and thus mounted
was called twice on Components in form views.
closesodoo/odoo#55401
X-original-commit: 4c627abd310a131a4828e9ee6be451aeee4708db
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit handles two things:
1) Move the local storage logic of the search panel into the documents
module.
2) This allows for a variety of optimisations now that we do not have to
constantly wait for a potential default value hidden in the storage.
This is why this commit also introduces a way for the search panel model
extension to sometimes return its query informations sooner than after
being completely loaded.
Task 2284207
The loading of the action model extensions have been split in this
commit:
- when calling load, a first promise is returned. It is meant to be
resolved as soon as all the query informations are available.
- a second promise returned by a new method "isReady" is resolved when
all of the extension data have been fetched.
This difference allow to not wait for server calls irrelevant for the
query. By default "isReady" will always wait for a full load call, but
this is meant to be overridden in case optimisations can be made.