Commit Graph
94384 Commits
Author SHA1 Message Date
Aaron Bohy 20b4aaab83 [REF] Web: Actions, ActionManager, ViewManager, Controlpanel refactoring
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.
2015-03-20 16:34:41 +01:00
Aaron Bohy 913942a327 [FIX] Web_calendar: this.options.$sidebar
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.
2015-03-20 16:34:41 +01:00
Aaron Bohy 1280bf2513 [IMP] Web and all views: ControlPanel atomic update
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.
2015-03-20 16:34:39 +01:00
Aaron Bohy 7aa0836420 [IMP] Web: views.js, view_editor.js: DebugManager
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.
2015-03-20 16:18:35 +01:00
Aaron Bohy 151c90743e [IMP] Web et al.: unique main 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.
2015-03-20 16:18:33 +01:00
Aaron Bohy 53a9f6c081 [IMP] Web et al.: ControlPanel extracted from ViewManager
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
2015-03-20 16:17:06 +01:00
Aaron Bohy db592efca2 [ADD] Web: openerpframework.js: willStart() function
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.
2015-03-20 16:17:05 +01:00
Aaron Bohy 180115665e [ADD] Web: core.js: export Bus 2015-03-20 16:17:05 +01:00
Jérome Maes 84f8aac3d7 [IMP] account_analytic_analysis : change label of a state button on contract form view. 2015-03-20 15:48:03 +01:00
Hitesh Trivedi 04daefd2d1 [FIX] website_blog : when it load template not able to evalute json data 'resize_class' 2015-03-20 09:03:34 +01:00
Géry Debongnie 04da153fe9 [FIX] web: session requires a name to properly work
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.
2015-03-19 14:57:29 +01:00
Darshan Kalola bc11d27f62 [IMP] project: add author of incoming email as customer
of the newly created task.
2015-03-19 13:02:53 +01:00
Nandan Jani 633c166c77 [IMP] stock_account: on picking type kanban card add
an indicator for pickings to be invoiced + action + filter.
2015-03-19 12:41:20 +01:00
cod-odoo 32fb2f0940 [IMP] crm: better management of contact / company / customer when going
from a lead to an opportunity.
2015-03-19 12:39:50 +01:00
Jay Patel 2ec6fe68a1 [IMP] delivery, payment: name are now translatable 2015-03-19 12:38:39 +01:00
Simon Lejeune 77ee3ff639 [IMP] web_client.js: trigger web_client_ready on core.bus
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')});
2015-03-19 11:42:32 +01:00
Arthur Maniet 64ba5b9ee4 [IMP] account: in multicurrency bank statement reconciliation, the error message showing when no account is configured for foreign exchange gain/loss is configured now offers a link to the configuration page
Fixes #5839
2015-03-19 10:50:52 +01:00
Thibault Delavallée 69cf768404 [IMP] mail: composer: recipients before subject 2015-03-19 10:45:25 +01:00
Laurent Mignon (ACSONE) cafcd65b6d [FIX] Take a copy of the context.
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
2015-03-19 10:02:45 +01:00
Géry Debongnie 21e38e3851 [FIX] web: fix database manager
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.
2015-03-19 09:50:53 +01:00
Yannick Tivisse 882f1b3721 [IMP] hr_expense: Filter to find expenses of former employees 2015-03-18 15:11:16 +01:00
Yannick Tivisse 7ecd9299b5 [IMP] account: usability in "Payment terms" wizard 2015-03-18 14:06:35 +01:00
Géry Debongnie 55acc522b9 [FIX] web_calendar: don't focus quick create when disabled
web_calendar tried to focus the quick create instance, even when it has
been disabled.  Result: boom (example: hr/leave request: click on
calendar).
2015-03-18 12:21:22 +01:00
Géry Debongnie 2283e6a9da [FIX] website_blog: fix undefined variable
The editor variable shadowed the outer editor variable, which is the
imported module.
2015-03-18 10:19:39 +01:00
Géry Debongnie 7d088d7de9 [MERGE] add module system to javascript code
This branch introduces a new module system for our javascript
code, inspired by requirejs.  It is a really large change,
since all the javascript code had to be updated to use the
new system.

Some important remarks:
* the openerp global variable has been deprecated.  Do not use
  it in the future
* a new global variable has been introduced: odoo.  It contains
  the 'define' function used to create new modules.  Use it
  to create modules, not as a global bag of things.
* the web client code has been refactored.  Most files have
  been split into smaller files.  The code should be easier to
  understand now

More documentation can be found at:
www.odoo.com/documentation/master/reference/javascript.html#web-client
2015-03-18 09:42:10 +01:00
dka-odoo dcd3702782 [FIX] hr_recruitment : use _track_subtype method instead of _track dict. 2015-03-18 09:27:20 +01:00
Géry Debongnie b517e5a2b2 [IMP] web: documents the new module system.
This add a basic overview of how the modules work.  This is a work in
progress, more documentation needs to be updated, such as the
tutorial.
2015-03-18 09:23:37 +01:00
Géry Debongnie ebc39b8788 [FIX] update tests to new module system
Various tests (mostly tours) were broken with the large changes in the
way the js code works.
2015-03-18 09:23:37 +01:00
Géry Debongnie 4fdf74fe21 [IMP] web+addons: improvement to module system
The module system needs to know the dependencies of a given module
before executing the function.  This is why the dependencies were
defined once in an array, and then were described one more times in the
call to require.

But a trick can simplify this: the boot function can parse the string
representation of the module and extract the calls to require from it.
It is more work for the processor, but it leads to simpler module
definitions.
2015-03-18 09:23:37 +01:00
Géry Debongnie 59a4706dd9 [REF] website_twitter: update to the new module system 2015-03-18 09:23:37 +01:00
Géry Debongnie d6254a264b [REF] website_version: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie 65586f8ef3 [REF] website_slides: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie 4289319f62 [REF] website_sale: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie f05d9aea0a [REF] website_quote: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie 131ca70d83 [REF] website_mail: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie 838cfe6664 [REF] website_links: update to the new module system 2015-03-18 09:23:36 +01:00
Géry Debongnie 43ed24c375 [REF] website_gengo: update to the new module system 2015-03-18 09:23:35 +01:00
Géry Debongnie be8adf2769 [REF] website_forum: update to the new module system 2015-03-18 09:23:35 +01:00
Géry Debongnie da73f624b2 [REF] website_event: update to the new module system 2015-03-18 09:23:35 +01:00
Géry Debongnie a78655e71f [REF] website_crm: update to the new module system 2015-03-18 09:23:35 +01:00
Géry Debongnie 93d96ff871 [REF] website_blog: update to the new module system 2015-03-18 09:20:33 +01:00
Géry Debongnie 88fbbd7362 [REF] survey: update to the new module system 2015-03-18 09:09:23 +01:00
Géry Debongnie 0e274fde7d [REF] stock: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie eccda7dff6 [REF] planner: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie 81333ade84 [REF] mass_mailing: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie 5e6171bb6f [REF] various addons: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie 90050c24bb [REF] pos_X: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie 996b6571b7 [REF] website: update to the new module system 2015-03-18 09:09:22 +01:00
Géry Debongnie 1d23c24d79 [REF] point_of_sale: update to the new module system 2015-03-18 09:01:52 +01:00
Géry Debongnie 1ca7f9f6aa [REF] im_odoo_support: update to the new module system 2015-03-18 09:01:52 +01:00