Commit Graph
116189 Commits
Author SHA1 Message Date
4e204ed223 [IMP] web: restore scroll position
This rev. improves the way the scroll position is restored when
coming back to a view (e.g. open a kanban view, scroll, click on a
record to open it in a form view, go back to kanban using the
breadcrumbs):

 - generalize the scroll position handling from web_enterprise to
   web to make it available in the community webclient as well
 - also restore left scroll position, not only top (especially
   useful for grouped Kanban views with a lot of columns)
 - handle the case where the scrolling area is a sub element of
   the view (e.g. the grouped Kanban view in mobile).

Task 34037

Co-authored-by: Mohammed Shekha <msh@openerp.com>
Co-authored-by: Ankit Sathvara <asa@odoo.com>
2018-03-10 09:01:46 +01:00
qdp-odoo 1a99d22f19 [IMP] account: filter res.partner.bank on account.journal
In order to avoid people selecting a bank account not belonging to the partner's company, we now filter using a domain.
Original idea from PR #23480. Courtesy of Miquel Raich (Eficent)
2018-03-09 16:58:02 +01:00
Christophe Simonis 0f57bdba72 [MERGE] forward port branch saas-11.2 up to 42659dc70c 2018-03-09 16:25:58 +01:00
Fabrice Henrion 35f0797002 [IMP] account: rephrase field label
crediting is not refunding

Closes #19001
2018-03-09 15:45:21 +01:00
Adrian Torres bbfb098a54 [IMP] fields: allow shared fields
Given the following variables:
    * Module A
    * Module B
    * Model M
    * Field X of model M

If module A defines M.X and is installed, an xmlid for this field is
generated in the form of A.field_M_X

Before this commit:

If module B defines M.X as well and is installed after module A, no
xmlid is generated.

This means that if module A is uninstalled, the single xmlid pointing to
M.X will be deleted and thus, the field itself will be deleted as well,
therefore any views from module B referencing M.X will crash.

After this commit:

If module B (or any subsequent modules) define M.X, an xmlid will be
generated in the form of B.field_M_X.

If module A is uninstalled, the xmlid A.field_M_X will be deleted, but
B.field_M_X will remain and thus the field itself won't be deleted.

This system means that for a single actual field, there can be multiple
xmlids, each xmlid sharing the same field, thus the name "shared
fields".

Task ID 38016
2018-03-09 15:44:39 +01:00
Hiral Bhavsar ed4cbf57dc [FIX] account: fix account.payment creation from dashboard
From 'Accounting Dashboard', creating a new payment was raising an error 'Record does not exist or has been deleted.'.
That's because since cdca5d4751 the default_get() was expecting to be called directly from the account.invoice model, using 'active_ids' to compute default values. Since it was incorrect, we now also check for the active_model to avoid raising this error.

Was PR #23548
Was task: 1824893
2018-03-09 13:50:15 +01:00
Thibault Delavallée 27098b505a [DOC] test_mail: update performance counters
Commit 42659dc70c recently done in saas-11.2 added performance test cases
in test_mail module allowing to cover more use cases. Since release of
saas-11.2 some optimizations already landed in master pre-saas-11.3 and
some features have been refactored.

This implies updating the performance counters. This is done in a separate
commit to distinguish previous-counters from current counters instead of
loosing it in a diff.

Most message-post related tests have been improved by some queries as
message creation has been speeded up at f727e9d9b6. Some other commits
like 9de5d41754 also slightly improved performances. Activities-related
performance have been improved at e899812315. Tests case involving
assignation notification perform worst than in saas-11.1 . It is linked to
the feature using more advanced email and templates as well as working for
Inbox too which is not the case in saas-11.2. This improvement has been done
at e9734f4975 .

This commit is related to task 1824965. Thanks to @KangOl for being
nice with people trying to make its forward-port more difficult.
2018-03-09 13:13:47 +01:00
Thibault Delavallée b971d9c4e4 [IMP] test_mail: add performance tests to cover more separate features
This commit is a manual forward-port of saas-11.2's 42659dc70c .

In test_mail there are performance tests involving several followers and give
counters for some heavy real-life-like use cases. Purpose of this commit is to
have more basic performance tests for main mail features, like simple post,
simple subscription of one follower. It allows to have an idea of the basic
cost of various features.

