Commit Graph
9367 Commits
Author SHA1 Message Date
Christophe Simonis 39ab200cd3 [MERGE] forward port branch saas-15 up to 780064ea89 2017-04-18 18:37:24 +02:00
Martin Trigaux 780064ea89 [I18N] export saas-15 source terms 2017-04-18 18:16:42 +02:00
Adrien Dieudonne 05a3305274 [FIX] web: BasicModel: active_id should always be defined
Before this fix, active_id wasn't defined on non existing record.
For example: when you tried to add a new contact on a new partner.

Now, active_id is false if there is no id on the current record.
So, you can use this value to evaluate the context
2017-04-18 13:19:50 +02:00
Pierre Masereel 2b22ceea6f [FIX] web: date_picker empty input field
When you try to empty a date or datetime field, you get a traceback
saying that 'clone' and 'isSame' are not functions.

This error occurs when you empty the field because the value is 'false'
and you cannot call 'clone' or 'isSame' on false.

To fix this, we ensure that value is not false before calling these
methods on it.

This bug has been introduced in rev: https://github.com/odoo/odoo/commit/c32724eae06c987e74a0600f1669696e499edc33
2017-04-18 13:14:50 +02:00
Christophe Matthieu e6897c71d5 [FIX] web: wrong display in mobile 2017-04-18 10:19:06 +02:00
Géry Debongnie 0bdf51e1b2 [REF] web: remove forgotten debug: true statement
Someone with a trigram starting by M and ending by GE forgot to remove a
debug: true statement in a kanban test.
2017-04-15 15:00:12 +02:00
Aaron Bohy a21e2593ce [FIX] web: FieldX2Many: don't ignore mode attribute
The 'mode' attribute can be used for x2many fields to force the
view mode. Before this rev., it was ignored and if a tree view
existed in the view description, it was selected by default.

This was mainly a problem in mobile as in this case, kanban views
are prefered, and the data_manager forces the mode to be kanban,
so the data was fetched according to the kanban view fields, but
later on the list view was instantiated instead of kanban by the
x2many field, so it crashed if both views didn't share the exact
same fields.
2017-04-15 15:00:05 +02:00
Aaron Bohy f6c20c61d6 [FIX] web: BasicModel: correctly apply onchanges result
Onchange results weren't correctly applied for many2manys, and
for x2manys inside x2manys.

More precisely, if an onchange RPC returned a command 4 (link to)
for a many2many field, this command was ignored. If it returned
nested commands (commands 0, 1 or 4 inside commands 0 or 1), they
were ignored as well.

The function that applies the result of an onchange is now
recursive, and it handles commands 0, 1, 4 and 5.
2017-04-15 15:00:04 +02:00
Aaron Bohy bf29aab3ba [FIX] web: BasicModel: transmit fieldsInfo to children
The fieldsInfo attribute on the basic model's datapoints is used
by to determine which fields need to be loaded for a record/list
of records. This information wasn't correctly specified in some
cases. As a result, the display_name of many2many fields (e.g.
using widget many2many_tags) inside list views were fetched, and
thus empty tags were displayed.

