Commit Graph
110790 Commits
Author SHA1 Message Date
Martin Geubelle 4efa4e9d94 [FIX] web: BasicModel: default_get: correctly fetch m2o inside o2m
In general (e.g. read, search_read), values for many2one fields are pairs
[id, display_name]. The default_get is an exception, it only returns the id,
so we need to manually perform a name_get afterwards. In the case of
list views, those name_get RPCs are batched.

Before this rev., the code in charge of it didn't handle the case where the
many2one value was false, so it crashed when it happened.

This rev. deals with this use case and a test case has been added.
2017-08-18 12:59:11 +02:00
Cedric Snauwaert 7fa39d6e04 [FIX] account: reconciliation: display name and ref instead of just ref
+ some css fix to better display
2017-08-18 11:50:44 +02:00
Richard Mathot 0966f75b7e [FIX] web: enforce length-limited char fields
In Odoo 10.0, `Char` fields with a maximum `size=` attribute were
indeed limited in the web client.
2017-08-18 11:34:21 +02:00
qsm-odoo 1ca79bd9f1 [FIX] mail, web: use 'o_input' class on kanban and discuss elements
Since the new views, the 'o_input' class has to be set explicitely on
<input/>, <select/> and <textarea/> elements to have the proper styling.
2017-08-18 10:56:32 +02:00
Olivier Dony b31577a11a [FIX] portal wizard: fix compatibility w/ new views
New saas-16 web views have a more consistent handling of `readonly`
attributes and do not save read-only fields inside x2m. In the previous
implementation this was an exception to the rule (even if rather
inconsistent/unexpected).
A new attribute `force_save` was introduced to workaround the default
behavior when considered necessary.

The portal wizard is affected by the change, as the partner_id field of
the lines is readonly but required. It could be avoided by filling the
wizard lines before opening it, instead of relying on default values and
onchanges. However this would likely require extra boilerplate code and
an extra server action. Dropping the readonly flag would work too, but
would look weird.

Using the new `force_save` flag is a simpler alternative.

See also rev. 3b3f6f04af
2017-08-17 21:06:37 +02:00
Jeremy Kersten a313bcf7f3 [FIX] website_hr_recruitement: allow to map the list 2 times.
Don't uses generator, since some code need to access after the foreach on 'jobs'.
2017-08-17 21:40:33 +02:00
Jeremy Kersten 6d43322f1a [FIX] website_crm_partner_assign: get the lead to forward at save
When forwarding a list of leads to a partner, the lead_id was not send.
As the field `lead_id` is readonly, its value wasn't sent by the client
on save click.

This behaviour of not sending readonly fields in x2many has been correctly
implemented with the new views but some views (like this one) was basing
their behaviour on this breach.

See rev. odoo@3b3f6f0 for more details.

fix-feedback-saas16
2017-08-17 21:40:13 +02:00
Adrien Dieudonne bbf63b0b56 [FIX] web: Calendar: correctly display events
Before this rev., the events in Calendar views (month mode) weren't
correctly displayed: the last day of the event wasn't displayed as
being part of the event. For instance, in leaves, a leave of 3 days
from the 16th of Augustus until the 18th was only displayed over
the 16th and the 17th.

Moreover, when an event was created from a Calendar view with
option all_day=False, the default start and end dates weren't
correctly computed according to the user timezone, which could lead
to the creation of multiple days event whereas the user clicked on
a specific day. For instance, with timezone GMT+2, when clicking on
the 18th of Augustus in the Leave Calendar view (month mode), it
opened a dialog for the creation of a 2-day leave from the 18th to
the 19th.

This rev. fixes those two issues.
2017-08-17 17:40:41 +02:00
Adrien Dieudonne f5b7ad80fc [FIX] web: always use browser timezone
With the new views, we stopped using the browser timezone to
display the dates in Odoo, and we used the timezone defined on
the User profile instead. When loading the webclient, the
timezone offset was put into the session and used to display all
dates. This wasn't a good idea.

The given offset was computed for the current time, meaning that
it may be incorrect for specific dates (e.g. with the daylight
saving, the UTC offset of today is not the same as 6 months ago).
Moreover (but less likely), as the offset was stored in the
session, it wasn't recalculated afterwards. So if the offset
actually changed during the session (e.g. from or to daylight
saving time), the displayed dates were incorrect until the user
reloaded the page.

With this rev., we don't retrieve the offset from the server
anymore and we use the browser timezone again (like before the new
views). However, we keep the computation of the offset (on the fly)
in the session, so that it can be mocked in the test environment.
2017-08-17 17:24:00 +02:00
Adrien Dieudonne b9bfec96dd [FIX] web: don't apply timezone offset for date fields
Before this rev., all date fields values were off by one day as
soon as the user timezone was negative.