Adding use cases for message_post includes
 * posting without followers (aka, no notification)
 * posting with a ping (by email or by inbox)
 * logging a note with optimized method _message_log or with message_post

Adding use cases for activities includes setting an activity as done. This
action posts a message and is therefore interesting to evaluate.

Adding use cases for subscription includes
 * adding and re-adding one follower, with default or specified subtypes
 * updating responsible field triggering a simple tracking and an assignation
   email or notification (not completely supported in saas 11.2 meaning this
   counter will increase when forward-ported)
 * note that some subscription tests have already been added at a01933c9b4

Finally some heavier tests are added for assignation and tracking based
on QWeb view.

This commit is related to task ID 1824965 . This one is an ongoing task
and several commits may be linked to that task.
2018-03-09 12:53:49 +01:00
Thibault Delavallée 19849785f5 [IMP] test_mail: add unit and performance tests about adding followers
This commit is a manual forward- port of saas-11.2's a01933c9b4 .

Purpose of this commit is to test existing behavior of followers subscription
as well as adding some query count tests about message_subscribe method. As
followers subscription technical implementation may change in a near future
in order to be optimized it is a good idea to have current behavior and query
count validated.

This commit adds

 * test for followers update using message_subscribe API. Tests are added
   with forced and unforced subtypes to ensure behavior will not change or
   will be changed while knowing it;
 * performance test about message_subscribe, about adding new followers,
   and subscribing already-existing followers in force mode or not;

Query count performance test shows that message_subscribe could probably
be improved. It does several things that require queries (check of access
rights, check for existing subscriptions, ensure customers have no access
to internal subtypes, ...). However we feel it could be improved in order
to speed-up the subscription of followers.

This is linked to task 49265; it is only the first steps of it.
2018-03-09 12:53:49 +01:00
Thibault Delavallée 42659dc70c [IMP] test_mail: add performance tests to cover more separate features
In test_mail there are performance tests involving several followers and give
counters for some heavy real-life-like use cases. Purpose of this commit is to
have more basic performance tests for main mail features, like simple post,
simple subscription of one follower. It allows to have an idea of the basic
cost of various features.

Adding use cases for message_post includes
 * posting without followers (aka, no notification)
 * posting with a ping (by email or by inbox)
 * logging a note with optimized method _message_log or with message_post

Adding use cases for activities includes setting an activity as done. This
action posts a message and is therefore interesting to evaluate.

Adding use cases for subscription includes
 * adding and re-adding one follower, with default or specified subtypes
 * updating responsible field triggering a simple tracking and an assignation
   email or notification (not completely supported in saas 11.2 meaning this
   counter will increase when forward-ported)
 * note that some subscription tests have already been added at a01933c9b4

Finally some heavier tests are added for assignation and tracking based
on QWeb view.

This commit is related to task ID 1824965 . This one is an ongoing task
and several commits may be linked to that task.
2018-03-09 12:34:21 +01:00
Martin Trigaux d8e2f6a89d [IMP] purchase: do not make the field required
The value is made by the computed field.
Setting one has no effect (no inverse method).

If you have no value on a purchase order, you end up in the confusing situation
where you can not save a new PO without setting a value to date_planned but,
after saving, the value is reset (no lines).

Do not block the creation of a new purchase order without lines

Fixes #23275
2018-03-09 11:22:57 +01:00
Aaron Bohy 6b9632effe [FIX] mail: adapt forwardported tests
The ChatManager has been refactored in saas-11.2 to make it fully
(and more easily) testable. This means that tests involving
messaging stuff written in previous versions need to be slightly
adapted when being forwardported to saas-11.2. In particular, the
3 tests adapted in this commit broke because of an include done in
the voip addon. Those tests have been added in 3809fc891.
2018-03-09 09:27:52 +01:00
Fabien Meghazi 985bb12488 [FIX] server: support for systemd socket activation in threaded server
This patches fixes the untested and broken draft of inetd and systemd
activation support in the threaded server.

This patch also introduces a change of behaviour in the `_reexec()`
function by keeping the environment when Odoo is respawning during the
following events:

    - SIGHUP signal is received
    - one click install has been triggered
    - code reload needed when using `--dev=reload`
