Commit Graph
108701 Commits
Author SHA1 Message Date
Aaron Bohy 95cbf1d37b [FIX] web: list_editable_renderer: don't instantiate widgets twice
In an editable list view, if there was a readonly field in the table,
positionned before editable fields, clicking on that readonly field
resulted in the editable field widgets being re-instantiated and
appended to the DOM (so there were several widgets per fields/cells).
2017-04-11 19:44:38 +02:00
Aaron Bohy b997309cf6 [FIX] web: abstract_view: don't override shared config variable
The method 'setController' allows to change the default Controller
Widget used by the view. However, before this fix, calling it
changed the default Controller of all other Controller instances.
2017-04-11 19:44:38 +02:00
Aaron Bohy 386820abbe [FIX] web: basic_model: apply onchanges on many2many fields
Before this commit, the many2many fields were handled like basic
fields, which is obviously wrong.
2017-04-11 19:44:38 +02:00
Géry Debongnie 1a0702f1e2 [FIX] web: properly handles dirty data in form views
Before this commit, we only consider the BasicModel point of view to
determine if a record is dirty.  It is good when we want to determine if
it is actually necessary to save the data, but not correct when we want
to know if some changes can be discarded.

With this commit, the form controller keeps track of its 'dirty' state,
coming from user interactions.  It uses this flag to determine if
changes can be discarded.
2017-04-11 19:44:38 +02:00
Martin Geubelle 4d12ec87bc [ADD] web: StandaloneFieldManagerMixin
This mixin is meant to be used by widgets that instanciate
standalone field widgets.
2017-04-11 19:44:38 +02:00
Géry Debongnie dde1223a14 [REF] *: remove manualDestroy options for tests
With the new JS test framework, we had experimented with an autodestroy
feature, meaning that all views/widgets are automatically destroyed
after a while.  By default, it was 50ms, because we could not hook some
code to run after the end of the current test.

For various reasons, this was not a good idea: some side effects, such
as modifications of the session or of the DOM (with modals) could
interfere with other tests.  This commit disable the feature.

From now on, we will have to destroy each widgets created in a test.
2017-04-11 19:44:38 +02:00
Géry Debongnie 086a04fdec [FIX] web: avoid calling getContext twice
Also, slightly improve the style...
2017-04-11 19:44:38 +02:00
Géry Debongnie ecceee639e [FIX] web: formview dialog can now properly evaluate context
For this change, I had to pass the handle to the parent datapoint all
the way from the controller to the new form view.
2017-04-11 19:44:38 +02:00
Géry Debongnie ed830f7394 [FIX] web: don't select cell in one2many (non editable)
The code for selectCell was active, when the user clicked on a td.  No
test caught that, because we simulated a click on a tr, not on a td.

I guess that the lesson of the story is that our tests should be as
close as possible to the real conditions, so we should simulate the
click on the innermost element.
2017-04-11 19:44:38 +02:00
Géry Debongnie fdd34465ac [FIX] web: one2many with inline formview and invalid fields
Before this commit, the form view opened by a one2many did not check
that the required fields were properly set, so it could lead to pretty
strange results.
2017-04-11 19:44:38 +02:00
Géry Debongnie c7f79417b2 [REF] account: rename test file to proper guidelines
All test files should end with _tests
2017-04-11 19:44:38 +02:00
Géry Debongnie db2198b7ef [FIX] web: fix crash when building domain with dates
Before this commit, the rawify function assumed that any object is
necessary a record object.  This was true until recently, when we
decided that dates should be internally stored as a moment instance.
2017-04-11 19:44:38 +02:00
Géry Debongnie 1a7fbd5a13 [FIX] web: make sure form view properly transmit attrs
When creating a new record, the form view did not properly transmit the
attrs to the new record.
2017-04-11 19:44:38 +02:00
Géry Debongnie dba7e64a2f [FIX] web: fix crash in FieldBooleanButton
It tried to read its options in the wrong key, which resulted in a good
old-fashioned BOOM.
2017-04-11 19:44:38 +02:00
Géry Debongnie fdcab23759 [FIX] web: fix crashes with various views and date/datetimes
The problem was that in some cases, the date/datetime values were not
properly parsed when they enter the system.
2017-04-11 19:44:38 +02:00
qsm-odoo cd6bba33c2 [IMP] web: auto-context for fields model RPC calls
Some fields need to do some model RPC calls (name_search, name_create,
...). Before this commit, they did not use the performModelRPC method
but an explicit trigger_up so that the BasicController (the
FieldManagerMixin) catches it and ask the BasicModel to perform the
RPC. This was designed to let the BasicModel handle the context.

