Commit Graph
1383 Commits
Author SHA1 Message Date
Adrien Dieudonne ef3200f940 [FIX] web: BasicModel: id in evalContext
The evalContext contains the current data of a record
(the value of the fields that have been fetched,
i.e. the ones referenced in the view).
However, 'id' is a particular field that should always
be in the evalContext, even if not in the view
(as we always know its value).

Before this rev., 'id' was in the evalContext if
the record already existed, but not on new records, so it crashed
on new records if 'id' was used in the context defined on a field's node.
2017-04-20 13:08:14 +02:00
Martin Geubelle 625a7438f0 [FIX] web: do not apply impossible onchanges
Before this commit, all onchanges were applied if the field
was known on the model.

However it's not possible to apply onchanges on x2many not in
the view as we don't know their fieldsInfo.
2017-04-19 17:49:36 +02:00
Martin Geubelle f57932b932 [FIX] web: add missing handler on quick_create
The custom event `quick_create` was linked to `_onQuickCreate`
which didn't exist on the FieldMany2One.
2017-04-19 17:49:36 +02:00
Martin Geubelle 5dfd3a9d7c [FIX] web: List: archive record
The method `update_state` doesn't exist anymore and has been
replaced by `update`.
2017-04-19 17:49:35 +02:00
Martin Geubelle 3b3e71c2dd [FIX] web_kanban: remove add new column on 'Discard'
The 'Add New Column' was still in `folded` mode after clicking on 'Discard'
because the mode was toggle two times: one by `_cancel` and another one by
`_onClick` which already toggles the mode.
2017-04-19 17:49:34 +02:00
Martin Geubelle 3445597940 [FIX] web: replace bad use of this
This commit also use `_applyChanges` directly instead
of using `notifyChanges` to avoid the mutex which will
cause a deadlock (we are already in the mutex).
2017-04-19 17:49:34 +02:00
fwi-odoo 10ffcba429 [FIX] web: display stat buttons inline string attribute
Stat buttons of type action have the text that should be displayed
as inline string attribute. This case was no longer supported with the new views.
2017-04-19 17:42:29 +02:00
fwi-odoo 469feaa21d [FIX] web: call the correct format method for the one2many in list view
The one2many fields in list view should render the number of record, like the
many2many fields.
2017-04-19 17:42:21 +02:00
qsm-odoo c33e535707 [FIX] web: modifiers on <footer/> tag in form
Since the new views, buttons were extracted of the <footer/> tags and
placed directly in the buttons area. While this would be a good idea,
this was ignoring the modifiers placed on the <footer/> tags. Multiple
solutions were possible:

1) Leave the <footer/> tag as it is (like before the new views)

    This creates an useless <footer/> element in the DOM most of the
    time.

2) Propagate the <footer/> modifiers to its children.

    This requires some code to do the propagation and a modifier might
    be evaluated multiple times for nothing (for each child).

3) Allow only one <footer/> tag in form views and divide buttons in
   child <div/> elements.

    Only creates the necessary DOM elements and modifiers are evaluated
    only once.

While the third choice is obviously the better one, this commit is
implementing the first solution. Indeed, changing all the XML views
might not be a good idea in the current state.
2017-04-19 15:33:40 +02:00
Christophe Matthieu 9bf3e2a7fa [IMP] web: add timezone_mismatch field widget
* display a warning when the timezone offset is not the same of the browser
timezone offset
* if different, display the time in the selected timezone
2017-04-19 14:48:07 +02:00
Christophe Matthieu 69ae6e2912 [FIX] web: use correct timezone for date fields
before this commit when toggling allday flag in calendar form view, it was
possible to have one day error.

The input datetime is wrong when the user don't use the datepicker widget
 (insert date by keypress instead of click on datepicker)

sometimes, the value could be null (crash because try to clone false)
2017-04-19 14:48:06 +02:00
qsm-odoo 7ff8aa73e1 [REF] web, *: implement modifiers behaviors
* account, mail, sale

Since the views refactoring, modifiers were not properly handled
anymore (readonly/required not recomputed, use of readonly/required
of "python field" instead of "view field", ...). This commit tries to
implement a system which allows to handle the modifiers (re)computation
the same way for all the basic views.

For this to work, many specialized renderers behaviors have been moved
to the basic renderer so that more mechanisms are shared (especially by
the form renderer and the list editable renderer). The list editable
renderer is hugely impacted by this commit.

Here is a list of key changes:

- The basic renderer now has a `_renderFieldWidget` function which is
  used without modification by the form and the list renderers.