With the new views, all dates manipulated by the JS are moment
instances in UTC, and when being displayed, they are correctly
formatted in the user locale by applying the timezone offset.
However, this should obviously not be done for date fields as
when no time is specified when creating a moment instance, it
defaults to 00:00:00, so applying a negative offset always leads
to the day before.

Remark:
It happens that datetime fields are displayed as a date (e.g.
purchase order line form view). In that case, the offset is
applied on the displayed date.
2017-08-17 17:24:00 +02:00
Martin Trigaux 88dfcfd025 [FIX] gamification: remove leftover debugger 2017-08-17 16:42:06 +02:00
rar-odoo 7e24143b35 [FIX] gamification: challenge winner (#18901)
In the curent behaviour, the users of the challenge are ordered
regardless of the goal definition (higher wins or lower wins).
This impacts the report email with the podium of users and always puts higher on top.

This fix changes the ordering depending on the goal definition type.
2017-08-17 16:30:48 +02:00
Martin Geubelle cd0ba4234b [FIX] web: avoid SelectCreateDialog editable list view
As its name indicates, the SelectCreateDialog is meant to select and create,
not edit.

If the view is editable, clicking on an element will edit it instead of
selecting it. For this reason, the view is set in `readonly` even if the view
arch uses the attribute `editable`.

Before this rev., you couldn't select a "Close Reason" when closing a
subscription (in "Search More").
2017-08-17 16:08:07 +02:00
Martin Trigaux 23ddb3ce63 [FIX] sale_timesheet: count timesheet with employees only
Timesheet created using the UI are supposed to all have an employee defined.
However, this field is not required and it is possible to have timesheet without
a user defined.

Feedback ged from saas-16 migration
2017-08-17 15:14:50 +02:00
Olivier Dony 6bafe8e9a8 [FIX] mail, mrp: adapt attachment kanban to new ID format
As of saas-16 and the new web client views, the "display value" for a
record's ID is now formatted with thousand separators.

This breaks a few kanban views where the ID was inserted into a
dynamic URL. Using `raw_value` is correct too and fixes the problem.

Note: This might affect other kanban views using integer field values,
but a quick search did not yield anything. Many2One fields already had
different "display values", so `raw_value` is already used when needed.
Other integer fields, such as computed counts and sums are often
displayed but not inserted into URLs or technical values where
the problem would occur.
2017-08-17 14:15:13 +02:00
Khoi Nguyen 15f14cee2a [FIX] web: unexpected 'group by' when switching away from Kanban
Currently, the 'environment group by', if previously empty, is set to a
view-specific default value when filtering in a Kanban view. This then
causes an unexpected 'group by' when switching away from a Kanban view,
since the expected behaviour is to only take a Kanban 'group by' into
account if it was explicitely set by the user.

This is caused by the fact that the 'search' event triggers a view
reload which takes the environment as parameter, while the Kanban view
reload overrides the group by (arrays are passed by reference).
Both result in an undesired modification of the enviroment.

We fix this bug by giving a shallow copy of the environment as parameter
when triggering the view reload.
2017-08-17 10:51:50 +02:00
Martin Geubelle 68d0ca03da [FIX] web: edit (list editable) one2manys inside one2manys
Since rev. https://github.com/odoo/odoo/commit/ebd17217c4e7e9ff06d97028de64fb2fc44d6266
the attribute `_editionViewType` has been introduced to use the modifiers from the correct
one2many view type.

This attribute wasn't correctly populated if multiple one2manys were imbricated. The
first view type (form in the test case) was set for the second one2many even though
the view type was list. This was due to the `visitChildren` function use that browses
through all levels (and not only the first one).

To reproduce the bug before this rev. you could try to create a new survey, add a
question (one2many) then select multiple choice and add an answer (one2many editable).
2017-08-16 17:27:48 +02:00
Aaron Bohy ab2e71d9fc [FIX] web: Kanban: notify environment of ids changes
In grouped Kanban views, the list of res_ids of the displayed
records may change for several reasons:
  1) 'Load more' is clicked for a column
  2) a record is moved from a column to another
  3) a record is moved inside a column (resequence)
  4) a column is moved
  5) a column is (un)archived
  6) a column is (un)folded
  7) a record is created/destroyed directly from the Kanban.

When this happens, the environment must be notified of the new
list of res_ids (the order matters). Before this rev., this wasn't
the case. As a consequence, when a record was opened in a Form view
after one of the 5 operations above, the pager could display
unexpected values.