No test is added by this commit, as it already makes a broken test
pass (this test didn't pass since the previous commit).
2017-04-14 22:36:55 +02:00
Aaron Bohy a6ce395f30 [FIX] web: field Many2ManyCheckboxes: add and remove values
There were several issues with this widget, and the way the model
handles its requests (mainly the removal of values).

It crashed for instance on the product form view when the user
updated the routes field (field route_ids in tab inventory).
2017-04-14 22:36:55 +02:00
Aaron Bohy 0494d61274 [FIX] web: readonly fields may be edited
The readonly attribute of a field in its description can be
overriden in the views (e.g. with modifiers). So readonly fields
may actually be edited from views in which there is a modifiers
on their node overriding the default value.

Before this rev., readonly fields couldn't be saved, even if they
could be edited from views (with such modifiers).

For instance, it wasn't possible to change the value of the
partner_id field in a draft sale_order.
2017-04-14 22:36:55 +02:00
Adrien Dieudonne 148f7b4597 [FIX] web: Form: *_view_ref in context not passed
For one2many and many2many fields, you have several ways for specifying
a view other than the default one:
- to write the arch of the view in the field tag
Example:
<field name="many2many">
    <tree>
        ...
    </tree>
</field>

- to write xmlid of the view in a specific key (*_view_ref)
in the context of the field.
Example:
<field name="many2many" context="{'tree_view_ref':'module.tree_view_ref'}">

Before this fix, the second case didn't work.
the default view was loaded instead of the one passed in the context.

In fact, this context is evaluated after the loading of the record but
we need some static keys to load the view (before fetching the record).
2017-04-14 14:49:09 +02:00
Christophe Simonis e92ae40d71 [MERGE] forward port branch saas-15 up to b0992d082d 2017-04-14 13:32:15 +02:00
Pierre Masereel ff2ce7524b [FIX] web: archive kanban column
When we try to archive a kanban column we get a traceback when the field
'active' exists on the model but not in the view.

This traceback is caused by an unecessary check of the active value of
the record.

To fix it, we apply the 'active' value on all records, and not only on
the ones where active value changed.
2017-04-14 10:50:35 +02:00
Christophe Matthieu 2f67881d45 [FIX] calendar: Various fixes
Traceback when:
* click on first row of calendar
* move an event somewhere else with drag and drop
* click on the mini calendar
* filter from the control panel triggers a traceback
* add an attendee: traceback
* day/week/month: traceback
* cannot add a leave, the fromViewDialog does not open
* one day oo server-side when select all day
2017-04-13 16:55:11 +02:00
Christophe Matthieu c32724eae0 [FIX] web: calendar timezone with user configuration
The client must receive the tzOffset to apply this on all hours.
To use the date picker we must change the date to apply the change
in the user's tzOffset, without this change the result is wrong.
For datetime widget we must change like it to avoid max stack error.

The server send the tzOffset, if it's undefined, by default the client
use the browser time offset.

Every test are change to use tzOffset.

A test is added in calendar to use the click by position for the
fullcalendar lib. This test create and drag and drop an event to check
timezone error and error when we use default value in the context.

Use formating date like 2026-04-04T08:00:00Z instead of 2026-04-04 08:00:00
is important for phantomjs, because it's crash without information if the
formating is not the standard format.

For the parsing, when the client receive a server date the date is utc
formating but when it's parsed from the client is in the user's timezone
2017-04-13 16:55:00 +02:00
Aaron Bohy 9c43ad85d4 [FIX] web: Form: apply style attribute on rendered nodes 2017-04-13 16:16:18 +02:00
Christophe Simonis b0992d082d [MERGE] forward port branch saas-14 up to 8f30e707e5 2017-04-13 15:31:27 +02:00
Aaron Bohy ec988d4121 [FIX] web(_editor): field widget html
The field widget html wasn't implemented yet in the new views. A
very basic implementation was done in addon web. It only handled
the readonly mode so that the field were displayed in studio.

This commit removes this basic implementation from web, and re-
introduced the old one, converted, in addon web_editor.
2017-04-13 14:31:24 +02:00
Aaron Bohy 6b936ba203 [FIX] web: correctly save many2manys inside one2manys
In a form view, if a one2many list view contained a many2many
field (e.g. widget many2many_tags), the commands for the embedded
many2many weren't generated for newly created one2many subrecords,
so this field couldn't be saved.
2017-04-13 14:31:24 +02:00
Aaron Bohy fce45c3361 [FIX] web: field_utils: correctly format many2manys 2017-04-13 14:31:24 +02:00
Aaron Bohy 15f26cc263 [FIX] web: Many2ManyTags: keep focus after being edited
When a tag is either added or removed, the focus should remain
on the input.
2017-04-13 14:31:24 +02:00
Christophe Simonis 13ad16104a [MERGE] forward port branch 10.0 up to 00e169c05a 2017-04-13 13:22:27 +02:00
Martin Geubelle 87ac617eb1 [FIX] web: Kanban: edit the kanban color
The method has not been correctly ported to the new view (in the new
model in this case).

The change (on the color) needs to be notified to the model before
updating the record.
2017-04-13 11:14:40 +02:00
Christophe Simonis 9e159ef204 [MERGE] forward port branch saas-11 up to f830c7c3e3 2017-04-12 18:51:16 +02:00
Martin Geubelle 35c7cfa99e [FIX] web: use correct type integer
In tests, some fields were defined with the type `int` which
does not exist. The correct type is `integer`.
2017-04-12 17:22:20 +02:00
Martin Geubelle 15e17e7b48 [FIX] web: switch in edit mode when creating a record
When creating a new record (form view without `currentId`), the form
view should be rendered in edit mode and not readonly.
2017-04-12 12:25:03 +02:00
Martin Geubelle 16dc001e42 [FIX] web: Form: only render button StatButton
One could want to render something else than a `button` in the
buttonbox (even if the name seems to imply that it will contain
buttons).

In this case, we render the method corresponding to the tag instead
of a button.
2017-04-12 12:23:31 +02:00
Aaron Bohy e2e0353ce5 [FIX] web: AceEditor Field should be debounced
Debounced fields do not notify their environment each time their
value changes, but rather wait for a given delay after the last
change. Input fields allowing the user to type text should be
debounced. The AceEditor is one of them.

Note: this should be tested, but i can't find a way to simulate
text entries in the ace editor.
2017-04-11 19:44:38 +02:00
Aaron Bohy 942d5fc4a3 [REF] web: Fields: DEBOUNCE is a DebouncedField attribute 2017-04-11 19:44:38 +02:00
Adrien Dieudonne 64e0fe80a3 [FIX] web: Calendar: enter key not working in quick create
Before this commit, it was not possible to add a new event
with the "quick create" if you pressed enter key instead of
using confirm button.
2017-04-11 19:44:38 +02:00
Géry Debongnie 875ea7964c [REF] account, web, web_diagram: rename static test folder
For consistency, every static test folder should be named 'tests', with
a s.
2017-04-11 19:44:38 +02:00
Géry Debongnie f0ee1e2be5 [FIX] web: add session user_context in the evalcontext
When evaluating a domain, we need to add the user context, so domains
can use a key such as uid.
2017-04-11 19:44:38 +02:00
Martin Geubelle 0cb5005946 [FIX] web, *: basic model: makeRecord with X2manys
`makeRecord` is now asynchronous as it will load data
for relational fields (X2manys and many2ones if `display_name`
is not fetched).

This change has implied a refactoring in all `makeRecord`
occurences to adapt with the returned deferred.
2017-04-11 19:44:38 +02:00
Aaron Bohy b6ce7b136f [IMP] web: protect _rpc calls on destroyed widgets
It might happen that some code in a widget (callbacks given to
other function calls) is executed after the widget's destruction.
For example, trigger an event up with a callback in option, the
event is handled by a parent that performs an rpc, meanwhile, the
child widget is destroyed, then, the rpc returns and the parent
executes the callback.

This shouldn't happen, because it means that the callback is
executed for nothing. Worst, it crashes if the function _rpc is
called inside the callback, because the widget being destroyed,
there is no parent to handle the request, and _rpc thus returns
undefined.

This rev. protects the code from crashing by making _rpc return
a pending deferred instead of undefined.
2017-04-11 19:44:38 +02:00
Géry Debongnie d1d80a494b [FIX] web: make sure buttons are called with proper res_id
Before this commit, clicking on buttons did not reload the current
record, which is good.  However, it kept the reference to the record
after saving, even if that record could have been changed, which is
definitely the case when starting from a new record and saving it (it
will have the correct res_id, which is really important).
2017-04-11 19:44:38 +02:00
Géry Debongnie 64a9398fb3 [FIX] web: fix corrupt datapoint in basic model
When saving a new record, with the option reload=false, a datapoint in the
basic model could be left in a wrong state: the x2many fields were
deleted, with all the changes, but the values in the data key were still
null, which means that the x2many field has no valid corresponding
datapoint, as far as the basicmodel can see.

So, with this commit, we make sure to push the changes into the data, so
the datapoint is in a proper clean state.
2017-04-11 19:44:38 +02:00
Géry Debongnie 2bf2976c20 [FIX] web: don't reload form view before opening action
When we click on a button in a form view, we don't need to reload the
data for the form view.
2017-04-11 19:44:38 +02:00
fwi-odoo 85790a2980 [FIX] web: don't try to create datapoint for relational field not in view
In some case ´default_get´ returns values for relational fields that are not
in the view so we cannot create a datapoint for these field. Furthermore, we
cannot discard these fields in order to save their values correctly in the newly
created record.
2017-04-11 19:44:38 +02:00
fwi-odoo 60ae646c66 [FIX] web: properly initialize non empty x2many in default_get
When the ´default_get´ returns default values for a x2many field, it needs
to be set as changed fields in this x2many field. Previously, it was wrongly
assumed that these changes were non existant.
2017-04-11 19:44:38 +02:00
Adrien Dieudonne ef6b330d8f [FIX] web: Form: avoid to change mode on button click
When clicking on a button in a form view, the current data should be
saved but the form view shouldn't be re-rendered in readonly.
Before this commit, the view was re-rendered, causing a weird glitch
in dialogs as buttons that were supposed to be moved to the dialog's
footer appeared inside the view when the button was clicked.

Also forces the default mode in form view to readonly, so that it is
correctly redrawn in readonly when coming back using the breadcrumbs.
2017-04-11 19:44:38 +02:00
Aaron Bohy 318ff5f00d [FIX] web: pass context of changed field to onchange RPC
When a field with an onchange is changed, if there is a context
defined on the field in the arch, this context must be added to
the context sent with the onchange RPC.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 3dfa2caa3d [FIX] web: various bugs in calendar and move _rpc call into model 2017-04-11 19:44:38 +02:00
Géry Debongnie e7dfa4af77 [FIX] web: add support for editable=top/bottom in o2m
Before this commit, we lost the functionality of editing records top or
bottom.  However, it as almost ready, but we needed to change the way
commands are generated, to respect the actual order in the UI.

Also, the mock server needed to be updated, to make sure he also save
the new ids in the correct order.
2017-04-11 19:44:38 +02:00
Aaron Bohy 7e14e81903 [FIX] web: one2many onchanges
When there is an onchange on fields of a one2many, the data given
to the onchange RPC should contain an additional key for the
corresponding many2one, mapping to the current data of the parent
(main) record.

This wasn't working before this rev. for new o2m records created
when the one2many wasn't editable inline (with a list view
editable), because in that particular case, the reference to the
parent record wasn't specified correctly.
2017-04-11 19:44:38 +02:00
Christophe Matthieu f62597ae1f [FIX] web: radio button display the checked input 2017-04-11 19:44:38 +02:00
Aaron Bohy d0f321d6cc [FIX] web: Form: don't discard onchange when editing a o2m
Assume that there is an onchange on a form view that upates the
records of a one2many field. Before this rev., if the user edited
one of those one2many records (in a dialog) after the onchange,
the onchange values were lost.
2017-04-11 19:44:38 +02:00
Aaron Bohy bc89bb79d2 [FIX] web: BasicModel: ignore unknown fields after onchange
It may happen that an onchange returns values for unknown fields in
the view. In that case, the corresponding values need to be ignored
as the postprocessing base on the field type can't be done, which
may lead to errors later on (e.g. when saving).

For example: one2many list in a form view which doesn't display
a many2one field that exists on the related model. If an onchange
on the main form view updates the value of the many2one inside the
one2many, it will crash later on when the user will try to save
(because the value [id, display_name] will be sent to the server).
2017-04-11 19:44:38 +02:00
fwi-odoo ab44cabc78 [FIX] web: render the statinfo buttons that are not in a buttonbox
Without this commit, the statinfo field in a button but
not in a buttonbox are not rendered.
With this commit, when the button is rendered, the children are
processed and then the statinfo field is rendered (e.g. bank account(s) statinfo
in the Sales & Purchases tab in the res.partner form view).
2017-04-11 19:44:38 +02:00
Géry Debongnie 4872c8da31 [FIX] web: don't save readonly fields
Readonly fields can be modified with onchanges, but they should
not be saved.
2017-04-11 19:44:38 +02:00