render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id
Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
Issue
- Install Contacts
- Add a tag on a contact like:
"LongTagName_Forcepaymentcomplement"
and give it a color
- Go back to kanban view
- Resize your window
With some sizes, the tag gets out of
the kanban box
Cause
The tag is moved under the color ball
when it is too long with some resolution
But there is others resolutions where
the tag is too long even if it is moved
to the next line
Solution
Add word-break: all which will force the
tags to break if it is too long.
OPW-2251780
closesodoo/odoo#51243
X-original-commit: 2ac6a8f289fd498794a4e5407eace0e0cd18df4c
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Have two x2many lists in a group in a form view. Increase the
width of a column in the first table. Before this commit, the
second table was also expanded.
task-2189968
closesodoo/odoo#47652
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
In a form view, have an x2many list with two fields A and B (e.g.
A is a many2one, and B is a char). There is an onchange on the
x2many that is triggered when the user sets A, and that sets B.
In this scenario, let's assume that the user first writes something
in B, but directly deletes it. Then, he sets A. Before this commit,
in this situation, B wasn't updated with the value returned by the
onchange.
Indeed, B's field widget was still flagged as 'isDirty', because
the user interacted with it, but it didn't commit its value, as it
hasn't actually changed. Basically, it remained flagged as 'isDirty'
forever, and thus couldn't be updated with the value returned by
the onchange.
This commit ensures that the 'isDirty' status is correctly updated
when the change is actually undone.
Task 1958793
closesodoo/odoo#51085
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: pka-odoo <pka@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
In a form view, have an x2many list with two fields A and B (e.g.
A is a many2one, and B is a char). There is an onchange on the
x2many that is triggered when the user sets A, and that sets B.
In this scenario, let's assume that the user first writes something
in B, but directly deletes it. Then, he sets A. In this situation,
B isn't updated with the value returned by the onchange.
Commit [1] is an attempt to fix this, but it actually broke what
has been done in [2]. However, tests of [2] still passed, because
they didn't accurately reproduce what happens in practice (outside
the test environment).
An input field widget listens to 'input' and 'change' events. It
commits its value when both occur, but in the 'input' case, the
action is debounced with a large value (so that it actually only
commits the value on 'change', i.e. when the field is focusset
out). In the tests, the debounce value is 0, so fields actually
commit their value directly when 'input' events occur. This is
something we may want to change in the future, to remove this
discrepancy.
This commit adds a test with a large debounce value, so that we
accurately test what happens in practice, and we make sure that
this won't be broken in an attempt of fixing something else.
[1] cdca11db2ec207363df1d4fb3c87014d9c931d25
[2] a71f223702
Related to task 1958793
Issue
- Install Projects
- All Tasks > Form View
- Edit the view
- Set statusbar clickable to '0'
Still clickable
Cause
In relational_field.js we do
`!!'0'` which returns true
like `!!'anythingelse'`
Solution
Add a '+' which will convert
the value into an integer
for a better conversion.
OPW-2235311
closesodoo/odoo#51083
X-original-commit: 53cc68fce32f46a0b4bc83a1e73a5d13a60fc995
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Before this commit: A problem occurs with kanban views that are not
groupable (i.e. for which searchMenuTypes does not contain 'groupBy'):
if the action has a default groupby (set in Studio for instance) then
it is still applied and causes crashes. That happens in the documents
kanban view for instance.
More generally, if a view is not groupable, some information on groupbys
can appear in the interface (in a facet) while not used/useful
for the view.
After this commit:
- if a kanban view is not groupable, a default groupby will never be
applied.
- if a view is not groupable, we ensures that
- the search query generated in the control panel has
groupBy = [],
- groupbys cannot be represented in a facet.
closesodoo/odoo#51041
X-original-commit: 91c80291e90127792623476d8997fd2a67569170
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
before this commit,
tabbing into the date or datetime field input it has only focus, value is not
selected.
after this commit,
navigate through a view in edit mode with the TAB key, when focus comes into
date/dateetime field input then input is focused and value of date/datetime
field is also get selected.
task-2246593
closesodoo/odoo#51062
X-original-commit: 962e4e18b559d90aa3456c77035659ac8017501d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Before this commit, it wasn't possible to multi-edit boolean
fields in list views. Actually, it didn't work for fields rendered
by Owl components. It only impacted boolean fields because it was
the only editable field widget that had already been converted in
Owl.
It didn't work because of three issues:
1) there is some sort of an hack in basic renderers: we set the
attribute '__node' on the field widgets, and this attribute is
used for instance by the controller, when it has to handle a
multi-edition. It tries to read it from the event's target
(typically the field widget). However, with owl components,
'__node' was set on the FieldWrapper (wrapping the actual
Field Component).
2) the original target (the Owl Component which triggered the
event) was lost when the event went through the compatibility
layer (for owl Component embedded in legacy widgets).
3) the multi-edition confirm dialog didn't handle Owl field
components.
Task 2254717
closesodoo/odoo#51044
X-original-commit: 36d23cfcdef3cea3539004ee5bb4479b859b8137
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Write something in a many2one field, and click on 'Create "..."'
to quick create a record with the given value (name_create). When
the name_create fails (e.g. because there are mandatory fields in
the model), we open a form view.
Before this commit, when this happened for many2one fields inside
x2many editable lists, it crashed, since [1].
[1] 50bf8309f8closesodoo/odoo#50948
X-original-commit: 43c513306094444ff25ad98584b426ddb8a3b525
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
... when there is no data and user clicks anywhere in the no content
helper.
Task 2239617
Co-authored-by: Jinal Patel <jip@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Issue
- Install sale_renting
- Create a rental order
- Add a "rental" product
- In Modal, change start or end time
In Firefox, user not allowed to change the time;
time select not reacting well.
Cause
The issue seems to be that in bootstrap when
we click outside a modal, we focus on the modal:
https://github.com/odoo/odoo/blob/27f67bfcb903/addons/web/static/lib/bootstrap/js/modal.js#L332-L337
and the FieldDateRange widget contains a <select/> tag
and is added outside of the modal, so when we click
on the select, bootstrap will focus on the modal which
in firefox seems to lose the focus on the <select/>
which get closed.
Solution
not propagating focusin event when the select of the
daterange widget is focused => in my opinion this is
the less risky solution, this could be done with a
code such as (in the FieldDateRange._renderEdit method):
opw-2240220
closesodoo/odoo#50906
X-original-commit: 5a1e9e32061996ca1770c9ae9b5a7e7f53c5048f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
In the sign application, it appeared that when using the default signature
in a signature SignItem that was higher the stroke at the bottom was doubbled.
This was caused by the fact that the bottom stroke is always added to the
template and that the default signature image had it already.
In order to solve this, we have added a setting 'show-stroke' that allows
controlling the stroke presence in the signature.
Task Id 2216067
Closes#48529
Related odoo/enterprise#9538
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
* A step has been added to the sale tour in order to ask the user
to update the company data. As a page reload breaks the tour test
we need to prevent it in such situation.
TaskID :2187222
closesodoo/odoo#46167
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Having _lt in the env doesn't make much sense, as it is useless
at run time, and it would incite people to require 'web.env' to
use it (at load time). The env should never be directly imported,
it is automatically propagated from parents to children.
To sum up, in Owl components:
- when terms have to be translated at run time (e.g. in a function
called when the user clicks on a button), the env is available
and env._t must be used
- when terms have to be translated at load time (e.g. a JS module
defining a component with a translatable static property), one
must require 'web.translation' and use function _lt it exports.
closesodoo/odoo#50656
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit introduces several changes in the search panel with
respect to record counts:
- the record counts are now also available for
the fields with select="one" attribute
(if not disabled explicitely).
- the record counts are better computed using the idea that
selected values within a group should not impact the counts
for the group values but only the counts for the other
group values.
On the way we have changed two keys in the values returned
by the server:
- 'count' becomes '__count'.
It has been done to avoid a possible clash in case a model would
have a field named 'count' and that the field values would be
wanted for some reason.
- 'name' (multi case) becomes 'display_name'.
It has been done in order to make the select one and multi cases
more similar and factorize some code.
TASK-ID: 2166814
Co-authored-by: Raphaël Collet <rco@openerp.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Alexis Lacroix <laa@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.
This commit improves the dialog that opens when a user clicks out
of an 'un-commited' many2one. It is no longer possible to edit
the value, and the sentence has been reworded.
closesodoo/odoo#49528
Task: 2234212
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In the search panel, if a select multi was grouped by a field that can
take the value 'false' (like a char field), that value would be confused
with the value false and the group 'false' would never be
displayed (its values would be put in the group false).
This commit avoids that situation by using JSON.stringify instead of
the implicit stringification done when using a value as an object key.
closesodoo/odoo#50647
X-original-commit: 5b19e6c13b636d108e8aa1a09f01124fdb38a577
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
If set, this value will be displayed as column name in list views.
This attribute could be used in the future in form view for the
same purpose.
Part of task 2195254
This widget is an extension of Many2OneAvatar, designed for
many2one fields pointing to the 'res.users' model, or a model having
itself a many2one field pointing to 'res.partner'.
With this widget, when the avatar is clicked, we open a DM chat
window with the corresponding partner. If the user clicked on itself,
we open a blank chat window for the sake of consistency.
In kanban views, this widget only displays the avatar.
Part of task 2195254
In readonly, this widget displays the image of the related record
next to its display_name. In edit, it behaves exactly like the
regular many2one.
Part of task 2195254
This widget can be used on date and datetime fields. In readonly,
it displays the delta (in days) between the value of the field and
today. In edit, it behaves like a regular date(time) widget.
Part of task 2195254
Have a list view with "badge" field component and 'decoration-xxx'
attributes (on that field). Before this commit, it flickered when
the user refreshed the list (for instance, by clicking on the list
icon in the view switcher). The badges were displayed with a grey
background (i.e. no decoration) for a brief moment, before their
style was applied.
Their style is applied in the mounted hook, which is called by
'on_attach_callback' (legacy version of mounted). However, the list
renderer computes its column widths in 'on_attach_callback', which
produces a repaint.
This commit moves this operation to the end of on_attach_callback,
such that other processing (like applying the badges style) is done
before the repaint.
This new field component displays the field's value inside a
bootstrap pill badge. Supported field types are 'char', 'selection'
and 'many2one'. The background color of the badge can be customized
by using the decoration-xxx mechanism, e.g.
<field name="state" decoration-danger="state == 'cancel'" widget="badge"/>
Part of task 2195254
This commit refactors the way the decoration-xxx attributes are
applied to field widgets/components, in a way that it can be
overridden in a given field or component to generate the approriate
className. By default, 'decoration-x' applies className 'text-x'.
This will be necessary for the new 'FieldBadge' component, which
needs to apply 'bg-x' classNames instead of 'text-x'.
Part of task 2195254
In list views, one can specify decoration-XXX attributes on the
arch root node. Those decorations are evaluated for each record,
and the corresponding style is applied on rows for which the
condition is true.
This commit allows to specify those decoration-XXX attributes on
field nodes as well. In this case, when the condition is met by a
record, only the field on which the attribute is set will be
impacted.
Part of task 2195254
Buttons with icon and string attributes now have both their icon
and string displayed, whereas before only the icon was displayed
(the string was available as title).
We also force class btn-link to style buttons with icon, except if
another btn-xxx class is explicitely provided.
Part of task 2195254
In the pivot view, groups comming from many read_group are assemble
to create the header hierarchies and the table.
Groups returned by the read_group may be already sorted by the server
using the order set on the model for instance and that order should
be reflected in the header hierarchies (and in the table).
It is important to keep that order since it might not be possible
to recreate it in the interface. Even if possible it might not be a
good idea for performance reasons.
Before this commit:
The groups are added in a JS object, whose keys are the group ids
(when grouping on a many2one at least). Then, to generate the table,
we iterate over the keys of that object, but those keys are sorted
according to the numerical order (not the insertion order),
because keys are kind of numeric.
See https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order.
After this commit:
Instead of a JS object, we use a Map for which the insertion order
is used (official spec).
Task ID: 2243416
closesodoo/odoo#50551
X-original-commit: 1a9a85c8b8d0f47c3c6f3878cd6d9401ddc3ad75
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Issue
- Install CRM
- CRM > Reports > Activities
- Add a custom filter > Created on
- Select the date
You can't, the date picker is not shown
Cause
Actually, the date picker is shown but
very quickly and it is closed by a scroll
event thrown by Chart.js.
Solution
Close the date picker only if the user
scrolls manually.
OPW-2245019
closesodoo/odoo#50482
X-original-commit: bda320052ac937f5bc17c7da81d84633d72a8370
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Revision on 7ecae33571
Commit above introduced activity widget on partner kanban, but
unintentionally affected style of all other kanban views that have
details on kanban record.
This commit fixes the issue by applying special CSS rule only on
partner kanban view, so that other kanban views remain unaffected.
Task-Id 2237638
closesodoo/odoo#50474
X-original-commit: b0ef12bc0bcdb29ffc7e61f1a1a185248650283c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This reverts commit 715ef9fc2684dc875cf82ee312f20575ed42f94d.
Purpose of commit above was to fix an issue in kanban view
CSS introduced by 7ecae33571
This commit, however broke more kanban views. This happened
because the original commit changed a CSS rule with flex, and
commit above attempted to fix the issue by turning problematic
UI elements to their flex equivalence.
This change is too broad and unsafe, so the better decision is
to revert them.
Task-Id 2237638
X-original-commit: 6badf3839147c0b9a475247699227ed304bd402d
Before this commit, after adding a column or loading examples in a
kanban from the quick create column, it stays open. After this commit,
it will stay open if adding a column through it, but it will fold if the
user has loaded a set of columns from an example.
Task ID 2047369
PR #48299
Inspired by what is done in the task kanban of the project module,
add examples of kanban stage setups for UTM campaigns, and allow users
to load them.
There have also been some minor changes to the campaigns view:
- The helper message when there are no UTM campaigns has been changed
to a more descriptive message.
- All stages that existed by default (hardcoded in the data XML) have
been removed except default New one. An user with a fresh database will
have no stages in their kanban. The old hardcoded stages have been moved
to the demo data instead, so they will still be added by default if the
user installs demo data.
- The ghost columns that appear in the kanban when no stages exist have
been renamed to match the old stages that were hardcoded.
- When the user opens the view to create a column, the 'See examples'
link will appear below the 'Column title', just like in the project
addon, and clicking it will open some examples specifically made for UTM
campaigns. Clicking on the 'Use This For My Kanban' button will load the
stages of the selected example.
- A min-height property has been given to the example modal view so that
the view does not change size depending on the number of rows in the
ghost columns.
Task ID: 2047369
PR #48299
Before this commit, the only module that allows for selecting and
applying kanban column examples is the project module, for its tasks
kanban, so the message in the button to apply the example is hardcoded
as "Use This For My Project".
After this commit, the text in this button can be customized to make
this more generic, so a different module could use a different message
like "Use This For My Campaigns". If no text is specified, a generic
"Use This For My Kanban" is used instead.
Usage
```
kanbanExamplesRegistry.add('utm_campaign', {
applyExamplesText: _lt("Use This For My Campaigns"),
```
Task ID: 2047369
PR #48299
The color picker help the user to choose a color instead of picking it
by id.
The title and arial-label "no-color" default value are removed from the
picker_preview because they are not accurate. Instead name of currently set
color is used.
Task ID 2128166
closesodoo/odoo#47474
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Replaces unnecessary (harmless in this case, but still), 't-raw'
by 't-esc'. Also replace a t-raw used in the SwitchCompanyMenu
(unnecessary and harmless as well).
closesodoo/odoo#50411
X-original-commit: 691c9d2d2868885124749482aa8954322a40f130
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, searching a many2one field in the search bar would create a
domain with a parsed version of the input string. However the parser of m2o fields
returns a number (ID) and would consistently return 'NaN'.
Now, raw values are taken as is when searching with many2one fields.
Task 2239254
closesodoo/odoo#50410
X-original-commit: bac74010daae868da474de9439bc7027d9206e38
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Revision on 7ecae33571
Commit above introduced schedule activities on partner kanban view,
and also made slight CSS change in order to position next activity
nicely at the bottom of the card.
This change broke the layout in Rating kanban view with a groupby
filter. This happens because some CSS rules made use of a combination
of inline-block/float/margin-compensation to display image next
to kanban textual information.
This commit fixes all above issues by using flex.
Task-Id 2237638
closesodoo/odoo#50386
X-original-commit: e7e3d14f980b221158042097568061363f6f1468
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Since the commit https://github.com/odoo/odoo/commit/46cf65d68e9c13193dff4b563b9b0bbb2199dfc1
when help is not defined in action then nocontenthelp is displayed as
[object, object] due to the desciption passed from renderder of the
pivot view.
So in this commit while calling the NoContentHelper pass the
descitption as string instead of jquery element.
we can use the t-value in template but that string will create
issue for transalation so pass the desctiption from the pivot render.
closes odoo/odoo#50347
Taskid: 2240167
Closes: #49859
X-original-commit: c7cc672aba669175280d619ad39b14daefd7733f
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Handling of escapes (`\`) was performed during evaluation rather than
parsing, so strings in the AST stored the escaped form (rather than
the proper one), and _formatAST had to mess around in order to try and
get it back into a semblance of relevance (especially as the AST would
store the escaped string without delimiters).
Fix: perform the escapes handling (aka normalisation) during
tokenization where it belongs. This means the AST formatter can now
just JSON.stringify the data. Until and unless we decide to produce a
cpython-compliant
repr (https://github.com/python/cpython/blob/0169d3003be3d072751dd14a5c84748ab63a249f/Objects/unicodeobject.c#L12902-L13006)
which is unlikely.
closesodoo/odoo#50236
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Before this commit, if a many2X field with a big comodel was added
in a search panel, the view using it would crash. For instance that
problem occured in the kanban view for hr.job, where res.users
appears as the comodel for the field user_id.
Now, we fix an arbitrary limit of 200 to the numbers of values to fetch
for each many2X fields in the search panel. This avoid the problem
mentionned above.
Furthermore, in case the limit is attained for a field used
as select="one", the values are displayed without being hierarchized.
Indeed the limit can leads to gaps in the knowledge of the hierarchy
and consequently to a bad representation of it.
Task ID: 2154668
closesodoo/odoo#50334
X-original-commit: 8d57153b34c04952a85f6642951cb2697016da84
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>