Note that before the new views, cases 2, 3 and 4 weren't handled,
and case 7 already worked before this commit.
2017-08-16 13:03:33 +02:00
Aaron Bohy b5b8e66b90 [FIX] web: grouped views: update pager
The problem occured when opening a record from a grouped list or
kanban view. In the opened form view, the pager was sometimes
incorrect. This was because the list of ids wasn't correctly
updated when groups were opened/folded.
2017-08-16 13:03:33 +02:00
fwi-odoo 591927cfe0 [FIX] web: search_view: display the integer field autocompletion
Before this commit, the integer fields were not displayed in the autocompletion
dropdown.
This commit fixes a typo that broke the behaviour.
2017-08-16 12:33:18 +02:00
Khoi Nguyen f6c660b752 [FIX] web,pad: ensure pad content is displayed after discard
Up to this revision, clicking on 'edit' in a record with an existing pad
and discarding the changes straight away caused the pad content not to
be displayed.

The root cause of this issue is twofold:

- a hack tricks the model into thinking the pad URL has changed by
  replacing it with an object yielding the URL when JSONified;
- the pad never affects the 'dirtiness' of a record and BasicModel only
  actually discards changes when the record is dirty.

When a user clicks on discard, the model does not actually discard the
changes, thereby leaving the web client into thinking the pad URL is the
object mentioned above.

