Commit Graph
580 Commits
Author SHA1 Message Date
qsm-odoo 2506a9564b [FIX] web: review UI tag color system
- Kanban colors and tag colors are now the same
- Tag color 0 (default) is now back to be the invisible kanban one
- Same colorpicker for kanban and tags
- Define correct number of colors (12 not 13)
- Color 0 should be a neutral one (gray)
- ...
2017-09-28 13:29:56 +02:00
Christophe Simonis 99bf9e4563 [MERGE] forward port branch saas-16 up to 89df681b45 2017-09-28 13:24:14 +02:00
Aaron Bohy f49d758665 [FIX] web: BasicModel: recursively compute onchange specs
Before this rev., onchange specs where only computed up to level
2 (i.e. for fields inside x2many fields). So basically, if there
were a one2many list inside a one2many (e.g. which opens in a
form view), the fields of that inner one2many list weren't added
to the specs, and it could lead to unexpected responses from the
server (like erasing the changes made on the inner one2many
records).

Closes #19600
2017-09-27 13:50:07 +02:00
Aaron Bohy c52b7ebd26 [FIX] web: tests: invalid XML in the arch
not detected by the runbot... but so the test isn't executed.
2017-09-27 13:01:04 +02:00
Aaron Bohy 2d3e5711f1 [FIX] web: escape pressed in editable list in dialog
should discard the edited row, but not close the dialog. Before
this rev., it was closing the dialog.
2017-09-27 12:13:58 +02:00
David Monjoie a3828dfed3 [FIX] web: fix o_row mechanism with phone field
The o_row class mechanism is supposed to be used to put another
element next to a field, like a button for example. However,
in the case of phone and email field, the o_text_overflow hack
gets in the way.

The problem that o_text_overflow is trying to solve is when you
have a long email, the table used to display the form view fields
tends to use very long cells (td) so it can display the whole email
address. This behavior completely breaks the form view, even though
the email address is clearly set to wrap in css. The o_text_overflow
class is a hack that forces the table to think that the email is
small, then defaulting to the width 50% css rules. If the email is
too long, it is correctly wrapped inside the cell, without breaking
the form view layout.

However, when we need to add a button next to those fields, this
hack gets in the way of the o_row class css rules, completely
wrecking it. We looked for a fix with qsm-odoo for hours but were
unable to find one that did not require a complete rewrite of the
form view css rules. In the end, we decided to remove the hack from
the phone field and keep it on the email field, as we think it is
less common to have a very long phone number than to have a very
long email.
2017-09-26 16:21:51 +02:00
Lucas Perais (lpe) e64762e535 [FIX] web, google_drive: fixed display of field link
Before this commit, a field handled with a widget url was given its value (href) as its text, fully displaying the url.
Moreover, the display was odd and did not match that of buttons

After this commit, if the field contains a text attribute, we use is as the text of the link.
The link also correctly displays and looks like a button (in a form view)

Of course, a test for this new field widget feature is implemented

closes #19587
2017-09-26 09:37:16 +02:00
Géry Debongnie bd113d0709 [FIX] web: properly destroy field widgets in some cases
Before this commit, the web client did not properly destroy field
widgets when updating a one2many after an onchange.  This is rarely an
issue, because in general, there are no other field widgets besides the
row currently in edition.  However, if we specify explicitely a widget,
or if we use a custom widget, it may be a problem.
2017-09-21 10:55:09 +02:00
Deep Patel 9b9fcfe628 [FIX] web,base: document template widget in settings
Go to General Settings, click on 'Change Document Template', and
in the opened dialog, click on a template.

Before this rev., it automatically closed the dialog, which was
not really convenient.

This rev. introduces a new field widget (image_selection) for
this use case, and ensures that the dialog doesn't close when
a template is selected.

Test written by @mba-odoo
2017-09-20 10:56:57 +02:00
Géry Debongnie 48b8be29fa [FIX] web: update x2manys when onchange add new line
In this commit, we make sure that if an onchange in a x2many modifies
another line, then the new data is properly shown.  This is quite
tricky, because the field x2many ignores the full extent of the changes.
Also, we obviously want to preserve the editing state (focused field,
...)

So, what we actually do is to rerender the full x2many (minus the new
line) to make sure that we preserve the correct row order.

Note: thanks to MGE for the test and some preliminary work.
2017-09-20 10:05:13 +02:00
Martin Geubelle 3136fc1643 [FIX] web: reuse datapoint with onchange one one2many
Since the rev. https://github.com/odoo/odoo/commit/2728fe1ec1ac7e99819d0f30f29a1814b00c82a4 the onchange create
command (0) send the virtual id as second argument. This argument is sent
back from the server and can then be used by the client.