- Modifiers have to be registered thanks to the basic renderer
  `_registerModifiersData` function (this is done automatically for
  fields by the `_renderFieldWidget` function for example).

- All instantiated widgets are accessible, organized by record, and
  ordered in a special basic renderer variable.

- The code which resets the widgets of the form view and the code
  which updates the row of a list editable view is now shared in the
  basic renderer and now also automatically updates the DOM according
  to the reevaluated modifiers.

- The last point has an huge impact on list editable renderer: all the
  widgets have to be instantiated when editing a row (even readonly and
  invisible ones) as they can be switched to editable/visible during
  edition (after a modifiers update).

- `replace_element` and `readonly` options of `AbstractField` are
  useless: widgets are now always replacing the list editable cells
  in edition and the `readonly` widget mechanism is replaced by the
  notion of 'focusable' widgets.
  (see `AbstractField.getFocusableElement`)

- The 'tab' navigation mechanism is impacted by the previous point,
  some code sharing have been done in basic renderer for this too.

- `AbstractField` does not care anymore of the 'required' status, this
  is the view responsability to check that a required field has a set
  value on save.

- Some list editable bug fixing (e.g. it was possible to edit multiple
  rows at the same time, it was not possible to navigate towards the
  previous field, crash on o2m add an item click, ...)

- The mockserver now properly simulates server modifiers computation.

- ...

Note: list editable style may be worse than before this commit but a
CSS update is coming in a few days.
2017-04-19 11:42:01 +02:00
Adrien Dieudonne 05a3305274 [FIX] web: BasicModel: active_id should always be defined
Before this fix, active_id wasn't defined on non existing record.
For example: when you tried to add a new contact on a new partner.

Now, active_id is false if there is no id on the current record.
So, you can use this value to evaluate the context
2017-04-18 13:19:50 +02:00
Pierre Masereel 2b22ceea6f [FIX] web: date_picker empty input field
When you try to empty a date or datetime field, you get a traceback
saying that 'clone' and 'isSame' are not functions.

This error occurs when you empty the field because the value is 'false'
and you cannot call 'clone' or 'isSame' on false.

To fix this, we ensure that value is not false before calling these
methods on it.

This bug has been introduced in rev: https://github.com/odoo/odoo/commit/c32724eae06c987e74a0600f1669696e499edc33
2017-04-18 13:14:50 +02:00
Géry Debongnie 0bdf51e1b2 [REF] web: remove forgotten debug: true statement
Someone with a trigram starting by M and ending by GE forgot to remove a
debug: true statement in a kanban test.
2017-04-15 15:00:12 +02:00
Aaron Bohy a21e2593ce [FIX] web: FieldX2Many: don't ignore mode attribute
The 'mode' attribute can be used for x2many fields to force the
view mode. Before this rev., it was ignored and if a tree view
existed in the view description, it was selected by default.

This was mainly a problem in mobile as in this case, kanban views
are prefered, and the data_manager forces the mode to be kanban,
so the data was fetched according to the kanban view fields, but
later on the list view was instantiated instead of kanban by the
x2many field, so it crashed if both views didn't share the exact
same fields.
2017-04-15 15:00:05 +02:00
Aaron Bohy f6c20c61d6 [FIX] web: BasicModel: correctly apply onchanges result
Onchange results weren't correctly applied for many2manys, and
for x2manys inside x2manys.

More precisely, if an onchange RPC returned a command 4 (link to)
for a many2many field, this command was ignored. If it returned
nested commands (commands 0, 1 or 4 inside commands 0 or 1), they
were ignored as well.

The function that applies the result of an onchange is now
recursive, and it handles commands 0, 1, 4 and 5.
2017-04-15 15:00:04 +02:00
Aaron Bohy a6ce395f30 [FIX] web: field Many2ManyCheckboxes: add and remove values
There were several issues with this widget, and the way the model
handles its requests (mainly the removal of values).

It crashed for instance on the product form view when the user
updated the routes field (field route_ids in tab inventory).
2017-04-14 22:36:55 +02:00
Aaron Bohy 0494d61274 [FIX] web: readonly fields may be edited
The readonly attribute of a field in its description can be
overriden in the views (e.g. with modifiers). So readonly fields
may actually be edited from views in which there is a modifiers
on their node overriding the default value.

Before this rev., readonly fields couldn't be saved, even if they
could be edited from views (with such modifiers).

