Commit Graph
31 Commits
Author SHA1 Message Date
Géry Debongnie abf32b8b21 [REF] *: update js test suite to use helpers
This rev. introduces robust helpers to use in the JS tests suite to
interact with DOM and components, and starts using them (almost)
everywhere.

All the helpers are exposed though testUtils.js.

There are 2 kinds of helpers:

1. Assertions
-------------
 * assert.containsNone, containsN, containsOnce check that the DOM
   (or a specific part of the DOM) contains a `selector`. It
   generates a correct error message automatically.
    ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg");
        -> assert.containsOnce(form, '.o_form_editable');
 * assert.isVisible, isNotVisible check that the DOM has an element
   visible or not. They also check that the element is actually in
   the DOM (before most tests didn't verify this).
 * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific
   properties of a DOM element, and also validate that it is
   applied on a single existing DOM element (before most tests
   didn't verify this).
    ex: assert.notOk(form.$('button').hasClass('btn-primary'));
       -> assert.doesNotHaveClass(form.$('button'), 'btn-primary');

2. Utilities
------------
The goal of the utilities is to centralize the definition of many
standard components and interactions, ensuring that when we
refactor the JS framework, we do not need to change all the tests.

Existing mock utilities (addMockEnvironment, intercept, path,
patchDate, unpatch and fieldsViewGet) are moved to
'testUtils.mock.*'.
Existing DOM utilities are moved to 'testUtils.dom.*'.
New dom utilities are created for opendDatePicker, click,
clickFirst and clickLast. Helper `click` verifies that there is
exactly 1 element visible in the DOM you click on, `clickFirst`
and `clickLast` verify that there are more than one element on the
DOM.
 ex: form.$('button').click();
     -> testUtils.dom.click(form.$('button'));

New Form utilities: (testUtils.form.*)
 clickEdit, clickSave, clickCreate, clickDiscard, all clicks on
 the control panel buttons of the form.
 `reload` reloads the form data.

New modal, graph, kanban and pivot utils (testUtils.pivot.*,
testUtils.kanban.*, etc.).

New fields utils: (testUtils.fields.*)
 * editInput, editSelect: allow to change the value of a field,
   using a selector to identify it. They validate that the input
   exists and trigger the change event automatically.
 * editAndTrigger: allow to modify a field and trigger specific
   events after the value change
 * many2one (testUtils.fields.many2one.*)
   clickOpenDropdown, clickHighlightedItem, clickItem,
   searchAndClickItem: use a field name instead of a selector and
   do all the complex mechanism to open, filter and highlight
   many2one fields.

Joint work with aab, dam, ged, mge, svs and vsc.
2018-11-19 11:24:28 +00:00
Alexandre Kühn 03a93f0968 [FIX] google_drive:tests: adapt from forward-port 2018-10-01 18:28:51 +02:00
Christophe Simonis 43b63a0465 [MERGE] forward port branch saas-11.4 up to 57e387b645 2018-10-01 16:01:54 +02:00
Nicolas Martinelli 84aea12bac [FIX] google_drive: current record
- Open a partner view, click on Action > Partner Review
- Switch to another partner
- Click again on Action > Partner Review

The Google Doc file of the second partner is the same than the first
partner.

This is due to `_onGoogleDocItemClicked` which is always called with the
same `resID`, i.e. the `resID` used at `start`.

We retrieve the active ID at each click instead.

opw-1882068
2018-09-21 08:45:17 +02:00
stefanorigano 1d9208c4fa [REF] *: improve app icons, add SVG version
- Uniform colors and design
- Replace duplicated icons (eg. sale / sale_management)
- Improve misleading icons (eg. POS)
- Add icons for new apps

Add SVG versions to lossless future editing and print/marketing use.

task-54681
2018-08-09 15:46:06 +02:00
qsm-odoo 1c1c0897e8 [REF] *: BS4, adapt dropdowns and carets
- The dropdown structure was simplified, allowing to get rid of the
  3-levels structure induced by <ul/> elements and dropdowns can now
  contain anything. The class 'dropdown-item' is now mandatory for
  each dropdown clickable element. The class 'dropdown-item-text' can
  be used to add same padding and style but without making the element
  have a clickable look.

- Dividers now use the class 'dropdown-divider'

- The way dropdowns are opened and hidden also changed (before the
  'open' class was added on the `.dropdown-menu` parent, now the
  'show' class is added on both the `.dropdown-menu` parent and the
  `.dropdown-menu` itself).

- JS-wise, no click event handlers can be put on `.dropdown-toggle`
  elements anymore (instead, use handlers for dropdown events).

- Carets are automatically put on `.dropdown-toggle` elements, so this
  commit replaces the `.caret` elements with this. This feature was
  possible to disable but would prevent us from adding a caret with
  scss. Also, this simplifies the DOM. The 'o-no-caret' class was also
  introduced to allow using the 'dropdown-toggle' class on non-caret
  elements.

- Also adapt the scss to use $caret-width instead of $caret-width-base
2018-07-27 12:36:54 +02:00
Aaron Bohy 74801feb0c [FIX] google_drive: tests: hasSidebar param
Rev. 5140d3d1 fixes the google_drive override of the Sidebar in
saas-16. The test specifies param 'sidebar: true', so that a
sidebar is instantiated by the FormView. This param has been
renamed to 'hasSidebar' by rev. 32b8cec in master, so the test
broke when rev. 5140d3d1 has been forwardported to master, and it
thus needed to be adapted.
2018-01-23 08:23:22 +01:00
Lucas Perais (lpe) 5140d3d10f [FIX] google_drive: adpating to new framework JS
The google_drive module has not been converted to the new Odoo Javascript framework, and hence was not even started.
This commit corrects that.

The logic is essentially the same as in previous versions

The test implemented contains an inevitable hack that makes sure no other test is affected,
in particular by the new route that the module calls (and that any Sidebar will call)

OPW 801145

closes #21993
2018-01-17 09:35:32 +01:00
Géry Debongnie 2106e3dd2e [REF] web, *: simplify our RPC system (in JS)
The RPC system was not completely satisfactory, we decided to prepare
the future and do it properly.  This commit introduces the new rpc
system, which replace the previous new one.  We now simply have a
method, this._rpc, which takes a dictionary of parameters.  The idea is
that depending on the parameters, it is able to add correct default
value when necessary.

For situations where we don't have the this._rpc method, we can use the
rpc.query method, which takes the same arguments, but directly calls
ajax.rpc instead of triggering up some events.
2017-04-11 19:44:38 +02:00
Géry Debongnie 86a87aa8b0 [REF] *: use _rpc method for all rpcs
The _rpc method is now the preferred method to do a rpc, so we need to
update all calls.
2017-04-11 19:44:38 +02:00
Géry Debongnie e574027056 [REF] web,*: remove 'web.model' and 'web.dataModel
Use this.rpc instead of Model object, with web.ajax if necessary.

nb: EventDispatcherMixin include now the custom_events managment instead
of widget
2017-04-11 19:44:38 +02:00
Christophe Simonis be0c9596c8 [MERGE] forward port branch 9.0 up to 8092ee8c6a 2017-03-06 12:21:27 +01:00
Christophe Simonis ea527cc3fc [MERGE] forward port branch saas-6 up to 9ff0eb0586 2017-03-06 11:29:04 +01:00
Christophe Simonis 9ff0eb0586 [MERGE] forward port branch 8.0 up to 1246680756 2017-03-06 11:24:16 +01:00
Christophe Simonis 2b8605c6e2 [FIX] google_drive: show icon via css instead of injecting html 2017-03-01 18:39:34 +01:00
Fabien Pinckaers 4c8e908b49 [IMP] Speed up app switcher loading: 645k --> 137k lossless compression for all icons 2016-02-26 11:39:38 +01:00
Christophe Matthieu 500c33b184 [IMP] web: split model.js into model.js and data_model.js. Web js modules must call web.DataModel. 2015-07-10 16:32:35 +02: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
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 858e46e977 [REF] update various small addons to the new module system 2015-03-18 09:01:52 +01:00
Christophe Simonis aec02cb493 [MERGE] forward port of branch 8.0 up to d350f5b 2015-02-20 18:16:01 +01:00
Denis Michiels b8ecbe3191 [FIX] google_drive : translate the record
Pass the context, with the language setting, when the record is read to
fill the google drive template. That allows to translate the name of the
document and all the informations inside.

opw-626675
2015-02-20 16:08:10 +01:00
Géry Debongnie 240d71f9fa [IMP] various addons: add pivot views next to graph views
The graph view has been splitted into pivot/graph view.  This commit add
a pivot view whenever a graph view was defined.
2014-12-19 14:34:24 +01:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Olivier Dony fba0d3da9a [REM] google_drive: remove unused (but sourced) Goggle API JS lib
Should have been removed when Google Drive API was switched to
server-side Python at revid:pga@tinyerp.com-20130523104155-83gmp2gucvackppv

bzr revid: odo@openerp.com-20140403143448-vds7crizqed0l80a
2014-04-03 16:34:48 +02:00
Denis Ledoux d69046f327 [FIX]google_drive: add in more menu duplicate when clicking on form switch button
bzr revid: dle@openerp.com-20130723133055-evcyunmih9uma3k4
2013-07-23 15:30:55 +02:00
Antony Lesuisse fc70550ca2 [IMP] move html module description and icon
bzr revid: al@openerp.com-20130628100441-swpanf2jwcojygh4
2013-06-28 12:04:41 +02:00
Denis Ledoux 53358465b3 [REF]google_docs to google_drive, using oauth authentication
bzr revid: dle@openerp.com-20130627160715-ok7q82cyivirzri1
2013-06-27 18:07:15 +02:00
Denis Ledoux afa6ea8e4f [IMP]google_drive: cleanup
bzr revid: dle@openerp.com-20130626145213-37to2q3q9jh4lnsg
2013-06-26 16:52:13 +02:00
Denis Ledoux f694c37b83 tmp
bzr revid: dle@openerp.com-20130626133552-gtfhzvxsi1oj3pdm
2013-06-26 15:35:52 +02:00
Denis Ledoux c74517990f [RENAME]google_docs => google_drive
bzr revid: dle@openerp.com-20130626093019-krwt5eamagmd5amu
2013-06-26 11:30:19 +02:00