As the client knows the virtual id, it can easily reuse the datapoint created
for this record and thus avoid creating a new one.

Creating a new datapoint can potentially lead to problems if the record has
for example specialData, that won't be kept.
2017-09-20 10:05:13 +02:00
Christophe Simonis d15a31ae6d [MERGE] forward port branch saas-17 up to 2a343d7c9c 2017-09-19 11:58:01 +02:00
Christophe Simonis 2a343d7c9c [MERGE] forward port branch saas-16 up to c3a48da767 2017-09-19 11:06:46 +02:00
Pratima Gupta de48daf53a [FIX] web: FieldDomain: don't open record from selection
The FieldDomain allows to open a list in a dialog to display the
records matching the current domain. In this dialog, clicking on
a record should do nothing (this was the behavior before the new
views).

Before this rev., it actually tried to open the record and it
produced a crash.
2017-09-19 10:14:24 +02:00
Christophe Simonis 66ca687324 [MERGE] forward port branch saas-17 up to ed901bedcb 2017-09-15 18:09:39 +02:00
Christophe Simonis ed901bedcb [MERGE] forward port branch saas-16 up to 80f916e8e0 2017-09-15 17:20:01 +02:00
Martin Geubelle cb540c48eb [FIX] web: correctly display the enterprise label
The `upgrade_boolean` widget should display an `Enterprise` label next to it.

There is however an issue when a `label` is specified for this field. In this case,
the `Enterprise` label should be placed next to the field label (and not the field
itself).

The easiest solution would have been to instantiate the field widget with its label,
but this can't work because the field widget is instantiated before its label.

We thus re-render the widget after its label creation.
2017-09-15 16:36:40 +02:00
Martin Geubelle 74c27d81ed [FIX] web: deal with can_create and can_write option in M2O
The server postproccess the view to add attributes on many2one fields, i.e.
`can_create` and `can_write`, according to access rights.

These attributes are parsed by the client as string but should also be parsed by
the many2one when evaluating them.

The mock server has also been adapted to set these attributes.
2017-09-15 11:03:09 +02:00
qsm-odoo 33f9e90bd5 [IMP] web, *: add kanban column progress bars
* crm, project

Add a new feature which allows to put a progressbar in the kanban
columns. The progressbar shows with the same color the amount of
records whose value of a given field are the same in the column.
It also indicate the sum of another given field or simply the total
number of records. It also allows to subgroup the column content.

To define a progressbar, add this as a direct child of the kanban
arch:

<progressbar field="<name of the field to use for subgroups>"
             colors="{<one possible value for the above field>: <success, warning or danger>, ...}"
             sum="<name of the field to sum or nothing to use total number of records>"/>

Also:
- Properly update record model data's parentID when moving a record
- ...
2017-09-14 23:48:56 +02:00
Christophe Simonis e390b0d640 [MERGE] forward port branch saas-17 up to 1e17035f71 2017-09-13 20:07:38 +02:00
Christophe Simonis 1e17035f71 [MERGE] forward port branch saas-16 up to 268cf9d04a 2017-09-13 19:32:35 +02:00
Martin Geubelle 917ba745ea [FIX] web, account: display partner in reconciliation
When selecting a partner in the reconciliation widget, using the SelectCreateDialog
(Search More), the partner wasn't correctly displayed.

This was due to a difference between the change format of the many2one ; when using
the dialog, only the `id` is sent (while the `id` and `display_name` are sent when
using the many2one dropdown).

These two behaviours are now standardized and both now send `id` and `display_name`.

It has the advantage of sparing some `name_get`s called by the model because the
`display_name` was missing.

This change implies some refactoring where the SelectCreateDialog was used.
2017-09-12 15:49:22 +02:00
Christophe Simonis c5f680200c [MERGE] forward port branch saas-17 up to d08b4407be 2017-09-12 12:09:11 +02:00
Christophe Simonis bd08d4f052 [MERGE] forward port branch saas-16 up to 3ac2a1106c 2017-09-11 14:02:19 +02:00
Martin Geubelle 14cb9af0d6 [FIX] web: only send changed fields on one2many after onchange
The server response to an `onchange` on a one2many is a list of
commands. In case of one2many update (command 1), the server
returns all fields (and not only the modified ones).
When saving the record, this is the client responsability to
specify which fields really changed.

Before this commit, all fields were sent at `write` and not only
the changed ones. This was causing issues when the user couldn't
write on the field ; an error was triggered even though the user
didn't change anything.

