The library reset the time set when the date is changed.
Then it was not possible to set the time then set the date
and expect the widget to close since the time will be reset
to the default value.
Instead we use the library behaviour and add a 'close' button
for the datetime widgets.
The library needs to have a 'relative' positioned parent to place
the datetimepicker correctly.
We don't do that in the template
anymore because it was not working in all the cases.
The template which instantiates the datepicker should define
a parent in position 'relative'.
Before this commit, the field selector had an unique option to filter
the fields it displays: filters.searchable, which tells the widget to
only display the searchable fields (which is the default). Now there
are two more options:
- fields: an explicit list of the fields to use (if null, let the
widget get the fields itself (this is the default))
- followRelations: a boolean which is true if the user can follow
relation to build a field chain (default to true)
These options are needed by Web Studio in enterprise where domain
construction for form view attrs can only use fields which are in the
view and do not follow relations.
The "ModelFieldSelector" widget has a "filters" option which can
customize the fields which are displayed.
The "DomainSelector" widget has of course the same option it can
transmit to its internal "ModelFieldSelector" instance... but it
was documented as "fs_filters" instead of "filters".
Also, let the "ModelFieldSelector" document its own options and
sets their defaults (instead of the "DomainSelector" widget).
* toggle datetimepicker when field is clicked
* close datetimepicker when a date is chosen
* disable keyboard navigation in the widget to allow modification of input
Be a little less strict when not showing o2m list view warning so if the
o2m is not editable (a modal is open instead of editing inline) we still
show warnings.
Also have warnings over modal overlays so they can be used for modals.
opw-702333
With 003d85b instead of getting the name of the relation
field_relation we get field_relation/id.
But the data about the related fields are not gotten all at once when
opening the export modal. They are gotten by clicking on the arrow of
the related record.
So we need to have these /id information saved in the export list,
otherwise for example the related records can be missing when exporting
from an export list, whilst everything was OK without using the saved
export list.
With the previous change, an export list could contain an id and .id
fields for the same relational field, so a change must also be done in
fields_info method used when getting a saved list.
opw-665994
opw-693535
note: adapted forward-port of 8.0's 29be9ae80 which was lost when
merging web enterprise onto web community.
The Python method `strftime` raises an error when the date is older than
01-01-1900 ("The datetime strftime() methods require year >= 1900"). If
the user mistyped the date (or was expecting 01-01-16 to be converted
into 01-01-2016), this can lead errors since the ORM uses this method
frequently.
opw-702313
The Python method `strftime` raises an error when the date is older than
01-01-1900 ("The datetime strftime() methods require year >= 1900"). If
the user mistyped the date (or was expecting 01-01-16 to be converted
into 01-01-2016), this can lead errors since the ORM uses this method
frequently.
opw-702313
An editable list can be drag-and-drop sorted by:
- displaying a sequence field,
- displaying a field with the `handle` widget
At first it was only working if the list was not specifically ordered,
but with 26bf35260 it also worked if the list was ordered on `sequence`
or `sequence ASC`.
This commit changes this so it works:
- if the list is not ordered (same as the original intention),
- if the list is ordered by the sequence field (widget `handle` or sequence)
This allows to have a custom model (on which we can't define _order) to be
ordered on a custom field.
This also remove a far-fetched oddity such as having the view ordered by
sequence but having a custom sequence field before `sequence`.
opw-704612
Mixing the use of btn-xs and btn-sm was not good for design.
This commit use btn-xs for "add a filter" and "edit domain"
buttons to improve elements alignment.
The "in_dialog" option of the domain field was not working correctly
when the field value was falsy as it did not consider it to be
"[]" in that case (as it is done without the "in_dialog" option).
Same goes for the dialog which displays the matched records.
Some domain fields are initialized with a model which depends of another
form field value. Sometimes, this value is False and the domain selector
cannot be used during that time (and was even performing useless RPC).
Now, in this case, the field domain is fully replaced by a message
which explains that a model have to be set. If you don't want this
message to be shown, you still have the possibility to not show the
field domain when there is no model thanks to the "invisible" attrs.
The hard coded limit dates back to a time where the browsers would crash
when using FileReader#readAsDataURL() on files of serveral dozens of Mb.
This limit is now obsolete and even IE Edge now supports the FileReader
api.
This commit removes the limit and turns it into an option so it's
possible to limit a particular binary field to a given amount from the
form views, eg:
<field name="image" widget="image" options='{"max_file_size": "200k"}'/>
Note: this feature only works when the FileReader api is available.
At time of writing, all major browsers supports this feature:
http://caniuse.com/#search=FileReader
In e0c4ec54ca a change was done to improve the behavior in some
editable list instances, but this introduced a small issue for
list with line creation disabled.
With this change, doing tab or enter at last line should keep the
previous behavior of wrapping around and not creating a new line.
opw-703748
Purpose:
========
When user opens a wizard , the cursor should be placed in the first field which saves a click for the user.
Right now , in odoo the cursor is not coming in the first field by default.
Now, the form FieldDomain has an option "dialog" which allows to force
the domain *edition* in a new dialog. This allows the field to be
positioned in smaller area of the form view in some contexts.
The FieldDomain is composed of a DomainSelector widget and a button
which allows to see the records which match the domain (or an error
message if the domain is wrong).
The button was placed below the domain selector. Now, in edit mode,
it is placed at the top-right of the domain selector, saving some
vertical space.
Before this commit, the DomainSelector had to be instanciated with an
array-typed value which forced the user to use (and import) the pyeval
module. Now, the conversion to array is done in the DomainSelector.
This commit introduces a web.domainUtils module allowing to do the
convertion array -> string and string -> array of a domain.
On UNIX, the timezone modules conversions can be reset by using
`time.tzset()`. On windows this is not available and the timezone (TZ)
environment variable must be set before the first import of time module.
If not, all datetime gotten in python without specifying UTC (such as
datetime.datetime.now) could be wrong.
This was fixed with 4a77c6a0 in 2013, but has come back since 389c2ba97b
imported pkg_resources (which do a `time` module import) before that.
closes#14926
opw-693764
The number of records selected by a FieldCharDomain was only computed
with the base language.
But when selecting the domain with a modal window, or when sending a
mass mailing restricted to a domain, the current user language is used.
With this commit, the number of records is computed with the current
user language.
opw-693836
When a search is performed and the completion feature is used (search on
a many2one field), clicking on a '(no result)' item causes a crash.
opw-703557
* base_action_rule, gamification, mass_mailing
1) Create the independant DomainSelector widget
- Allow to build a prefix char domain
2) Replace old FieldCharDomain with a new FieldDomain which uses the
new DomainSelector widget
3) Create the independant ModelFieldSelector widget
- Allow to build a valid field chain for a specific model
(e.g 'partner_id.name' for a 'res.users')
- Used by DomainSelector widget
---
The DomainSelector widget uses a tree-like representation with
user-friendly buttons (ALL/ANY/+/-/...). Any domain can be built,
except those containing the "!" (not) operator or some operators
like "like", "child_of" (@see DomainSelector). However, if the
user enters these in the debug input, the widget can handle them.
Note: these widgets had to do unusual stuff the widget API does not
allow to handle efficiently right now but it will be adapted to the
new widget/field API in a further update.
Note2: the widgets also have possibility of other improvements like
supporting m2o input instantiation in DomainLeaf, etc.
---
This work is an adaptation of the original code made by @pga-odoo.
Before this commit, the pager counters and buttons were at the same
level, and could not be styled independently (with some rules such as
nowrap).
Close PR #14865
split fields_view_get() and used an abstact mixin class in place of of FormatAddress
[IMP] base: added a m2o field (ir.ui.view) on res.country to decide the layout of the form view to input addresses.
Simplifies the left margin calculation logic with a pre-defined width.
In practice, more use cases should be taken into account, and that could
just make the logic overkill.
opw-697626