Commit Graph
108730 Commits
Author SHA1 Message Date
Aaron Bohy 00a172b40d [FIX] web: adapt 1a9a082d to new fields 2017-04-11 19:44:38 +02:00
Aaron Bohy 722cb7cd83 [FIX] web: priority widget
Widget has been broken by a rebase, making its test fail.
2017-04-11 19:44:38 +02:00
Aaron Bohy 2e540eb3c1 [FIX] *: apply changes from web_studio
The new views and widgets (at least some of them) first landed
in web_studio (v10), and they we moved later to web, so changes
in web_studio need to be applied in web.
2017-04-11 19:44:38 +02:00
Aaron Bohy 8d2336abb3 [FIX] web: default_get on x2many may return a list of ids 2017-04-11 19:44:38 +02:00
Aaron Bohy 928af2b51f [IMP] web: ajax service: ensure widget is alive
... before resolving/rejecting the deferred once the RPC is done.
Doing this in the ajax service is equal to wrap every rpc with
this.alive() in the former versions.
2017-04-11 19:44:38 +02:00
Aaron Bohy 979d82abe8 [FIX] report: use this.performRPC 2017-04-11 19:44:38 +02:00
Aaron Bohy 5a604cde53 [FIX] web: typo in the event data
With this commit, the handler to call after a do_execute_action
is now correctly executed.
2017-04-11 19:44:38 +02:00
Aaron Bohy d97c50148b [REF] web: less: form view's statusbar
Move the statusbar rules to community as both webclient now
share the same js basecode for the statusbar.
2017-04-11 19:44:38 +02:00
Aaron Bohy 39ac2dd9bf [FIX] sale: adapt sale tour to new views 2017-04-11 19:44:38 +02:00
Aaron Bohy b1bba768f2 [FIX] web: correctly apply changes on relational fields
The relational record may contain relational fields as well.
2017-04-11 19:44:38 +02:00
Aaron Bohy 95c33aee1c [REF] web: add fixme note 2017-04-11 19:44:38 +02:00
Aaron Bohy 362dea675a [REF] test_new_api: convert widget_x2many tour 2017-04-11 19:44:38 +02:00
Géry Debongnie e357e26735 [FIX] web: fix FieldDate widget default value
The FieldDate widget did not properly select the correct default value
when opening the datepicker.  We did not notice it, because the test
hardcoded the february month.
2017-04-11 19:44:38 +02:00
Aaron Bohy 60a518dcce [REF] web: add name attribute on field widgets 2017-04-11 19:44:38 +02:00
Géry Debongnie 206453c836 [FIX] web: various fixes with one2many/formviewdialogs
We share the basic model record between views, and we have to make sure
that everything is properly coordinated.  The main issue solved by this
commit is the fact that we can now edit a one2many record, then close
the dialog, then edit it again and finally cancel the changes, which
bring us to the previous step.

Also, we had to slightly improve the AbstractView API
2017-04-11 19:44:38 +02:00
Aaron Bohy f79399bf77 [FIX] web: parse date(time) values after onchange
Date and Datetime values are stored as moment instances, not
strings. This wasn't the case after an onchange, and it thus
produced a crash as we tried to call the format method on a string.
2017-04-11 19:44:38 +02:00
Aaron Bohy 2bd4497b49 [FIX] web: apply onchange even if warning
The onchange route returns field values, but it can also return
a warning, that needs to be displayed in a dialog. When it does,
the new values must be applied anyway, which wasn't the case
before this rev.

We generalized the 'warning' custom event handled by the webclient
so that it can display a warning in a dialog (and not only through
the NotificationManager).
2017-04-11 19:44:38 +02:00
Aaron Bohy 1163bab5c6 [FIX] report: this.session is undefined
It is now available with the Service mixin via this.getSession().
2017-04-11 19:44:38 +02:00
Aaron Bohy 9b14290b2a [FIX] web: execute WebSuite tests post install
So that tests written in addons are executed as well.
2017-04-11 19:44:38 +02:00
Aaron Bohy 52d88e77d4 [FIX] account: don't use Math.sign which is ES6 2017-04-11 19:44:38 +02:00
Aaron Bohy abce447401 [FIX] mail: use _.str.startsWith (startsWith is ES6) 2017-04-11 19:44:38 +02:00
Géry Debongnie d7eb116fa8 [FIX] web: properly compute contexts in some cases
When we have a many2one widget in a one2many, editable, the context was
not properly computed: it expected the parent to be a record object, but
in that case, it is a list object.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 7465798ccd [FIX] web: field_utils date
* list view must use stringtify value for py eval comparaison
* use utc to parse database value (avoid timezone error)
2017-04-11 19:44:38 +02:00
qsm-odoo b34279c89a [IMP] web, *: let kanban column and record know about modelName
* hr_attendance, hr_gamification, hr_recruitment, mass_mailing,
  project, sales_team

Before this commit, the kanban column did not know about the model
name which make customization impossible without a getParent. Kanban
records were supposed to know about this thanks to the options
parameter but this was broken. Now the model name is automatically
initialized from the given state.

Adapt all extensions which relied on this.
2017-04-11 19:44:38 +02:00
qsm-odoo c08aa7f9b3 [FIX] web: KanbanColumn start() was not returning a deferred 2017-04-11 19:44:38 +02:00
qsm-odoo 19e86c8388 [IMP] *: remove deprecated view extensions
* account, mass_mailing, sales_team

These view extensions have already been ignored for around two years.
The new views development is a great opportunity to remove them.
2017-04-11 19:44:38 +02:00
qsm-odoo 41162190a6 [IMP] web: lint the pyeval.js file 2017-04-11 19:44:38 +02:00
Aaron Bohy e07f27d45e [FIX] web: kanban: conditions on relational fields
This commit aims to correctly fill in the raw_value of each
field in the qweb_context use to render the kanban templates.
For relational fields, the absence of value should be false,
instead of an empty array. Moreover, the Many2One case is
different from the x2Many cases as in the first case the
datapoint is a record, and it the last ones it is a list.
2017-04-11 19:44:38 +02:00
Aaron Bohy a1f4fe8616 [FIX] web: basic_model: no res_id on new records
We remove the res_id when exporting new records, as it is
meaningless outside the model (it's like "virtual_something").
This fixes a bug as the button box is now correctly hidden in
'create' mode.
2017-04-11 19:44:38 +02:00
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