Skip to content

Master #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10,000 commits into
base: master
Choose a base branch
from
Open

Master #1

wants to merge 10,000 commits into from

Conversation

JTugs
Copy link

@JTugs JTugs commented Apr 20, 2017

No description provided.

dmo-odoo and others added 30 commits April 11, 2017 19:44
The functions for parsing and formatting float_time were completely
duplicated between field_utils and basic_fields.
One might need all the preparation stuff that InputField does on
its input but might need something else as its tagName and handle
the input differently.

This commit gets the input preparation code out from the rendering
part of the widget so one can render a widget the way he likes and
call _prepareInput on his input.

This is used in monetary field which requires all the feature of
InputField but with the input actually being one level deeper in
the DOM than the standard InputField.
Even if specified when building the rpc query, the offset wasn't
given in the arguments of the performed RPC.
When the pager is disabled, the user can't go to the next or
previous page. It shouldn't be able to manually edit the pager's
values neither.

Also
  - converts pager.js to the new JS coding guidelines
  - adds two tests
Before this rev., there was no pager rendered in groups that
contain more than 'limit' records.
When reloading a view by clicking on its icon in the view switcher,
some params of the view (e.g. limit) were reset to their original
value. So if the user previously updated that param (e.g. by
editing the pager), these changes were lost.

This rev. ensures that those original params are only given to the
view at its initialization, but not on reload.
The 'isOpen' state of groups was already kept when reloading a
(e.g.) list view. The limit and offset should be kept as well.
The sass/css rules didn't apply (.openerp).
The JS redirects the kanban record clicks to a click on an element
that doesn't exist anymore.
The session can me mocked in the test environment (if a session
is given in the params). However, when it is not, it crashed
if one of the instantiated widgets requests the session with
getSession().

This rev. adds a fallback so that when this happens, the real
session (web.session) is given.
The remaining widgets were KanbanRecord and the two quick create
widgets. Now, all kanban files have been converted and refactored.
When calling a route using the new RPC query builder (e.g. by
doing "this._rpc('/a/route').params({a: 'a'}).exec()"), if one of
the route kwargs was 'model', 'method', 'args' or 'kwargs', the
given value was overriden by undefined.
This rev. allows to specify some kwargs of read_group directly in
an Object given to kwargs(), instead of explicitly specify them
using the corresponding method (e.g. to specify the context in the
kwargs instead of by calling .withContext().
Don't need to create a dataset to call loadViews
* Data manager load_view returns a viewInfo object
* ViewInfo contains: the arch, fields and fieldsInfo objects, and some extra informations
* The fields come from the server and are frozen, without any view attributes (depend of the model).
* The fieldsInfo contains every view attributes and informations.
The `FieldDomain` was sending string domains instead of array domains
to the server (by its associated `BasicModel._fetchSpecialDomain`
function). The server does not do the conversion string -> array for
domains, so the RPC broke everytime.

This commit also modifies the `MockServer` so that tests also break
when sending string domains.
It also improves the way failed rpc are handled. Indeed when an rpc
fails, its deferred is rejected with two arguments: the error object,
and a JQuery event (that will display the error if not
preventDefaulted). The mockRPC didn't pass the second one and thus
there was a crash when reaching code that e.g. calls preventDefault
on that event. Note: this also removes the stringify/parse of the
error object as it is not a correct simulation of a server error
object anyway.
When reloading a grouped Kanban view (e.g. after specifying a new
domain), the internal state of the (sub-)groups is kept so that
it can be restored (like which are the open groups and the limit
and offset inside the groups).

However, for models and fields whose read_group returns empty
groups (e.g. project.task grouped by stade_id) this was wrong if
the specified domain filtered out all records of an open group,
because as its data wasn't reloaded (because there is no record),
the old data were still in place, so the filtered out records still
appeared in the Kanban.
When the kanban is grouped and its groups contain no record, the
nocontent helper shouldn't be displayed. This wasn't the case
before this rev.
When the user quick creates a record in a grouped kanban view, a
name_create RPC is done. This RPC may fail, and there were
several issues with the fail handler.

First, those fail handlers take 2 params: an object describing
the error, and a JQuery event. The event was the first argument
in the handler, so it crashes on event.preventDefault().

Second, when the name_create fails, a FormViewDialog in edit
should be open. Former code opened a SelectCreateDialog.

This commit also ensures that the default values are correctly
given to the form in the dialog, through the context.
The fields are now available on the state. It produced a traceback
when the user tried to resequence columns.
... if not grouped by m2o, as it won't save anything in database
anyway, so at the next refresh of the view the new order will
be lost.
ajo-odoo and others added 30 commits April 18, 2017 14:36
The field is defined but never user. It could be useful to indicate
to the delivery guy that the product is 'fragile' or whatever.

opw-728874
When closing a session is failing, explain which order fails and why.
Allow to quickly see payment or rounding issues.
Extract setting the employee's parent when changing the department manager.
This allows customizing the way the managers are handled easily in extension
modules.

Closes odoo#16490
* 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.
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)
* 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
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.
It is frequently needed whenever we want to make something responsive
Also, we refactor the code to the new coding guidelines (this part was
done by ged)
The one2many fields in list view should render the number of record, like the
many2many fields.
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.
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).
We also adapt the code to comply to the new guidelines and we have
added some tests.
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.
This widget doesn't exist anymore as it has been factorized. Remove the
attribute widget will use the correct widget `many2many`.
The field `modelname` doesn't exist on the model.
The method `update_state` doesn't exist anymore and has been
replaced by `update`.
This commit just fixes the traceback due to the new views.
Another commit to refactor the whole widget will follow.
The custom event `quick_create` was linked to `_onQuickCreate`
which didn't exist on the FieldMany2One.
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.
The method is now called `getContext`.
`rpc.query` is an helper for `call_kw` session.rpc.

This helper will, for example, add the mandatory `kwargs`.
Since 54245de, when you clicked twice
on the button "Confirm" on a slow connection, you could get an error as
values is not always defined.

This commit fixes the bad indentation level :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.