Commit Graph
118382 Commits
Author SHA1 Message Date
Alexandre Kühn ed79f533a6 [IMP] mail: open document threads in thread windows
Also roughly called "open chatter in chat windows".

With this commit, document threads can now be detached in a small thread window.
It uses client-side cross-tab window synchronization by means of the local storage.

To detach a document thread in a thread window, click on the document thread preview
in the systray messaging menu when receving a new (needaction) document thread message.

-------------------------
  Technical Limitations
-------------------------

  1. In order to use this feature, the user must select the Notification Management
     'Handle with Odoo' in the Preferences of the User settings (top-right menu).

  2. For the moment, only needaction messages automatically updates the thread window. Manual
     refresh is still needed for other kinds of messages (e.g. reload document record to fetch
     new messages in the document thread).

Server-side code changes are required to receive new document thread message notifications on the
longpoll bus, which would fix the limitations above.

-------------------------
  Future Works
-------------------------

  1. Receive any new message from the document thread window when it is detached.
  2. Log a note from the document thread window.

Task-33118
2018-07-02 15:12:31 +02:00
Alexandre Kühn cd34f6de72 [REF] mail: JS mail refactoring
----------------------
 Summary
----------------------

The purpose of this commit is to improve the JS code of the `mail` module.
It applies the new coding guidelines and makes some changes on the design
of some modules, such as the old ChatManager module.

Here is a short summary of the changes that have been made:

  1. New coding guidelines
    - snake_case to camelCase
    - prefix private attributes and methods with '_'
    - jsdoc on most methods
    - one class per module
  2. Rename/Merge some classes
    - 'chat manager' becomes 'mail manager' (internal) and 'mail service' (external)
    - 'chat window manager' is now included in mail manager
    - 'thread' widget now named 'thread widget'
  3. New model abstraction for mail objects:
    - modules 'mail.model.*'
    - modeling:

                    0..1    0..1        *     *
      ThreadWindow  <------>  Thread <-------> Message
                              /    \
                             /      \
              Thread With Cache     Document Thread
               /      |       \
              /       |        \
        Mailbox    Channel    Support Channel
                      |
                      |
                      DM

    - Thread: the superclass of threads.
    - ThreadWindow: the window component of a thread.
    - Message: mail objects representing messages.
    - Thread With Cache: threads that can be used with search view (Discuss app compatible).
    - Document Thread: represents the thread part of a chatter.
    - Mailbox: represents what was previously called 'static' channel, e.g. 'Inbox'.
    - Channel: mail objects representing channels, including livechat.
    - DM: special kind of Channel for 1:1 communication in the backend.
    - Support Channel: special channel for im_support module.

  This new modeling approach let us easily add features on all threads, such as the
  possibility to put any thread in a small window.

----------------------
 Known issues
----------------------

 [Already Present in Master]

    1. When the Discuss app is in the background with 'Inbox' as the selected
       Thread, when clicking on a document thread preview in the messaging menu
       of the systray, the rainbow man appears.

    2. When a document with the chatter is in the background, when receiving an
       inbox notification from this document thread, the document thread is
       automatically marked as read, which removes the notification right away.

    3. Sometimes, opening a DM window from the "blank" thread window does not work.

    4. Reply-to feature on Inbox is not working: no message is sent in the document
       thread.
    5. On the first login of admin user with demo data, the inbox counter is wrong
       (it displays 6, instead of 3).

       Explanation after investigation:

        > On page load, it fetches the correct number of Inbox messages (3),
          but the server notifies of 3 needaction messages right away,
          so it wrongly assumes these are new needaction messages.
        > Not possible for web client to detect that these messages should not
          increment the Inbox counter while keeping same API.

    6. Notifications for new document thread messages only work when the user sets
       'handle with Odoo' for the Notification Management in the preferences.

        > due to notifications on the longpoll bus for document thread
          messages that come from needaction notifications.
        > requires server-side changes to send notification on the longpoll
          bus to mentionned user.

  [New]

    7. When receiving a message on a unjoined channel, thread window flickers
       ('open' > 'close' > 'open')

        Explanation after investigation:

          > JS logic:

            a) On auto-join, ask server to join the channel and get channel infos.
            b) The info tells the channel is not detached, but JS code makes decision
               to detach it, and tells server the channel is now detached.
            c) From (a), server notifies on longpoll bus the state of channel, which is
               not detached. The web client thinks that the window state of the channel
               has been changed somewhere else, and the channel is now closed.
            d) From (b), server notifies on longpoll bus the state of channel, which is
               detached. The web client opens the thread window of this channel.

          > The flicker didn't occur before refactoring because the web client was only
            updating the model of channel when it receives the longpoll notification.
          > Server behaviour on 1st longpoll notification is necessary for cross-tab
            synchronization for channel window state.
          > New design implies that model and view should be synchronized, hence the
            issue now.
          > Solution: remove server-side thread window synchronization and replace with
            client-side synchronization.