2018-03-09 09:03:58 +01:00
Aaron Bohy 0a66ca3909 [FIX] web: ActionManager: push state of loaded actions
Actions loaded from the url are flagged with 'pushState: false', to
prevent them from pushing their state back to the url, thus
producing an infinite loop. However, if the state of a loaded
action changes in the future (e.g. load an action in kanban view,
then switch to a form view), this state should be pushed to update
the url. Before this rev., this wasn't the case.
2018-03-09 08:33:22 +01:00
Christophe Simonis 52a190dc09 [FIX] test_new_api: declare fields in correct model 2018-03-08 19:27:43 +01:00
Christophe Simonis a0aa939d9b [MERGE] forward port branch 11.0 up to fcb48b7241 2018-03-08 19:00:04 +01:00
Christophe Simonis fcb48b7241 [FIX] purchase,stock_dropshipping: keep current company currency
Changing it is not needed and generated missmatch against existing
entries (created by l10n_generic_coa demo data, thus depending on module
install order).
2018-03-08 18:16:55 +01:00
Géry Debongnie c7b5b12be6 [FIX] web: add the node attribute to the form view widget
This could (should?) be considered a refactoring, but this is actually
trying to restore lost functionality.  In v10, the custom form widgets
were created with access to the node element that define them.  We lost
that in v11, with the new views.

However, it is actually very useful for generic widgets.  Since this is
not really a risky fix, I think that it can be done in 11.0.

Note: this feature was already reintroduced in master in commit
https://github.com/odoo/odoo/commit/b7aa439826df6b3e442b3f60bb593ff28efc8679
2018-03-08 17:15:02 +01:00
Olivier Dony e366b0b6d4 [FIX] project: make default task order more natural
As of v11, project tasks and project issues have been merged.

Issues used to be ordered by:

        priority desc, create_date desc

whereas Tasks had the following historical ordering:

        priority desc, sequence, date_start, name, id

(where `date_start` corresponds to the creation date of the task, or the
time where task work began)

After the merge, the Task order was kept, but it became difficult to
understand for users, especially for converted issues.

This commit modifies the default order to a more obvious common order:

       priority desc, sequence, id desc