We fix this issue by requiring that the model always discard changes
when clicking 'Discard', regardless of whether the record is dirty.
In fact, the lines we changed were no longer correct since the
introduction of 'doNotSetDirty' (see
https://github.com/odoo/odoo/commit/72ed3a1), as a record could be
changed without being dirty. This commit thus also ensures that such
records are also properly discarded.
2017-08-16 11:00:44 +02:00
Khoi Nguyen 178873d433 [FIX] web: fix copy (Ctrl-C) of text field content in Firefox
Before this commit, it was not possible to copy the contents of a
multiline text field in read-only mode in Firefox without losing all
line breaks in the process. This is due to a bug affecting div tags
(see https://bugzilla.mozilla.org/show_bug.cgi?id=1390115) in Firefox.

This commit ensures that the text in a text field is surrounded by a
span (as opposed to div) tag.

Note that spans were used in saas-15, so we are in fact simply undoing
the change to divs introduced by the new views.
2017-08-14 15:27:58 +02:00
Khoi Nguyen 7978f846d1 [FIX] web: correct first render of calendar when changing the date
As mentioned in
https://github.com/odoo/odoo/commit/a752e7d1458b1d689a028fcf89b582ae74333d49,
a resize after the first render is necessary to prevent overflow issues
with fullCalendar. As changing the date would rerender the calendar, we
also need to trigger a resize then.

From this revision onwards, a resize event is triggered every time the
calendar has finished rendering its events.

Unfortunately, I was not able to write a meaningful and successful test
(I encountered PhantomJS-specific issues). I also removed the test for
https://github.com/odoo/odoo/commit/a752e7d1458b1d689a028fcf89b582ae74333d49
because it always passed regardless of whether the fix is applied.
2017-08-14 11:42:12 +02:00
Khoi Nguyen 1e65cd3d4e [FIX] web: fix traceback when saving fields list during data export
The traceback was caused by an occurence of this.dataset, which was left
out in the new views refactoring (this.dataset has been replaced by
this.record).
2017-08-11 17:44:30 +02:00
Aaron Bohy 5fce37486a [FIX] web: BasicModel: default_get: false m2o inside o2m
Sometimes, a default_get returns a create command for a one2many,
with a dict of values containing value 'false' for a many2one. This
is strictly equivalent to the case where the many2one field isn't
in the dict of values, but we have to handle both cases, and before
this rev., we only handled the latter one.

This happens for example in Sales > Leads (must be activated in the
Settings) > in the list view, check several leads > in 'Action',
click on 'Forward to Partner' > crash.
2017-08-11 10:29:56 +02:00
Aaron Bohy 870aa81ad9 [FIX] web: BasicModel: default_get: handle false value for o2m
The value for one2many fields returned by default_get may be a
list of commands, or directly a list of ids. These cases were
correctly handled. However, it seems that the value can also be
false, and when this happened, it crashed. For instance, go to
Sales > Leads (must be activated in the Settings) > in the list
view, check several leads > in 'Action', click on 'Convert to
Opportunities' > crash.
2017-08-11 10:28:12 +02:00
Aaron Bohy 3b7fb9934d [FIX] web: BasicModel: keep onchanges on unknown fields
Let's assume the following situation: we have a one2many field
displayed as a list in a form view. The list isn't editable, so
when a subrecord is clicked, it is opened in a form view in a
dialog. In this form view, there is a relational field X that is
not in the list. In the main form view, there is a field with an
onchange. When its value changes, the onchange returns a new
value for the one2many: a command 5 (delete all), and a command 0
(create) with a dict of values containing a value for X. However,
as X is unknown as long as no subrecord has been open in the dialog,
the value for X can't be processed (we don't know the type of X,
so we don't know how to process the value).

Before this rev., when this happened, we discarded the value of X.
This caused an issue for example in the Quotation form view (with
website_quote installed):
 - create a new Quotation
 - set PartnerShip Contract as quotation template -> the onchange
   returns two 'create' commands for the order_line one2many
 - click on one of the two subrecords in the one2many -> error.

This rev. ensures to keep changes on unknown fields. We keep them
unprocessed, and once the form view is opened, we process and
apply them.
2017-08-11 10:28:12 +02:00
Jérome Maes a7985a5abb [FIX] sale_timesheet: revenue computation with sudo()
Since the revenue computation is an automatic system
action, it should be done in sudo(). This avoid access
error.
Indeed, if a company creates and confirms a SO, a task
can be created in another company project. Logging
timesheet from the project company is thus impossible
since the user can not access SO line of the origin
company.

Adding sudo() seems better than givin read access
to 'all' so line for timesheet user.
2017-08-11 10:14:31 +02:00
Christophe Simonis 85571bb78c [MERGE] forward port branch saas-15 up to dde62073ba 2017-08-10 16:22:36 +02:00
Christophe Simonis dde62073ba [MERGE] forward port branch saas-14 up to a2361e23ea 2017-08-10 16:17:28 +02:00
Christophe Simonis a2361e23ea [MERGE] forward port branch 10.0 up to 544aa9b04a 2017-08-10 15:45:07 +02:00
Christophe Simonis 544aa9b04a [MERGE] forward port branch saas-11 up to cfbac106b4 2017-08-10 15:00:33 +02:00
Christophe Simonis cfbac106b4 [MERGE] forward port branch 9.0 up to 1aed433f54 2017-08-10 14:58:24 +02:00
xmo-odoo d140f0ef0e [FIX] prefetch issues on computed/related fields (#18644)
When deciding to prefetch records (getting records from the cache with
no value for the field being fetched), if the field was computed
`determine_value` would just get all records, not limited by the normal
prefetch limit; for large recordsets this would generate gigantic
prefetch lists for records we may not need at all.

Fix by applying the `PREFETCH_MAX` limit to records from the cache as is
done in `_prefetch_field`.

Complementarily, when traversing related fields the prefetch
environment would be lost and every record would get an empty prefetch
environment, so the values would ultimately be read one by one.

Example: select (search) 1000 product.product records, access a
related field (e.g. categ_id) in a loop, on the first iteration the
system would first read 1000 templates, then it would read each
categ_id individually, resulting in >1000 SQL queries rather than the
~2 we would expect.

Fixes #18511
2017-08-10 14:51:27 +02:00
Aaron Bohy deba788b4c [FIX] web_editor: html_frame: saving in readonly
A form view record may be saved even if the record is displayed in
readonly (e.g. when a button in the form view is clicked). When
this happened, if there were an html field with html_frame widget
in the form, it crashed (e.g. in Email Marketing > Mass Mailings >
open one > click on Test Mailing).
2017-08-10 13:56:22 +02:00
Aaron Bohy 87133a8235 [FIX] web: BasicModel: correctly reload new records
Commit 7cd2f6370 (in 10.0) recently added attribute special='cancel'
on the 'Cancel' buttons of the Settings views in Odoo. The attribute
wasn't really supported in this case by the old web framework, so
this commit also slightly adapted it, and made it reload the whole
webclient when such a button is clicked.

This commit now needs to be forwardported in saas-16, so we have to
handle the case in the new views as well. Before this rev., it
crashed, because the BasicModel tried to reload a new record (the
one of the Settings form view), so basically it performed a 'read'
RPC on a virtual ID like 'virtual_123', and the server didn't really
appreciate.

This rev. handles the case where a new record is reloaded, and
simply performs a 'default_get' instead of a read. Bonus point:
with the new views, we don't have to reload the whole webclient.
2017-08-10 13:56:22 +02:00
Nicolas Lempereur 354539942d [FIX] website_sale: no-cache IE11 cached cart XHR
IE11 seems to be always using cache when doin an XHR request with the
same GET request.

It can be changed in several ways:

- returning a header: "Cache-Control: no-cache"
- altering the GET request with a nonce
- using the POST method instead of GET

to solve it, in this change the HTTP header is added on the response.

opw-752270
closes #18787
2017-08-10 13:41:37 +02:00
Jérome Maes 9b4c8a4e31 [IMP] hr_timesheet: default employee
'default_get' should return a value for employee
 when asked, even if it is not a timesheet.
2017-08-10 11:29:36 +02:00
Adrien Dieudonne 3a886327a6 [FIX] pad: don't consider record as dirty
Before this rev., when the user opened a form view
containing a pad widget, with a pad url already configured,
a dialog directly popped asking "The record has been
modified, your changes will be discarded. Are you sure you
want to ?".

This is because of an unconventional behavior of this
widget: the field actually encodes an url, the one of the pad
to display. When the user saves, a write is forced so that
the server can retrieve the pad's content and store it in DB.
To force the write, the widget always notifies a fake change
on the url. However, we don't want this change to trigger
the confirm dialog. With this rev., this fake change doesn't
make the record 'dirty'.
2017-08-10 10:33:05 +02:00
Goffin Simon 1aed433f54 [FIX] website_event: Website Event Error when you encode a 0 value in the registration
The function registration_new must return a type json.

opw:765643
2017-08-10 09:27:05 +02:00
Nicolas Martinelli ac392096d8 [FIX] stock: recompute display name
The display name of a location should be recomputed when the name of the
parent location is changed.

opw-761463
2017-08-10 09:00:59 +02:00
Aaron Bohy 1e8f6d01ff [FIX] web,*: send correct context on button clicked
*account_asset

When a button of type 'action' is clicked (execute a given action),
special keys must be set in the context (active_id, active_ids and
active_model). They must be computed regarding the record containing
the clicked button, i.e. if we are in a modal, it must be the id
and model of the record displayed in the modal.

Before this rev., we always sent the id and model of the record
displayed in the background (i.e. the id and model of the url).

This caused a bug in MRP that could be reproduced as follows:
- open a manufacturing order in form view
- click on edit
- click on one of the line of the one2many, and click on the green
  icon to edit a product
- click on the update product quantity button on top of it
- the product field must be correctly filled, which was not the
  case before this rev.
2017-08-10 08:48:32 +02:00
David Monjoie 50957038b9 [FIX] web: fix magic grouping on date fields
Date fields have magic grouping methods to specify how to group on
them like date:month, date:weeks, date:days for example. It needs
to be handled properly since date:month is not a valid field name
but date is.

Steps to reproduce the issue:
- Go to Sales/Dashboard
- Click on My Pipeline
- Group by "Creation Month"

Basically, this can be triggred from any view which has a search
view which defines a group using the magic date grouping methods.
2017-08-10 08:48:30 +02:00
Olivier Dony 08b75b7bcb [FIX] pad: do not crash during record creation
Backport of 0de067cae9
(and 9b8bc5e5a1)

Rev. c5bd509274 attempted to improve the
pad sync mechanism when merging records (tasks), but failed to consider
the case where the pad_url field is not set yet.
This happens at create(), due to the chicken-and-egg problem with the
pad URL depending on the record ID, and therefore set *after* creation.

Ignoring the sync when the URL is not yet set should be enough, as the
URL generation method also takes care of that first sync.
2017-08-09 18:51:16 +02:00
Christophe Simonis 3e54d9b56d [FIX] event_sale: SyntaxError
oversight of previous forward-port
2017-08-09 17:29:27 +02:00
Christophe Simonis c3d710d2f6 [MERGE] forward port branch saas-14 up to 80ac087d6e 2017-08-09 17:11:10 +02:00
Olivier Dony 0de067cae9 [FIX] pad: do not crash during record creation
Rev. c5bd509274 attempted to improve the
pad sync mechanism when merging records (tasks), but failed to consider
the case where the pad_url field is not set yet.
This happens at create(), due to the chicken-and-egg problem with the
pad URL depending on the record ID, and therefore set *after* creation.

Ignoring the sync when the URL is not yet set should be enough, as the
URL generation method also takes care of that first sync.
2017-08-09 16:38:56 +02:00
Christophe Simonis 80ac087d6e [MERGE] forward port branch 10.0 up to f69655829a 2017-08-09 15:53:37 +02:00
Christophe Simonis f69655829a [MERGE] forward port branch saas-11 up to acbcfa3703 2017-08-09 14:43:39 +02:00
Christophe Simonis 6554d95ed0 Revert "[FIX] crm, sale_crm, sales_team, website_crm_partner_assign: change context key"
This commit is not retro-compatible with existing database.
Moreover, the underlying issue (opw-757039) has been fixed via commit
baca743cc0.

This reverts commit 8510c0ce37.
2017-08-09 14:20:54 +02:00