----------------------
 Hacks
----------------------

The module `im_livechat` now uses mail objects that are compatible with Message
and Window objects:

      Modeling for messages:

                             AbstractMessage
                              /           \
                             /             \
                    LivechatMessage      Message

      - AbstractMessage: message compatible with the thread widget.
      - LivechatMessage: message used by im_livechat.
      - Message: message used with the mail manager.

      Modeling for thread windows:

                          AbstractThreadWindow
                              /           \
                             /             \
                    LivechatWindow    ThreadWindow

      - AbstractThreadWindow: behaviour share between all types of thread windows.
      - LivechatWindow: window used by im_livechat.
      - ThreadWindow: window used with mail_manager.

The reason for these hacks are twofold:

  1. Use the thread widget in the frontend and livechat external lib bundles.
  2. Do not have a dependency with the mail manager in the frontend and external
     lib bundles.
2018-07-02 15:06:54 +02:00
sri-odoo ee9c1f52c3 [FIX] account: reconcile screen, btns alignment 2018-07-02 14:32:39 +02:00
Romain Derie 8bd520fc30 [FIX] sale: no static terms in mail template
Forward port 49edee1f4b broke commit 2fa469c5e5
Indeed, the mail template got fixed with 5940f41ddc in earlier version.
Mail template should not integrate static term

Closes #25561
2018-07-02 12:52:44 +02:00
qdp-odoo 2e074a2780 [IMP] account: keep numbering of reset-to-draft payments
Was github issue #25441
2018-07-02 10:38:31 +02:00
Olivier Dony af00082a71 [IMP] doc: update cmdline doc for 3edd504f17 2018-06-29 16:57:45 +02:00
Olivier Dony 3edd504f17 [IMP] db: create new databases based on template0
As a follow-up to commit 276ea817f4,
we change the default template database used for CREATE DATABASE
operations, and we avoid setting the LC_COLLATE option unless
this default template is used (to avoid locale compatibility errors).

Rationale for the default template choice:

PostgreSQL uses `template1` by default, and recommends that users alter
`template1` if they need a custom template, while keeping template0
virgin. This is likely to be the reason why we had `template1` as the
default previously (from a1e5c645d9).

However, for new Odoo databases, it's actually better to use `template0`
as template, for multiple reasons:
- We do not customize the template database, and the system will work
  fine when starting from a completely virgin database
- Since template0 does not allow connections by default, we have a
  stronger guarantee that no user will be connected to the template
  database (which would otherwise block database creations!)
- We use the same logic for creating new databases and for creating
  placholder databases for restoring dumps. In the latter case,
  PostgreSQL recommends using a virgin template, to obtain a perfect
  copy of the database being restored (unaffected by any template
  customization)
- Using `template0` as a template lets us choose any encoding and locale
  settings (LC_COLLATE/LC_CTYPE) upon creation. Any other database
  template might cause errors unless we select compatible encodings
  and locale settings.
  As the locale setting is system-dependent, we can't just hope
  that there will be no compatibility problem, we must explicitly
  default to template0. Therefore the change in
  276ea817f4 was prone to causing
  locale compatibility errors.

Finally, if users have a reason to prefer a different template, they
should select it explicitly with the --db_template config.

Note: existing environments will likely continue to use `template1`
as a default due to presence of older config files.

Complements #25196
2018-06-29 16:37:42 +02:00
Fabien Pinckaers a8e164c420 [IMP] product: create_variant: visible by default 2018-06-29 16:24:46 +02:00
Alexandre Kühn 46f1609b4a [FIX] mail:tests: more precise jQuery selector on modal body content
Tests from [1] were not passing, due to changes from [2].