This commit makes the context be automatically binded without the need
to explicitely call the BasicModel for each route in the
FieldManagerMixin. It also ensures that the field own context is
properly merged with the user/action/search contexts.

Now, the fields use the performModelRPC method and the
FieldManagerMixin catches the associated "call_service" event. Then, it
can get the full context from the BasicModel instance and let the event
continue its propagation. To know which field context has to be fetched,
the performModelRPC method is overriden by AbstractField to
automatically add the dataPointID and the field name in the options
parameter.
2017-04-11 19:44:38 +02:00
qsm-odoo a9eac7766f [IMP] web: allow to give perform[Model]RPC options
(already used by session.rpc)
2017-04-11 19:44:38 +02:00
qsm-odoo 167db67300 [FIX] web: _getContext was not returning a consistent context
Hopefully, this commit makes it consistent. There were two problems
with the previous implementation:
- Contexts from field attr (if asked thanks to the options.field
  parameter) were not evaluated with the right evaluation ctx
- "raw" contexts (from parent) had to be evaluated with another
  evaluation context

Also rename the options.field parameter to options.fieldName.
2017-04-11 19:44:38 +02:00
qsm-odoo 352cc10348 [FIX] web: m2o field already extends from ServicesMixin
FieldMany2One was declared as an extension of AbstractRelationalField
AND mixins.ServicesMixin... which was wrong since the mixin is already
added to the Widget class. This caused the extension of the mixin
methods to be lost.
2017-04-11 19:44:38 +02:00
qsm-odoo 7e91154e8e [IMP] web: some more linting to follow guidelines 2017-04-11 19:44:38 +02:00
Géry Debongnie b717c67864 [REF] web,*: improve the way field_utils are done
We replace a bunch of formatting and parsing functions by an object
(parse or format) which can be used to dispatch on the correct type.  It
allows us to remove the format_field and parse_field functions.

Also, we camelcase our new code and add some comments.
2017-04-11 19:44:38 +02:00
Aaron Bohy 7dc9eb51d6 [FIX] web: basic_fields: remove use of a es6 feature
which is not supported by phantomjs.
2017-04-11 19:44:38 +02:00
Aaron Bohy 85f9ae5ef7 [FIX] web: FieldSelection: listen to 'change' event
... instead of 'input', to make the 'rte_translator' tour pass
the step where it manually selects a value of the select element.
2017-04-11 19:44:38 +02:00
Aaron Bohy 10d4ff895a [IMP] web: qunit_config: log wording 2017-04-11 19:44:38 +02:00
Aaron Bohy 032825fefa [FIX] web: calendar_tests: date format compatible with phantomjs 2017-04-11 19:44:38 +02:00
Géry Debongnie da4e653695 [FIX] web: various fixes for date and datetime in client
The field_utils date method have been modified recently, and the idea
behind those changes is that the BasicModel keeps at all time a moment
instance as its internal representation of a date or datetime.

But the parse and format methods did not properly support unset dates,
so we have to slighlty change them to support the case where their values is
not set.
2017-04-11 19:44:38 +02:00
Géry Debongnie 4a612171b3 [FIX] web: basic model now parse dates on lists
Before this commit, the BasicModel didn't parse the dates when loading
data for a list.  But the rest of the web client assumes that data is
properly parsed into their correct types, so a moment instance for date
and datetime.

Also, uppercase field_utils and properly reorder imports
2017-04-11 19:44:38 +02:00
Géry Debongnie 064d7f4621 [FIX] web: make focus tests works if window has not the focus
Until now, those tests failed if the window did not have the focus. We
solve the issue with 2 different fixes:
* instead of checking that the focus property is set, we can check the
activeElement instead, it seems to work.
* instead of calling the focus method, in some tests, we can trigger a
* 'focusin' event.  I don't know why this works, but it does.

Note that this might make the tests work in phantomjs
2017-04-11 19:44:38 +02:00
Géry Debongnie 7c41254d8f [REF] web: small linting pass, add some comments, update style 2017-04-11 19:44:38 +02:00
Géry Debongnie 0c1d9204c3 [REF] web: small refactor + add code in basic model 2017-04-11 19:44:38 +02:00
Géry Debongnie ce4bf0378b [REF] web: update list renderer (new JS guidelines) 2017-04-11 19:44:38 +02:00
qsm-odoo 2db5ee0f7b [IMP] web: some more linting to follow guidelines 2017-04-11 19:44:38 +02:00
Christophe Matthieu 3c0190d0a6 [IMP] web: use moment object instead of string for date
Before this commit, the odoo web client used strings to represent dates.