With the following goals in mind:
- the ordering does not change without obvious actions of the user
  (starring a record moves it at the top, manually reordering records
   reorders them within the same "stars category), and creating new
   records adds them at the top, where they are visible
- the ordering is easy to grasp, based on stars and chronological
  order, while still allowing manual reordering when really necessary
  (by default all records will have the default sequence of 10)
- sorting by "id desc" is similar to the previous "create_date desc"
  but it can be sorted more efficiently by the database

One could argue about sorting on chronological or reverse chronological
order. Like blogs and timelines, everyone has their preferences.
The latter option was selected because our UI for quickly adding records
is at the top of the kanban view, so it is more natural to see new
records at the top, instead of having them disappear at the bottom
immediately.

Hopefully this will not disrupt user workflows too much, and will remain
intuitive enough.
2018-03-08 17:11:12 +01:00
Olivier Dony 9b1009cd5a [FIX] payment_ogone: fix handling of validation tx
The validation transactions introduced in
7d428c871b were not working properly for
Ogone, due to several problems:

- The refund requests when being sent via the orderdirect.asp API, which
  does not support refunding previous transactions, according to the
  Ingenico helpdesk. It only support creating independent refund
  transactions, which is something that requires special pre-approval
  from the payment acquirer, and generally not permitted.
  In order to cancel/refund a previous transaction, the direct
  maintenance API must be used instead[1].

- Maintenance requests to refund a previous transaction fully should use
  the RFS code, as explained in the API documentation [1], and should
  always mention the PAYID of the refunded transaction.

- Such maintenance requests must always be SHA-signed, as usual.

- The various transaction status codes for refunded transactions need to
  be taken into account as well (typically those beginning with 8)

This commit fixes these various problems.

[1]
https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/directlink
(5.2 Direct Maintenance)
2018-03-08 17:11:12 +01:00
Olivier Dony c3769b2290 [FIX] payment_ogone: work around ingenico API bug
As of today, Ingenico platform 4.125 has non-uniform handling of the
PARAMPLUS parameters that can be passed as part of transaction metadata.

This parameter is documented as being parsed[1] as a series of
parameter-value pairs, to be passed as extra parameters to the feedback
transaction. Based on this, it seems that the PARAMPLUS value should not
be urlencoded globally, but each field value should be urlencoded, as
the Ingenico side will have to be able to parse and re-emit these
individual parameters.
In one case we were missing this urlencoding step, so this commit fixes
it.

Without this, the querydirect.asp API would return invalid XML data when
we retrieve the status of a transaction that used a PARAMPLUS value with
an '=' sign!

For example with PARAMPLUS passed as

        return_url=/payment/confirm?tx_id=123

the value returned by querydirect.asp would contain the following:
  (note the invalid extra quote character in the `return_url` param)

```
<?xml version="1.0"?>
<ncresponse
(...)
ED="1234"
return_url="/payment/confirm?tx_id="123"
SCORING=""
SCO_CATEGORY="G">
</ncresponse>
```

Url-encoding the value of the return_url in PARAMPLUS fixes this
nonsensical result.

However, the Ingenico API then fails to decode the parameter value when
passing it to the feedback URL, such as the ACCEPTURL we depend on.

As a workaround, since we only pass a single parameter inside
PARAMPLUS, we'll url-unquote it afterwards.

[1]
https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/e-commerce#feedbackparameters_variablefeedbackparameters
2018-03-08 17:11:12 +01:00
Géry Debongnie b17ba359db [REF] web,*: introduce the concept of AbstractAction
Before this commit, a client action was simply a subclass of Widget.
This is quite simple, but not really enough for the ActionManager. The
ActionManager needs to handle client actions in a different way that
view actions. Sometimes, it needs to check if a method exists before
calling it.

With this commit, we introduce a new abstraction: the AbstractAction
class, which defines a common API for all actions managed by the web
client.

Note that the API proposed in this commit is just the beginning. We will
introduce other methods in the future, to manage the focus, or the
scroll position, for example.
2018-03-08 16:48:54 +01:00
Romain Derie 247f7db088 [FIX] website: use absolute href location after page url change
Before this commit:
When editing a page URL through page properties it would redirect to that new
url afterward. If the url was not starting with '/' and had multiple level
before and after edition (eg: page/action to page/realaction) it would then
redirect to a wrong relative URL.

Now, we ensure that we redirect to the correct URL: the one slugified and
cleaned in the backend.

Step to reproduce:
  - Create a page '/page/action'
  - Go to that page and open Page Properties
  - Edit the URL to 'page/someaction'
  - You will be redirected to the incorrect relative URL /page/page/someaction
2018-03-08 16:25:50 +01:00
Goffin Simon 0bde7aa106 [FIX] sale_timesheet: AccessError on sale.order.line in multi-company
When the type of a product is changed by a user of company A, if this
product has been sold previously by company B, the user receives an
access error.

opw:1824548
2018-03-08 15:46:20 +01:00
Christophe Matthieu 070f1173da [FIX] odoo: onchange load the related field data
Configurations uses an onchange to populate the fields visible to the
user. However, the related fields are by default called sudo, when it is
an onchange, there may be a missmatch in the cache, the cache used being
empty, there is no value to return (cache fix is not currently possible).

Before this fix we must use 'related_sudo=False' to use the good cache but
it's an inconsistent fix because in some case we must use sudo to avoid
access error.

opw-1823363
2018-03-08 15:36:22 +01:00
Simon Lejeune 527b22b511 [FIX] stock: "Picking Moves" on quant
When looking for the move line associated to a quant, make sur to return
the move lines that took from the package or that put something in the
package.

opw-1824578
2018-03-08 15:27:46 +01:00
Christophe Simonis 8f118ad533 [FIX] purchase,stock_dropshipping: correct test
Oversight of previous forward-port
2018-03-08 14:37:13 +01:00
true-datura 67f67b5124 [FIX] web: 'image_small' field not displayed for non-latin translations
Before this commit, images in kanban view of the Contact app were not displayed
on non-latin languages, such as Russian.

This was caused by the is_bin_size helper that wrongly assumes that a certain
string is not a binary size, although it is (e.g. 64.2 Кб).

This commit fixes the issue by including such strings as valid binary sizes.

Bug found and fixed by @true-datura
Test by @alexkuhn

closes #23526
closes #22519
2018-03-08 14:29:36 +01:00
true-datura 6faf7784e6 Add CLA signature 2018-03-08 14:29:29 +01:00
Christophe Simonis 7d66953d17 [MERGE] forward port branch 11.0 up to bfe88c50e2 2018-03-08 14:06:54 +01:00
Nicolas Lempereur bd4f09fa72 [FIX] portal: no note in frontend chatter w/ token
When a chatter is displayed and the document is accessed with a valid
access_token, the message related to the document are searched in sudo.

This bypass valid filtering we may down the line.

This change apply the filtering so note type messages are not displayed
for user who are not employees.

note: before 11.0 this logic was in 1b5c2ced. In future version it would
      probably be better to have a method eg. _get_domain_based_on_user
      that would be called before sudo and if not sudo.

opw-1819702
closes #23544
2018-03-08 13:41:08 +01:00
Christophe Simonis bfe88c50e2 [MERGE] forward port branch saas-15 up to 0ae300e9e6 2018-03-08 13:22:28 +01:00
Thibault Delavallée 7ca93cd916 [FIX] test_mail: make some tests independent from other module demo data
There is a test checking message access rights and search results. It
searches for messages created in the test class having a subject like
Test. However this search may return more results than expected. For
example project create messages containing Test. As we want to keep tests
independent let us rename the test data to ensure everything works as
intended.
2018-03-08 13:20:42 +01:00
Christophe Simonis 0ae300e9e6 [MERGE] forward port branch saas-14 up to 85fd5cc147 2018-03-08 12:45:29 +01:00
Aaron Bohy 7fac801075 [FIX] web: mobile: display searchview toggler
There was an issue with the control panel in mobile since rev.
7b6056a. In the enterprise webclient, by default, the search view
is hidden, and a search icon should be displayed on the top right
corner of the control panel so that the user can toggle the
searchview.

Before this rev., the icon was invisible at the first rendering of
a view, and only appeared once the view was reloaded.

The change in rev. 7b6056a that produced the issue is that the
control panel is now updated twice when a view is rendered (once
by the view itself with the buttons, searchview..., and once by
the ActionManager with the breadcrumbs). The control panel didn't
handle correctly that scenario.

A test case will been added in web_enterprise.
2018-03-08 12:41:59 +01:00
Aaron Bohy 3809fc891f [FIX] web,mail: always reload widget mail_activity
Before this rev., the field widget 'mail_activity' kept an internal
cache of fetched activities (like the 'mail_thread' and
'mail_followers'). However, for activities, this cache may cause
issues.

For instance, create a new lead in 'My pipeline', schedule a
'Meeting' activity on that lead (it opens the Calendar view so
that real meetings can be created), create a meeting 2 weeks from
now, go back to the lead form view: the activity still diplays that
the meeting is today (when the view is refreshed, the correct date
is displayed).

This rev. removes the internal cache for this field widget, as the
activities can easily be updated in business flows (unlike messages
or followers).

This rev. also fixes a bug in the BasicModel, where the res_ids of
a list datapoint was altered in place to return a list of x2many
commands instead of the list of ids when being stringified. This
caused a traceback when opening a lead with activities, as soon
as the internal cache had been removed.
2018-03-08 12:39:21 +01:00
Christophe Simonis 85fd5cc147 [MERGE] forward port branch 10.0 up to 41af298d9d 2018-03-08 11:37:10 +01:00
Christophe Simonis 41af298d9d [FIX] hr_payroll: use defined variable
Oversight of previous forward-port
2018-03-08 11:11:44 +01:00
Christophe Simonis d7f4454694 [MERGE] forward port branch 9.0 up to 2f46f3bdb2 2018-03-08 10:50:20 +01:00
Goffin Simon 622399c796 [FIX] purchase: Changing the price of a confirmed PO before the receipt
Steps to reproduce the bug:
- Set your company in anglo-saxon
- Create a product P in a category which is in real price and perpetual
- Create a PO with P at 500$ and validate it
- Change the unit price of P in the PO line and set 100$
- Receive the product
Bug:
The two journal entries generated for the goods were created with the price unit
500$ instead of 100$.
Fix:
Now the right price is taken into account to generate the journal entries.

opw:1813946
2018-03-08 10:42:53 +01:00
Christophe Simonis 5fa4cc0d34 [FIX] stock_dropshipping: run accounting tests after install 2018-03-08 10:41:52 +01:00
Jeremy Kersten b4f8ca0a34 [FIX] base: fix dev mode for inherits view
Before this commit, model that create ir_ui_view via _inheritS was ignored in --dev xml
The arch_fs was not set. Because it was not ir.ui.view, and because xml_id was suffixed by _ir_ui_view.

Now we manage the case of inherits. So if model model.name inherits ir_ui_view

class MyClass(models.Model):
    _name = 'model.name'
    _inherits = {'ir.ui.view': 'view_id'}

    view_id = fields.Many2one('ir.ui.view', string='View', required=True, ondelete="cascade")
    ...

<record name='model.name' xmlid='pok'>
    <field name='arch' type='xml'>content</field>
</record>

will be read from xml in dev mode.

parsing the xml file for xml_id pok_ir_ui_view and pok.
The orm by default will add this suffix.

The 'dynamic' view created when we update the groups is a special case, which we don't want the arch_fs
for dev mode because the xml only contains by default and an empty container and btw the imd was wrong
since we had the res.group model a xml_id into the _inverse_arch.

The page create via a template (method new_page) will automatically remove the arch_fs since we don't
want to see the empty container if we are in dev_mode.
2018-03-08 10:22:21 +01:00
Goffin Simon 9f226528bd [FIX] stock_account: Force accounting date on validated inventory adjustment
When the inventory adjustement has been validated, changing accounting_date has no
impact on the stock moves created by the inventory adjustement.
This behavior cannot be changed in stable version.

opw:1817813
2018-03-08 10:17:52 +01:00
Alexandre Kühn 60bbce2e53 [FIX] mail: nocontent helper discuss (inbox & starred)
Revision on https://github.com/odoo/odoo/commit/a87d761fdbf345ada5dc93e0a686b08a0f5a0417

From the UX/UI changes above, we also changed the style for empty
inbox and starred in Discuss.

There are two issues with the empty boxes message:

    1. The text is not centered at all (one word per line,
       and everything is stuck on the left-side of the screen)
    2. The style is inconsistent with nocontent message on search

In this commit, inbox and starred use the same style as the no_content
message from a search. The style of the nocontent from a search has been
slightly changed to mimick the intended style for inbox and starred:

    - centered text
    - title is in bold 125% font size
    - other text is not in bold, 115% font size.
2018-03-08 09:30:37 +01:00
Nicolas Martinelli 1048fc6ed5 [FIX] purchase, stock_dropshipping: fix tests
Astonishingly, some people really need a green runbot to work.
2018-03-08 09:22:59 +01:00
len-odoo 9fdbbb816c [FIX] website_sale: display prices using public user pricelist on the shop
When a pricelist was set on the public user that was different from that of the
website, the prices were displayed using the public user default currency,
but the currency symbol displayed was the website default currency.
The issue was that in the template, the currency was accessed as a computed,
related field of website while the price was obtained using a function call.
In the first case the field was obtained using sudo, and thus the call would not
get the public user pricelist.

opw-1817761
2018-03-08 08:58:30 +01:00
Christophe Simonis 9db108c106 [FIX] delivery: remove extra unsourced file 2018-03-07 18:49:05 +01:00
Christophe Simonis 4aa5ec3fa5 [MERGE] forward port branch 11.0 up to d67b410dfc 2018-03-07 18:46:38 +01:00
Nicolas Martinelli d594fece4a [FIX] point_of_sale: return product
When a user returns a tracked product in the POS, it is not possible to
register the serial number. In case a customer returns 2 units of a
tracked product, the following error occurs:
'Cannot set the done quantity from this stock move...'

Since the serial number were not set, `qty_done` remains equal to zero
and `pack_lots` is empty. Therefore, we are trying to set a zero value,
which is actually useless.

opw-1817695
2018-03-07 18:18:57 +01:00
Christophe Simonis d67b410dfc [MERGE] forward port branch saas-15 up to cb87388d72 2018-03-07 17:42:02 +01:00