This is due to the fact that `$.('.modal-body')` picks 2 elements, instead of 1.

Partial HTML before [2]:

```
    <main class="modal-body">
        <div>
            <p>
                ...
            </p>
        </div>
    </main>
```

Partial HTML after [1]:

```
    <main class="modal-body">
        <main role="alert" class="modal-body">
            <p>
                ...
            </p>
        </main>
    </main>
```

In order to not pick both DOM elements, we refine the jQuery selector to pick
the `<p>`, so that there's only one element and it has the same text content.

[1] [FIX] mail: warn user on record reload before post message
    https://github.com/odoo/odoo/commit/b74d1e90ef32893bfbcf750cdf4586c453790b01
[2] [IMP] Improve compatibility with screen readers (accessibility) (#24574)
    https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
2018-06-29 14:24:51 +02:00
Moisés López 276ea817f4 [IMP] db: force C collation for new databases
This makes sorting and indexing independent of the cluster/machine
configuration, and allows simple b-tree indexes to be used for
prefix-searches on VARCHAR columns without needing special operator
classes (and therefore without needing duplicate indexes).

The 'C' collation is built-in and always available on any postgresql
installation. It also allows any encoding/locale to be used, contrary to
other LC_COLLATE values, so it should never conflict with custom db
templates.

Admins who want to apply a special collation can still do so by creating
the database manually, instead of letting the system do it.

Closes #25196
2018-06-29 13:06:30 +02:00
Christophe Simonis 49edee1f4b [MERGE] forward port branch saas-11.4 up to d54a3726ec 2018-06-29 12:46:00 +02:00
Christophe Simonis d54a3726ec [FIX] account: correct test after e095733a3a
Since e095733a3a, Aged Report is not
inclusive, we should then get report for a day after the bank statement.
2018-06-29 11:40:01 +02:00
Sébastien Theys 4a08388492 [FIX] web: prevent add a line from crashing when orderedResIDs is not set
This fixes the following bug:

Creating an Invoice, clicking on Validate (with no invoice line), and then trying to add a product.

Before this fix, this would throw an error message.

Now it works.
2018-06-29 10:39:42 +02:00
Sébastien Theys b2c1d5ede2 [IMP] web: fix default sequence for list with handle
The sequence had a static default value, but when there is an handle, it's important that new items are added at the top or the bottom of the list.

This is a rare case where the defaul_get from the server will be ignored by the view for a certain field.

This will work:
- both in editable mode (inline) and in dialog mode,
- both for X2Many and standalone list.
2018-06-29 10:39:42 +02:00
Sébastien Theys 217fee2636 [FIX] web: prevent RPC from failing if no route is set
The scenario is:
- create a new parent model, which has a one2many
- add at least 2 one2many lines which have:
    - a handle field
    - a many2one, which is not required, and we will leave it empty
- reorder the lines with the handle

This will call a resequence, which calls a name_get.
With the bug that would throw an error at the RPC, but this commit fixes it.
2018-06-29 10:39:42 +02:00
Sébastien Theys 13667b0dff [DOC] doc: update the QWeb documentation
The $as_all variable was mentioned in the doc but it is non-existing in the Python code.

This commit makes clear it is only available on JS QWeb.

Also rename OpenERP to Odoo.
2018-06-29 10:39:42 +02:00
Christophe Simonis c302a90b6e [FIX] resource: oversights of previous forward-port 2018-06-28 21:50:23 +02:00
Christophe Simonis c8bb02141d [MERGE] forward port branch saas-11.3 up to 3cdcbce93c 2018-06-28 19:01:52 +02:00
Romain Derie 124be154bf [FIX] sale_payment: back to SO page after payment
Commit a3c9c286cc made stripe.js more generic. By doing so it also fixed the
`provider_form.innerHTML = data` that was not doing anything since
provider_form was not a dom element.

For orders on /my/orders/XX, the `return_url` was /my/orders/XX before going
through stripe.js.
stripe.js would then call `/pay/sale/XX/form_tx/` that would return new
acquirer form values that should replace the old ones, including a new
`return_url`.

But since `provider_form.innerHTML` was undefined, the old data would remains.

With commit a3c9c286cc the data is now correctly replacing the old ones.
The `return_url` is now /my.

So when an user pays a SO, he is redirected to the portal root page instead of
the SO he just paid with a confirmation message (like it was the case before
the stripe.js improvement).

This fix ensure that the user is still redirect to his SO, by redirecting to
/my/orders/xxx and not /my.
2018-06-28 18:48:04 +02:00
Joren Van Onder 0ea864ca90 [FIX] account: don't crash when generating an invoice from website_quote
res.currency's `_convert` expects a record not an id.

On res.currency:

_convert() calls
_get_conversion_rate() which calls
_get_rates()

_get_rates does company.id.
2018-06-28 18:47:57 +02:00
Joren Van Onder 2362ea09f8 [FIX] website_sale_digital: make /my/orders accessible with just token
This route should be public because the public user should have access
if the correct access token is passed. super() will ensure that.
2018-06-28 18:47:51 +02:00
Joren Van Onder 2fa469c5e5 [IMP] sale, website_quote: allow portal payment after signature
Both features already existed but it was not possible to enable both.
This makes that possible. When both are enabled the quotation first has to be
signed, then it can be paid.

Purpose
=======
No way to combine digital signature and online payments to confirm orders.
A customer signature matters for big deals, in order to keep an official print
of customer agreement.

Specs
=====
- when the customer signs online, a new pdf is generated with the customer
  signature on it and posted as a note in the chatter, replacing the current
  signature jpg.

- show the signature in the portal view, with both sale_management and
  website_quote module

- change in settings: Digital Signature and Electronic Payment are now 2
  checkboxes instead of a radio button

- these settings must be company-specific (add company icon if multi-companies,
  like other company-specific settings)

- when both modes are activated, it first request the signature, then the
  payment

- the order is confirmed after payment

opw-1818837
Closes #24174
2018-06-28 18:47:51 +02:00
Joren Van Onder 803162537b [FIX] portal: show signing error messages returned by the server
The funny self.$('#o_portal_sign_accept') line was some leftover
debugging code. It doesn't actually match anything, because that
element is not in self.$el.

Before this change nothing happened when you clicked the button and an
error occured.

Now the `data.error` message (e.g. 'Invalid Order') is shown near the
bottom of the dialog.
2018-06-28 18:47:35 +02:00
Christophe Simonis 3cdcbce93c [FIX] im_support: make js tests pass 2018-06-28 17:00:37 +02:00
Ankit Joshi 11e966da6a [ADD]repair: Add group_account_invoice.
Hide the button "create invoice" on the repair order if the user doesn't have the right to create an invoice

Task: 1844702
2018-06-28 16:34:08 +02:00
Ankit Joshi 81f5b916ba [REM]repair: Remove invoice access rights.
The stock user shouldn't have the right to create invoices

Task: 1844702
2018-06-28 16:34:08 +02:00
Ankit Joshi acce8f2c5a [REM]stock_account: Remove invoice access right.
The stock user shouldn't have the right to create invoices,
Remove stock user invoice right,

Task: 1844702
2018-06-28 16:34:08 +02:00
Christophe Simonis 1bf8f685c4 [FIX] stock_landed_costs: avoid useless changes on UoM in tests 2018-06-28 13:17:15 +02:00
kujiu 92bf89ffb3 [FIX] Remove bad aria-hidden (#25481)
Some aria-hidden are present on some elements that must be visible. Some dialogs don't open correctly with this.
2018-06-28 12:31:27 +02:00
kujiu 99c29c37f8 [FIX] Bad layout for button Published/Unpublished (#25476) 2018-06-28 12:30:11 +02:00
Christophe Simonis fc1789c40f [FIX] sale_mrp: avoid useless changes on UoM in tests 2018-06-28 11:35:10 +02:00
Christophe Simonis 2c4b555b95 [FIX] stock: use renamed xmlid in newly added test 2018-06-28 11:01:25 +02:00
Christophe Simonis b06af028e6 [MERGE] forward port branch saas-11.2 up to d112a163cd 2018-06-28 10:55:12 +02:00
Pierre Masereel 373ea16380 [IMP] stock: inv. adj. line no lot edition for untracked product 2018-06-28 10:44:38 +02:00
dip-odoo 85d5360fdd [REF] stock: onchanges on stock inventory and inventory lines private
As it is not necessary to have public functions for onchanges, we set
them back private.

TASK-30921
2018-06-28 10:44:38 +02:00
dip-odoo 0cb20d2035 [REF] stock, mrp, sale_mrp: inventory validation
The method 'action_done' on inventory adjustment became private and the
action launched from the view is now 'action_validate', so we adapt
those tests to use the new function.

TASK-30921
2018-06-28 10:44:38 +02:00
dip-odoo 692847255c [IMP] stock: validate inventory adjustment with product tracked
When you have some product tracked in an inventory adjustment, the
lot/serial number is not required, so when you confirm an inventory
adjustment with product tracked for which you didn't provide serial/lot
number you get a warning to inform you.

TASK-30921
2018-06-28 10:42:28 +02:00
dip-odoo ba5918ffcb [IMP] stock: improve inv. adj. line constraint
The constraint avoifding ot have two inventory lines with the same
properties was only triggered in the create, we make it work also in the
write.

TASK-30921
2018-06-28 10:42:28 +02:00
dip-odoo 1efdf539dc [IMP] stock: inv. adj. line no product create
When you create a inventory adjustement line, you can create new products,
but you don't really want to create products in the inventory adjustment.

TASK-30921
2018-06-28 10:42:28 +02:00
dip-odoo a04d43faf2 [IMP] stock: Update quantity on hand inventory adjustment
When the update quantity on hand is clicked on a product tracked by lot
or serial number or if the database is in multi location, the button
update quantity on hand will open an inventory adjustment to allow you
to add multiple lot/serial number and/or choose the lopcation in which
you are updateing quantities

TASK-30921
2018-06-28 10:42:28 +02:00
Christophe Simonis d112a163cd [MERGE] forward port branch 11.0 up to f6d36d81f7 2018-06-28 10:32:03 +02:00
Géry Debongnie 6d0824b894 [FIX] base: properly render settings form view after reload
Before this commit, something strange could happen after reloading a
settings form view: all 'sections' were displayed.  The issue was caused
by the fact that the state of the view was read from the arch of the
form view at render time.  Also, as a form of optimization (I suppose), the
settings did not call the initModules method twice, when it rerenders.
This is unfortunate, because the very same method is actually
responsible for removing unused sections.

This fix is the safe fix, but definitely not the perfect fix (this would
involve a larger change, something like reading the state from the arch once in
the view (factory), then only rendering what is necessary).
2018-06-28 09:13:40 +02:00
Nicolas Lempereurandqsm-odoo f6d36d81f7 [FIX] mail: discuss smileys on several lines
In the discuss composer on google chrome, when when the smileys have
more width than available, they stayed on one line and would increase
page size (adding an horizontal scrollbar).

This happened really easily in saas-11.3 because we have more smileys,
but still happened in 11.0 depending on the screen size.

opw-1861191
closes #25507

Co-authored-by: qsm-odoo <qsm@odoo.com>
2018-06-28 09:05:36 +02:00
Nicolas Martinelli a0173bbbce [FIX] stock: fix test setup 2018-06-28 08:35:23 +02:00
Nicolas Martinelli 50a10fd736 [FIX] stock: search route name
opw-1862275
2018-06-28 08:16:31 +02:00
Christophe Simonis 9dcc32c304 [FIX] stock: avoid useless changes on UoM in tests setUp 2018-06-27 20:14:47 +02:00
Christophe Simonis d44a4df863 [FIX] stock: correctly check UoM and Locations modifications 2018-06-27 20:13:37 +02:00
Swapnesh Shah bb78b7608a [FIX] hr_payroll: prevents maximum recursion depth
When computing a salary sheet, a maximum recursion error could happen if there
is a cycle in the rules or in the categories.

Add constrains for salary rules and categories.

Closes #25405
2018-06-27 17:44:03 +02:00
Christophe Matthieu 39f0f5db77 [FIX] ir_qweb: send template options in context to the fields
Application of a fix more specific to the problem of the contact widget
which can not serialize the dictionary because it contains the values of
the context of which browse record. (because contact try to
json.dumps options for multi-edition feature in web_editor)

opw-1859848

https://github.com/odoo/odoo/commit/ab85e9594651fd33ffd2747f4d3c5b360e7c7922
2018-06-27 15:11:37 +02:00
Christophe Simonis f70a3167ee [FIX] stock: inherit from correct model
Oversight of previous forward-port
2018-06-27 15:00:59 +02:00