Now, the date is parsed into a moment object when the value is read from the
server side. The widget formats the object to display the value. When the
widget value changes, the value is parsed to a moment object. The value is
automatically formatted to server value in ajax calls (toJSON method).
2017-04-11 19:44:38 +02:00
qsm-odoo cce579434b [FIX] web: destroy internal m2o on m2m tag field re-render 2017-04-11 19:44:38 +02:00
qsm-odoo 92f24f2cfe [IMP] web: adapt field domain to new API
Add the implementation of the "FieldDomain" (widget='domain') in
basic fields file.
2017-04-11 19:44:38 +02:00
qsm-odoo 274a0aadc6 [ADD] web: add domain and field selectors tests
Create a new folder "widgets" in the "test" folder and add basic tests
for the domain and field selector widgets.
2017-04-11 19:44:38 +02:00
Géry Debongnie 136292f689 [REF] web, *: move CompoundContext out of data.js
We want to remove data.js, but we still need the CompoundContext class,
so we take it out, and rename it 'Context'
2017-04-11 19:44:38 +02:00
Christophe Matthieu 173896b62d [REF] web: remove format.js
use 'web.field_utils' instead of 'web.formats'
2017-04-11 19:44:38 +02:00
Géry Debongnie c9f747dad6 [FIX] web: prevent web client from starting in tests
In test mode, we don't want the web client to start.
2017-04-11 19:44:38 +02:00
Géry Debongnie 044e7bb599 [FIX] web: display error dialog when onchanges fails
When the onchange returns a dictionary with a 'warning' key, it is
supposed to fail and display a dialog with the content of the warning.
2017-04-11 19:44:38 +02:00
Géry Debongnie 05ec284e9c [FIX] web: properly compute field values for onchanges 2017-04-11 19:44:38 +02:00
Aaron Bohy 8a9ba04420 [FIX] web: boot_tests: there should be no more missing modules 2017-04-11 19:44:38 +02:00
Aaron Bohy 79fe0622f7 [FIX] web: define 'web.web_client' module in qunit_suite template
To allow modules that require it to be loaded.
2017-04-11 19:44:38 +02:00
Géry Debongnie 4e4b3c7b59 [FIX] web: properly transfer context to onchange rpcs 2017-04-11 19:44:38 +02:00
Géry Debongnie 450e2f4d48 [FIX] web: basicmodel can evaluate context for new records 2017-04-11 19:44:38 +02:00
Aaron Bohy f3a811b2b2 [FIX] web_settings_dashboard: remove useless imports
It also allows this module to be loaded in the test environment,
where the module 'web.web_client' is missing.

Also fixes some linting warnings.
2017-04-11 19:44:38 +02:00
qsm-odoo fba8d0e5cd [FIX] web, barcodes: attrs processing in kanban
Commit cef659783514f8935cc46a496f71063d022e8dac changed the way domains
are computed but forgot to change the values representation used by the
Kanban view. This commit fixes that and adds tests to make sure it does
not happen again.
2017-04-11 19:44:38 +02:00
qsm-odoo e3546bb1b8 [IMP] web: better process modifiers in mock server
Before this commit, modifiers were partially processed by the mock
server. Now, it should be a better approximation of what the server
does:
- Take the invisible/readonly/required from "attrs"
- Merge invisible with the "states" ([["state", "not in", states]])
- Override if invisible/readonly/required attribute is present

+ Adapt some tests
2017-04-11 19:44:38 +02:00
Christophe Matthieu 654f932b3c [FIX] account: rewrite of the reconciliation feature
With our new views, we broke almost all JS code, including the
reconciliation widget, which was (and still is) dependant on the field
widget.  With this commit, we rewrite and simplify the reconciliation
code.  We also add some tests, to help with the maintenance.

Work done by CHM
2017-04-11 19:44:38 +02:00
Géry Debongnie 905e01921f [REF] web, *: redesign all JS views
This commit introduce a full redesign of all JS views.  We started
basically from scratch.  The goal was to unify all the various views
under a common framework, to make them testable, to make then usable in
different conditions (in studio, or in the frontend), and to make our
lives easier.

Some important points are:
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- all new code should be documented

We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.

Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-04-11 19:44:38 +02:00