To fix this, we only tag as changed (in the datapoint `_changes`
attribute) the fields that have a different value after the onchange.
2017-09-08 12:27:43 +02:00
Sanjay Jamod 35cdf9076f [IMP] web: improved date field usability
- datepicker doesn't default to current date by default
- date string in the input is now selected when clicking the field
- adapted the existing tests to the new changes
2017-09-07 13:43:01 +02:00
fwi-odoo ef6074beb6 [FIX] web: fix x2m tests
When a x2m field is modified, the 'save' rpc doesn't send 'False' as second
argument of the special command that manipulate the set of records.
From now on, the virtual id of the record is sent to the server as second
argument. This commit fixes the tests making the assumption that 'False'
was sent.
2017-09-07 11:25:30 +02:00
Christophe Simonis d5382abeaa [MERGE] forward port branch saas-17 up to b8dd34fcbb 2017-09-06 17:40:59 +02:00
Martin Geubelle bae4aacad8 [FIX] web: edit x2many editable list view after resequence
In an embedded editable list view with the widget `handle`, resequencing a
record and try to edit it afterwards won't work. The selected record isn't the
correct one, as if the resequencing had no impact.

To make this work, the list datapoint needs to be ordered by the field with the
widget `handle` ; if it isn't, resequencing the records won't change the x2many
data order but the list view expects the same order.
2017-09-06 16:34:18 +02:00
fwi-odoo c0ceae2f93 [FIX] crm: module crm_voip doesn't exist anymore
Since the refactoring of VOIP, there is no more a module crm_voip but only
voip.
2017-09-06 15:18:19 +02:00
Christophe Simonis b8dd34fcbb [MERGE] forward port branch saas-16 up to 64d56995e0 2017-09-06 13:29:05 +02:00
Géry Debongnie 983c7ae22f [FIX] web: proper x2m edition with pagination
Before this commit, we did not really handle gracefully editing a
one2many with many records. The main issue is that if the user was not
on the last page, creating a new record added it to the last page, which
is confusing and actually a bad idea for records with required fields.

This fix requires a way to track the current changes (because we do not
display the current state of the form view: the new record is displayed
in the first page, but is actually added at the end of the dataset).

Note that this probably does not solve all issues with pagination. This
is a quite delicate problem. We will add tests and fixes as needed.
2017-09-05 15:41:28 +02:00
Aaron Bohy e818cba321 [FIX] web: tests: correctly reset AUTOCOMPLETE_DELAY
... once the test is done.
2017-08-31 16:41:37 +02:00
Christophe Simonis db546a3880 [FIX] web: correct test 2017-08-31 13:32:02 +02:00
Christophe Simonis 4879ce0407 [MERGE] forward port branch saas-17 up to fe77df3ba4 2017-08-31 12:55:41 +02:00
Christophe Simonis 71f370903c [MERGE] forward port branch saas-16 up to 600d015938 2017-08-30 18:18:59 +02:00
Christophe Matthieu 2728fe1ec1 [IMP] web: onchange x2many with virtual id in create command
When an onchange modifies an x2many field, the line on which the user
works remains in editable mode and the cursor is  returned to the same
position.
The second argument of create command is a reference used to reactivate
the edited line.
2017-08-30 14:39:17 +02:00
Aaron Bohy f1082f1552 [FIX] web: don't send virtual id on save
The problem occurred on form views with an x2many field with a
default value containing CREATE commands, i.e. when opening such
a form view in create mode, the x2many field is pre-filled with
some (non-existing yet) subrecords.

If the user then edited those subrecords, and then clicked on
'Save' to create the main record, an 'UPDATE' command was sent
alongside the 'CREATE' one for the x2many, and the id of the
'UPDATE' command was a virtual id (as the subrecord didn't exist
yet), and it crashed.

This could happen in MRP:
  - Enable lots in Iventory
  - Choose a product which is a component of another (through mrp bom)
  - Set this product as tracked by lot
  - Set this product inventory quantity to 0
  - Create a new manufacturing order for the product for which it is a
    component
  - Click on "Check Availability"
  - click on Produce: the many2many already contains a subrecord
  - edit the lot field of that subrecord
  - click on 'Record Production'
2017-08-30 12:29:47 +02:00
Aaron Bohy 4f61e7f048 [FIX] web: WidgetDomain: don't crash on false domain
Before this rev., when the value of a field with widget='domain'
was false, the search_count RPC made to display the number of
records matching the domain crashed, and the widget displayed that
the domain was invalid. This rev. adds a fallback on [] when the
domain is false.
2017-08-29 13:59:49 +02:00
Aaron Bohy c5bf53682e [FIX] web: prevent 'load' event from being handled twice
In grouped list view, when a pager is clicked inside a group, a
'load' event is triggered to reload the data with the new offset.
The event is handled by the list's controller.