For instance, it wasn't possible to change the value of the
partner_id field in a draft sale_order.
2017-04-14 22:36:55 +02:00
Adrien Dieudonne 148f7b4597 [FIX] web: Form: *_view_ref in context not passed
For one2many and many2many fields, you have several ways for specifying
a view other than the default one:
- to write the arch of the view in the field tag
Example:
<field name="many2many">
    <tree>
        ...
    </tree>
</field>

- to write xmlid of the view in a specific key (*_view_ref)
in the context of the field.
Example:
<field name="many2many" context="{'tree_view_ref':'module.tree_view_ref'}">

Before this fix, the second case didn't work.
the default view was loaded instead of the one passed in the context.

In fact, this context is evaluated after the loading of the record but
we need some static keys to load the view (before fetching the record).
2017-04-14 14:49:09 +02:00
Pierre Masereel ff2ce7524b [FIX] web: archive kanban column
When we try to archive a kanban column we get a traceback when the field
'active' exists on the model but not in the view.

This traceback is caused by an unecessary check of the active value of
the record.

To fix it, we apply the 'active' value on all records, and not only on
the ones where active value changed.
2017-04-14 10:50:35 +02:00
Christophe Matthieu 2f67881d45 [FIX] calendar: Various fixes
Traceback when:
* click on first row of calendar
* move an event somewhere else with drag and drop
* click on the mini calendar
* filter from the control panel triggers a traceback
* add an attendee: traceback
* day/week/month: traceback
* cannot add a leave, the fromViewDialog does not open
* one day oo server-side when select all day
2017-04-13 16:55:11 +02:00
Christophe Matthieu c32724eae0 [FIX] web: calendar timezone with user configuration
The client must receive the tzOffset to apply this on all hours.
To use the date picker we must change the date to apply the change
in the user's tzOffset, without this change the result is wrong.
For datetime widget we must change like it to avoid max stack error.

The server send the tzOffset, if it's undefined, by default the client
use the browser time offset.

Every test are change to use tzOffset.

A test is added in calendar to use the click by position for the
fullcalendar lib. This test create and drag and drop an event to check
timezone error and error when we use default value in the context.

Use formating date like 2026-04-04T08:00:00Z instead of 2026-04-04 08:00:00
is important for phantomjs, because it's crash without information if the
formating is not the standard format.

For the parsing, when the client receive a server date the date is utc
formating but when it's parsed from the client is in the user's timezone
2017-04-13 16:55:00 +02:00
Aaron Bohy 9c43ad85d4 [FIX] web: Form: apply style attribute on rendered nodes 2017-04-13 16:16:18 +02:00
Aaron Bohy 6b936ba203 [FIX] web: correctly save many2manys inside one2manys
In a form view, if a one2many list view contained a many2many
field (e.g. widget many2many_tags), the commands for the embedded
many2many weren't generated for newly created one2many subrecords,
so this field couldn't be saved.
2017-04-13 14:31:24 +02:00
Aaron Bohy fce45c3361 [FIX] web: field_utils: correctly format many2manys 2017-04-13 14:31:24 +02:00
Aaron Bohy 15f26cc263 [FIX] web: Many2ManyTags: keep focus after being edited
When a tag is either added or removed, the focus should remain
on the input.
2017-04-13 14:31:24 +02:00
Martin Geubelle 87ac617eb1 [FIX] web: Kanban: edit the kanban color
The method has not been correctly ported to the new view (in the new
model in this case).

The change (on the color) needs to be notified to the model before
updating the record.
2017-04-13 11:14:40 +02:00
Martin Geubelle 35c7cfa99e [FIX] web: use correct type integer
In tests, some fields were defined with the type `int` which
does not exist. The correct type is `integer`.
2017-04-12 17:22:20 +02:00
Martin Geubelle 16dc001e42 [FIX] web: Form: only render button StatButton
One could want to render something else than a `button` in the
buttonbox (even if the name seems to imply that it will contain
buttons).

In this case, we render the method corresponding to the tag instead
of a button.
2017-04-12 12:23:31 +02:00
Aaron Bohy 942d5fc4a3 [REF] web: Fields: DEBOUNCE is a DebouncedField attribute 2017-04-11 19:44:38 +02:00
Adrien Dieudonne 64e0fe80a3 [FIX] web: Calendar: enter key not working in quick create
Before this commit, it was not possible to add a new event
with the "quick create" if you pressed enter key instead of
using confirm button.
2017-04-11 19:44:38 +02:00
Géry Debongnie 875ea7964c [REF] account, web, web_diagram: rename static test folder
For consistency, every static test folder should be named 'tests', with
a s.
2017-04-11 19:44:38 +02:00