Some Belgian banks (e.g. CPH) seem to generate CODA
import files that do not comply with the CODA 2.3
(or 2.4 or 2.5) spec, specificially in the header
we use to detect CODA files.
This branch extracts the control panel out of the view manager. It
also does a few other refactoring in web client, such as:
* work on the way views communicate their state to the control panel
* better coordination between actionmanager, viewmanager, client widgets
* there is only one controlpanel by action manager
* buttons are added/removed atomically (no flicker)
Creation of the ControlPanelMixin that should be used by widgets
needing a ControlPanel. It facilitates the way those widgets communicate
with the ControlPanel to update it according to their status.
From now on, client action widgets can easily use the main ControlPanel.
When a new state is rendered, it is now first appended to a
documentFragment, and then appended to the DOM when ready. Doing so,
there is no more a intermediate step where two widgets are in the DOM,
the new one being appended below.
This required a web_calendar fix:
Not exactly fixed per-se, apparently when fullcalendar is rendered
hidden/out of document it doesn't generate correct range dates, and
calls the events callback with invalid dates. The code would blindly
take those invalid date, get bits out of them (NaN), generate a
timestamp full of NaNs and blindly search() the table with that.
Just skip the events callback entirely if the start or end date of the
current period is invalid (~isNaN(date.valueOf())).
Set _limit at initialization instead of computing it each time its value
was requested, as it is static anyway.
This prevents a bug (this.getParent() undefined, i.e. parent has been
destroyed) occuring when fast switching with edit/save several times in
form views with one2many list fieds.
Creation of the One2ManyControlPanel template. The One2ManyControlPanel
can only contain action_buttons and a pager. Typically, in One2Many
Kanban, buttons are displayed (in edit mode) and in One2Many Lists,
the pager is displayed.
Improvement of all Views.buttons templates so that if there is no
button to render, it does not render an empty div. This was necessary
for Kanban buttons to prevent padding when there is no button
displayed. Changes in the other views were motivated by uniformity
concerns. This prevents to add empty div in the DOM as well.
Exception for FormView where the outer div is required for the option
footer_to_buttons to work.
This fixes a bug as the pager is now available in One2Many Lists, which
was not the case before, even if there were more than 80 items in the
list, i.e. some items were unreachable.
cp_bus argument in ViewManager init() is now required. If there is no
ControlPanel to communicate with, a dummy Bus should be given ot the
ViewManager.
Big refactoring of Action, WidgetAction and ViewManagerAction to clean
their API. Mainly, renamming from State to Action and removal of unused
functions (or functions that are only used by the DebugManager, for
which we tolerate introspection).
Some logic has also been moved from the ActionManager to the Actions
themselves. The specific behavior of each type of Action is now handled
in the implementation of those Actions.
In ActionManager, this.states is renammed to this.action_stack to be
consistent with view_stack in ViewManager.
The setup_search_view() and render_switch_buttons() functions have been
moved from ControlPanel to ViewManager as it was before, since actual
design allows it and it makes more sense.
The ControlPanel API has also been simplified as some functions were not
used anymore. The ControlPanel is now updated directly by the widgets
using it, bypassing the ActionManager. The control panel elements are
stored by the widgets themselves to allow restoring them later.
The sidebar in Calendar views is not the usual sidebar of the other
views, which should rather be called toolbar and is located in the
ControlPanel. However, the Calendar sidebar was only rendered when
this.options.$sidebar was set, even if this option concerns the toolbar
and is thus nothing to do with the Calendar sidebar.
Also fixes css so that useless scrollbars aren't displayed anymore.
Change the logic of rendering and displaying/hidding the control
elements (buttons, sidebar and pager) of all views. The views do no
more render automatically their elements as this is rather done
through the render_[element] function called by the ViewManager.
This function only appends the element to the $node given as argument.
If no argument is given, then it may appends it to the DOM directly,
within the adequate div of its template.
This allows the ViewManager to attach/detach all elements of the
ControlPanel in an atomic may, to prevent the ControlPanel from
flickering.
Also detach the contents of the ControlPanel in headless mode. Headless
means that the ControlPanel exists, but is hidden. Detaching its
contents permits to have a cleaner DOM.
Also remove the oe_form_dirty class on the buttons in the FormView, as
this class is only used on the view itself.
Side changes:
* base_import: import.js:
Extend render_buttons function to be compliant with the new buttons
rendering logic
* board: dashboard.js:
Set flag search_view to True as the searchview is needed for the
Views displayed in the Dashboard to retrieve the records to display.
Necessary since we do no more construct the searchview when this
is set to false
* google_drive: drive.js,
share: share.js:
Module extending the Sidebar widget often add their own buttons
by extending the start(), which is called each time the Widget
is appended to the DOM. With our new design, this could be done
in start() anymore as it should be done only one. It is now done
in init() instead.
Creation of a widget for the DebugManager and move it from the ControlPanel
to the Systray.
Refactoring of the widget to improve/facilitate the way of adding
options in the DebugManager as the view_editor does.
Add a do_action() function in the WebClient that forwards the action to
the main ActionManager so that widget that are not in the scope of the
ActionManager (e.g. Menu) can performed actions as well.
Note: The DebugManager is currently in the Systray but it will finally be
moved to a dedicated spot above the ControlPanel.
A unique main ControlPanel is instantiated by the ActionManager and it
is updated each time the state changes (i.e. when an action is performed
on the ActionManager or when switch_mode() is called on the ViewManager).
Introduction of State classes to facilitate the way of restoring
previously rendered states in ControlPanel. The notion of widgets
previously used in the ActionManager is now encapsulated in the notion
of states.
The search() function has been moved from ControlPanel to ViewManager as
it makes more sense like this.
The ViewManager doesn't have the reference to the ControlPanel but
rather communicate with it through a dedicated bus.
Some refactoring has been done on the ControlPanel as well so that it
doesn't need to know the ActionManager and the current Action anymore
(it communicates with the AM with events, and it updates itself using
information passed in arguments).
Improves the way the ViewManager requests the ControlPanel to
instantiate a SearchView, and how it waits for this SearchView to be
corretly loaded.
Move back the views logic to the ViewManager which directly asks
the ControlPanel to render the buttons and switch-buttons areas with
the views passed in arguments.
Removes option replace_breadcrumb in push_state() of ActionManager as it
is not used.
Side changes:
* Account: account_widget.js:
Adapt code to retrieve the current state of the ActionManager.
Required due to the introduction of State classes that encapsulate
the notions of widgets and inner_widget in the ActionManager.
* Board: dashboard.js:
Some refactoring to adapt the code according to the new Widgets
structure. Several dependencies (e.g. searchview, action) were
unnecessary. Do not append the "add to dashboard" option to the
Favorite menu if there is no ViewManager available (e.g. in
Messaging) instead of hidding it with a CSS rule, as a ViewManager
required to retrieve the active_view.
* Google_spreadsheet: search.js:
Change the way to retrieve the list_view_id s.t. it does not rely on
parent of the SearchView anymore.
* Web: search.js:
Change the way to retrieve the title in search.js for Favorites s.t.
it does not rely on the parent of the SearchView anymore. Doing so,
the ControlPanel does not need the title attribute anymore.
The ControlPanel is still instantiated by the ViewManager.
Changes details:
* web: views.js:
Code related to views header is extracted from the ViewManager
to a new Widget named ControlPanel.
Also uses the headless flag to tell the inner view not to put
its buttons (use case: kanban) or pager (use case: list) in the
header as it is hidden.
* web: view_form.js, base.xml:
Uses the headless flag at initialization of the One2ManyViewManager
widget instead of extending the ViewManager template (which doesn't
handle the header anymore).
* web: view_list.js:
Test on this.options.$pager instead of this.options.$buttons
when dealing with pager.
Note: the behavior for list view is unchanged and has a bug.
If there are more then 80 records to display, only the 80th
first are display, and as there is no pager, there is no way
to see the remaining ones. A fix for this would be to use a
light ControlPanel in One2Many views as well. With this,
there won't be duplicated .oe-'view'-buttons/sidebar/pager
anymore.
* web: view_graph.js, view_pivot.js:
Only render buttons in non-headless mode
* web_dashboard: dashboard.js:
Fix some references that were broken with ControlPanel extraction
* web_view_editor: web_view_editor.js:
Extend ControlPanel instead of ViewManager
* Changes in selector of ControlPanel elements in several addons:
* base_import
* mail
* web
Add the willStart() function to Widgets. This function is executed
between init() and start() and its purpose is to perform various
asynchronous calls required for start() to be executed.
It is automatically called after rendering a Widget, and start() is
called once the Deferred returned by willStart() is resolved.
opportunities button tip. Using directly the first child
is risky because modules can add statbutton before the
opportunities button (published for example). Using a
class seems a safer way to select the target.
The displayed date was incorrect: instead of the day number in the month (1st-31th), we displayed the day order in the week (0th-6th).
Yeah, this one was a tricky one...
`product_qty` field is not recomputed at record creation.
Force field recomputation at any change
Removing the trigger on `product.product` should not be a problem as
product uom can't be changed once there are move lines.
opw:629650
For historic reasons, the session had a name (hardcoded to "instance0"),
used in at least one place: the get and set cookie methods.
The idea was most likely to allow multiple instances of the web client
to coexist peacefully. This does not work at all at least for the last
versions, and the new module system is a better way to do it anyway.
However, before removing completely the prefix in cookies, we should
actually check if no external code depends on it.
If a campaign was done to a list of Applicant, marketing team had an error loading the kanban view.
Because to display the number of recipents, a search is done with a domain on hr.applicant.
Model that except Human Resources / Officier, nobody can read.
This way, any module requiring web.core has access to this hook.
var core = require('web.core');
core.bus.on('web_client_ready', this, function() {console.log('ready')});
If the method `import_file` is called with the new API, the context is a
frozendict and the update will raise `NotImplementedError: 'update' not
supported on frozendict`
closes#5798
database manager is the only html file we have, and because of that,
regularly escapes the greps. It was still trying to load old files
before the javascript modules. It has now been updated to the new
file structure.
Also, I had to guard the nv customization from happening in misc.js
because the nvd3 library is not loaded in the database manager, but
the misc.js file is required. Not really happy about the misc.js file,
but this is for another commit.