However, when the list is in the modal, the event must be stop
propagated by the controller of the modal, so that it doesn't go
up to the controller of the view displayed behind the modal. It
happens for example by reproducing the following steps:
  - go to Lunch
  - add a line
  - search more products
  - group by vendor in the modal
  - unfold a group
  - click on the pager (the group must contain more than 80 records)

Before this rev., it crashed because the controller of the form
view tried to handle the event.
2017-08-29 13:12:34 +02:00
Khoi Nguyen 5149e18ec7 [FIX] web: always display handle widget
Before this commit, a list containing a handle widget would only display
the handles associated with non-zero integer values. This is due to the
fact that unset fields are hidden in Odoo, while a field is by default
considered 'defined' if its value is truthy.

We override the isSet method for the handle widget to always return
true. This tells the handle widget that the associated integer value is
always defined, thereby ensuring that the handle will always be shown.
2017-08-29 11:41:32 +02:00
Aaron Bohy d93726f9ac [FIX] web,mail: only send fields in view for onchanges
The field 'display_name' is automatically added to the list of
fields to fetch when fetching a record. Before this rev., its
value was also sent alongside the fields in the view for onchange
RPCs. It shouldn't: only the fields in the view should be sent.

It produced a weird bug in the res.partner form view: open a
contact (company), add a sub-contact, save -> the display_name of
the contact was then '' (and 'Contacts' was displayed in the
breadcrumbs instead of the display_name of the opened contact).
This is because 'display_name' was sent to the onchange, which
returned '' as value (because of another bug python side). So as
it's value changed, when saving, the new display_name was sent to
the server (even if this field was actually readonly).

Before this rev., we also always fetched 'display_name' when
fetching list of records (read or search_read). This wasn't a bug
per se, but it might be a computed field, and it isn't necessary,
so we stop fetching it in that case if it isn't in the view (as
it was done in saas-15, before the new views).
2017-08-29 10:38:36 +02:00
Christophe Simonis d0f132b297 [MERGE] forward port branch saas-16 up to 4ac347735d 2017-08-28 14:49:11 +02:00
Aaron Bohy 7095c32f1c [FIX] web: tests: correctly destroy view 2017-08-25 15:54:56 +02:00
Christophe Simonis 017ee5eab3 [MERGE] forward port branch saas-17 up to 877e709871 2017-08-24 13:17:53 +02:00
Géry Debongnie c0247e6a8d [FIX] web: correct evaluation for x2many fields in onchanges
Before this commit, it could happen that a x2many field was considered
invalid, which prevent triggering onchanges, even though each of its
required fields are properly set.  Here is such a scenario:

We have a one2many field something_ids in a form view, with an inline
tree view, which contains a field X.  The field X is required on the
model, but marked required="0" in the inline view.

In that case, we incorrectly evaluated the required modifiers: since the
attrs did not contain the required attribute, we fell back on the
field_get value, which is true in this case.  But this is not correct,
the fieldviewget already computed the actual modifiers and took into
account the fact that it was overridden.  We need to only look at the
modifiers.
2017-08-24 10:58:28 +02:00
Christophe Simonis 30bd5ac0e9 [MERGE] forward port branch saas-16 up to aec6248bb3 2017-08-23 16:44:58 +02:00
qsm-odoo e0d5a875f0 [FIX] web: make "slow" create of m2o fields work
There were some coding mistakes since some changes introduced by
https://github.com/odoo/odoo/commit/d19671f0d0ff7189055cbe0794afed32f8a387e6
2017-08-23 15:14:37 +02:00
Martin Geubelle dbab6f7417 [FIX] web: advanced use of widget reference
The reference widget is also meant to be used on a char field, not only on a
reference field.

The rev. https://github.com/odoo/odoo/commit/a4e30a1b43d0b9acd76508d9e6c466cd1dbdffab removed
the use of `field_utils.format.many2one` and replaced it by `_formatValue` to
support this use case.

The replacement wasn't complete as some occurences was remaining (in reset),
which led to traceback when the widget was reset (impossible to create an
External Identifier anymore).

Also, the reference `_formatValue` wasn't correct as it was displaying the
record `display_name` and not the reference field value ; this only makes sense
for the External Identifier as its display name is the reference field value but
it doesn't make any sense for other reference field.

Last but not least, this commit implements the `onchange` and `default_get` for
the reference field.
2017-08-22 14:18:14 +02:00
Aaron Bohy 74fe046e1a [FIX] web: missing test case for fix 0966f75b 2017-08-18 13:34:37 +02:00