Skip to content
Snippets Groups Projects
  1. Apr 03, 2018
    • Thibault Delavallée's avatar
      [MERGE][REF] mail, various: optimize implementation of follower subscription · f9c21092
      Thibault Delavallée authored
      This merge replaces followers subscription code in order to be optimized
      and perform less queries. This improvement is done in several steps :
      
       * mail followers model has new low-level and optimized methods to compute
         followers to create or update. It uses SQL queries to fetch data in a
         single request;
       * mail thread message_subscribe method is rewritten to use this new method.
         Its API is also simplified and message_subscribe_user is removed to
         simplify the whole subscription API;
       * auto subscription is also rewritten. Fetching subtype data about parent /
         child like project / task is done in a single query that prepares data.
         It then uses new method to create followers;
      
      Various addons are updated because of message_subscribe or auto subscription
      change. Functionally behavior should stay the same as purpose is to be
      equivalent in term of functional coverage.
      
      Performance counters show this optimized code works well when dealing with
      large set of followers to subscribe or update. Most tests perform better
      of a few queries. Most complex ones involving (auto) subscription of several
      followers perform way better. About 30% of query are saved in the three top
      tests, aka between 80 and 90 queries with auto subscription of 10 followers.
      On overall community runbot we have a gain of about 11K queries. As Odoo
      data has few followers impact on runbot is probably less interesting than
      impact on real-life use case.
      
      Thanks to @rco-odoo for reviewing, and cheers !
      f9c21092
    • Thibault Delavallée's avatar
      [REM] mail: remove now unused add_followers_command · 2dbcbdd3
      Thibault Delavallée authored
      All code using it has been gradually replaced. It can be safely removed.
      2dbcbdd3
    • Thibault Delavallée's avatar
      [REF] hr_expense: use new implementation for auto subscription · ee64e810
      Thibault Delavallée authored
      Expense report has custom code to add people as followers. This code has
      several issues, notably in some cases it could try to add several times
      same people, leading to crash and issues.
      
      As auto subscription has been cleaned let us clean the code in hr expense.
      Using _message_auto_subscribe_followers it is now simpler to automatically
      add follower to expense reports. It is not necessary to add hackish custom
      code in create and write.
      
      One change is done in this commit. Some people are set as follower after
      record creation and not before. However this was necessary when tracking
      messages were not correctly triggered or auto subscription done after
      tracking. As process is now 1/ create 2/ auto subscribe 3/ tracking, messages
      linked to tracking will be correctly push to recipients automatically added
      as followers.
      ee64e810
    • Thibault Delavallée's avatar
      [REF] mail: improve implementation of auto subscription · 1eba7838
      Thibault Delavallée authored
      This commit refactors mail.thread message_auto_subscribe method. Purpose
      of this method is to automatically subscribe people to documents in several
      scenarios
      
       * followers from an umbrella record to sub-records, like followers of project
         added to tasks;
       * responsible of documents, in addition to sending notifications to newly
         added responsibles;
       * some specific use case depending on some applications like managers
         for expense reports;
      
      New auto subscription now uses the recently introduced method optimized to
      compute new or to-update followers. It is also rewritten so that overriding
      it is easier. Indeed simply overriding _message_auto_subscribe_followers is
      now sufficient to add new followers to a record, depending on some updated
      values. It is also now possible to specify a template to use for some
      specific notification, if requested.
      
      Fetching auto-subscription data in subtype is also optimized. It is now done
      in a single SQL query. All data related to parent (like project) and child
      (like task) as well as default and internal-only data is prepared in a single
      query and given back to auto subscription process. This allows to gain
      queries in auto subscription based on subtype like project / task use case.
      
      This commit has a great impact on performance counters. Complex use cases
      involving tracking and responsible notifications gain about 30 queries which
      is about 15% of their total query count.
      1eba7838
    • Thibault Delavallée's avatar
      [REF] mail: improve implementation of message subscribe · b6d2351d
      Thibault Delavallée authored
      This commit refactors mail.thread message_subscribe method. It is done for two
      purposes. First one is to optimize performance by using the new followers
      computation methods introduced recently. Second purpose is to clean the API
      of message_subscribe to make it simpler to use.
      
      This commit splits message_subscribe in two main parts :
      
       * _message_subscribe is a private method calling the follower new
         subscription methods and updating the record set;
       * message_subscribe is a public wrapper on _message_subscribe that adds
         access rights checks;
      
      Simplification comes by removing message_subscribe_users that was a
      shortcut to message_subscribe. Having a method to subscribe partners and
      channels is sufficient as we would like to avoid bloating the public API
      of mail.thread. A force parameter is also removed from message_subscribe
      as this implementation detail can be induced in the computation.
      
      Various addons using the removed methods are updated in order to use the new
      subscription API. They have the same functional behavior.
      
      This commit has a great impact when subscribing several followers. In a more
      general way all code using message_post is also optimized as posting a message
      generally implies subscribing followers. It also improves activity use as
      posting a message and subscribing new followers are common process in
      activities.
      b6d2351d
    • Thibault Delavallée's avatar
      [REF] mail: use new followers command when subscribing record creator · 301f140c
      Thibault Delavallée authored
      Override of create in mail.thread now uses the recently introduced
      _add_default_followers to add the record's creator in the followers.
      
      It allows to save one query when creating new records. It means for simple
      models we approach the bottom limit in term of generated queries which is
      quite a good news.
      301f140c
    • Thibault Delavallée's avatar
      [IMP] mail: introduce a new computation for subscribing followers · 86bf50db
      Thibault Delavallée authored
      This commit adds new methods to add or update followers to documents. Purpose
      is to have new optimized methods that perform less queries. It is based on
      experience and use cases of various addons in Odoo using it.
      
      Technically two main methods are given on mail.followers model
      
       * _add_followers: this method generates values required to create new
         followers or update existing one. It takes several parameter controlling
         how to deal with existing followers. This is used notably when auto
         subscription should not erase existing subscriptions;
       * _insert_followers: this method creates or updates followers for a given
         set of documents. It uses result from _add_followers;
      
      Performance gain come from the use of a SQL query to fetch followers data
      as well as less use of record sets. Code can be more low-level in some
      places. Purpose is to avoid browse and prefetch and just fetch data once
      and use it in various computation.
      
      New implementation is equivalent to the old one. It offers more flexibility
      as caller can either receive values for followers or directly have records
      created and updated. Various parameter allow to tune computation depending
      on each specific call to the new follower methods.
      
      Future commits will gradually replace the use of old _add_follower_command
      by the new methods. Purpose is to replace them one by one in order to see
      the gain in term of performance one replacement at a time.
      86bf50db
    • Dharmraj Jhala's avatar
      [IMP] website, website_sale: improve magnify feature · 3d6f9b5e
      Dharmraj Jhala authored
      
      Move zoom next the original picture
      Disable it if same img and max size with ratio < 1.5
      Allow to enable zoom automatically
      ...
      
      Task-33499
      
      Co-authored-by: default avatarJérémy Kersten <jke@odoo.com>
      3d6f9b5e
    • Laurent Smet's avatar
      [FIX] testing utilities: o2m should not strip readonly fields · 34c7fe2e
      Laurent Smet authored
      In the normal course of saving-action, readonly fields are stripped
      out when sending data to the server. The SSF would reuse the same code
      when "saving" O2M lines to the parent record however that is not
      correct and would lead to misbehaving views as readonly (non-stored)
      fields used as "transients" (storing data within the extent of a
      record's edition session) would not behave properly.
      
      Fix by overriding the O2M Form's save so that readonly fields are
      kept and stored in the parent record.
      
      Closes #23620
      34c7fe2e
    • Aaron Bohy's avatar
      [REF] web: FormRenderer: INNER/OUTER_GROUP_COL params · f5b1d494
      Aaron Bohy authored
      This rev. extracts two rendering parameters for the groups
      corresponding to the default col value to apply (for inner and for
      outer groups). This allows to easily override those default values
      in extentions of the FormRenderer (for instance, in the renderer
      of the new Dashboard view).
      f5b1d494
    • Aaron Bohy's avatar
      [REF] web: BasicView: allow overriding arch parsing · d4b918f3
      Aaron Bohy authored
      This rev. refactors the way the view's arch is parsed in BasicView,
      so that it can be extended specifications of the BasicView to
      handle other tagnames that 'field' (which is basically the only
      one handled in BasicView).
      d4b918f3
    • Aaron Bohy's avatar
      [REF] FormRenderer: renderOuterGroup · 409e7c18
      Aaron Bohy authored
      This rev. extracts the part of the rendering that renders outer
      groups (i.e. groups that contain groups) in its own function. This
      allows extentions of the FormRenderer to use it (for instance, the
      renderer of the new Dashboard view).
      409e7c18
    • Aaron Bohy's avatar
      [IMP] ActionManager: keepSearchView option · 69c9500e
      Aaron Bohy authored
      This rev. introduces an option to doAction (keepSearchView). If set
      to true, the searchView of the current action will be kept and used
      by the new action (this only works if there is already an action
      with a searchView, and if the new action is stacked over that one).
      
      This is necessary for the new dashboard view.
      
      A better solution would have been to export the state of the
      existing searchView, and import it to the new one, but the current
      implementation of the searchView doesn't allow to do that easily.
      This will be done as soon as the searchView will be rewrote.
      69c9500e
    • Aaron Bohy's avatar
      [IMP] web: SearchView: add/remove filter from outside · 5b3cb812
      Aaron Bohy authored
      This rev. allows to add or remove filters to the SearchView from
      the outside, and to make it display this new domain. This can be
      used by views that trigger domain changes (e.g. this is the case
      of the new DashboardView).
      5b3cb812
    • Aaron Bohy's avatar
      [REF] web: lint ir_http.py · 3dc48c79
      Aaron Bohy authored
      3dc48c79
    • Mathieu Duckerts-Antoine's avatar
      [IMP] web: GraphView: remove hack to render in DOM · 166319fa
      Mathieu Duckerts-Antoine authored
      The graph view uses the nv(d3) lib to render the graph. This lib
      requires that the rendering is done directly into the DOM (so that
      it can correctly compute positions). However, the views are always
      rendered in fragments, and appended to the DOM once ready (to
      prevent them from flickering).
      
      Before this rev., the graph view circumvented this by performing
      the rendering in a setTimeout(0), letting the framework append the
      widget to the DOM first.
      
      This rev. removes this hack and uses the on_attach_callback hook
      instead, which is called when the widget is attached to the DOM.
      This ensures that the rendering is always done in the DOM, and we
      keep the rendering part synchronous.
      166319fa
    • Mathieu Duckerts-Antoine's avatar
      [IMP] web: add a percentage formatter · 8e017ee2
      Mathieu Duckerts-Antoine authored
      This rev. adds a new formatter for numerical values to fieldsUtils.
      8e017ee2
    • Nicolas Martinelli's avatar
      [FIX] account: fix test · dcca2e8b
      Nicolas Martinelli authored
      Complement of 802339c1
      dcca2e8b
    • Nicolas Martinelli's avatar
      [FIX] analytic, hr_timesheet: recompute order · 802339c1
      Nicolas Martinelli authored
      When creating a timesheet, several fields need to be recomputed:
      - `currency_id`
      - `group_id`
      - `department_id`
      - `is_timesheet`
      - `validated`
      
      When `validated` is computed before the other fields, the recomputation
      will lead to an `AccessError` because of the rule
      `hr_timesheet.timesheet_line_rule_user`.
      
      Since the test `test_timesheet_validation_user` expects an
      `AccessError`, the test succeeds. However, from time to time,
      `validated` is computed last => the `AccessError` is not raised.
      
      Actually, a `ValidationError` should be raised in this case (from the
      `create` override in `timesheet_grid`).
      802339c1
  2. Mar 30, 2018
  3. Mar 29, 2018
  4. Mar 28, 2018
    • Thibault Delavallée's avatar
      [IMP] mail: use xmlid_to_res_id instead of ref in remaining places of mail · 4451e505
      Thibault Delavallée authored
      As explained in previous commit we can use xmlid_to_res_id instead of ref()
      which leads to some query gain. This commit update some other less important
      places: when setting activities as done and in the composer. This lead to
      a gain in tests involving activities and composer, including tracking
      triggering a template. On community runbot this leads to a gain of about 1K
      queries.
      4451e505
    • Thibault Delavallée's avatar
      [IMP] mail: use xmlid_to_res_id instead of ref to find subtype in various post methods · a2511f3a
      Thibault Delavallée authored
      As explained in previous commit we can use xmlid_to_res_id instead of ref()
      which leads to some query gain. We gain 1 query on most post due notably to
      notify and logging is still improved. This leads to a gain of about 4K queries
      on community runbot.
      a2511f3a
    • Thibault Delavallée's avatar
      [IMP] mail: use xmlid_to_res_id instead of ref to find subtype in message_format · 1e4ee402
      Thibault Delavallée authored
      Deleting comment / note / activity subtypes make the whole system quite
      impossible to use. Indeed the whole communication mechanism is based on
      those subtypes that are hardcoded.
      
      There are some use of env.ref() about subtypes to try to avoid having those
      removed. As there is some work to make some xml ids impossible to delete we
      can already update some code to use xmlid_to_res_id instead of env.ref(). This
      leads to some gain in query count as there is no exists() that is performed.
      
      Gain: 1 query on most tests implying post, because message_format is called
      by bus notification. About 1.5K queries on community runbot
      1e4ee402
    • Thibault Delavallée's avatar
      [FIX] test_mail: increase activity-related counters to avoid sometimes-red runbot · d4dcfb6c
      Thibault Delavallée authored
      Still this "sometimes one query more" in activity-related tests. Let us avoid
      false red occurrences of runbot by adding one query on sometimes-failing tests.
      Purpose of performance test is to have an idea of query count. Adding one query
      is not harmful.
      d4dcfb6c
    • Tejas Shahu's avatar
      [IMP] account: improve usability in the bank reconciliation widget. · e069da80
      Tejas Shahu authored
          - Removed 'OK' button to save title. Now, title will be saved on focusout or enter key pressed.
          - If more than one statements to be reconciled, then title should not be editable.
          - If no title for statement display text 'No Title'.
          - Improve UI for title to better understand clickable area and fix issue if title is too long.
      
      Was task 34890. Was PR #19971
      e069da80
    • Martin Trigaux's avatar
      [IMP] base: always show overwrite box · ee228e08
      Martin Trigaux authored
      It is not a technical feature
      Unverified
      ee228e08
    • Raphael Collet's avatar
    • Martin Geubelle's avatar
      [IMP] web: override size attributes in image widget · 6676c3b1
      Martin Geubelle authored
      Size attributes (e.g. `max-width`) are sometimes set in css (i.e. with classes,
      see `oe_avatar`).
      
      They must however be overriden if they are specified on the widget.
      
      Example:
        <field name="image" widget="image" class="oe_avatar" options="{'size': [180, 180]}"/>
      
      The `max-width: 90px` set on oe_avatar must be overriden in this case.
      
      Note that the attribute `img_width` and `img_height` have been depreciated as
      `width` and `height` are fulfilling the exact same purpose.
      6676c3b1
    • Olivier Colson's avatar
      [IMP] stock_account, anglo-saxon accounting: help to clear out interim accounts · 98ee1597
      Olivier Colson authored
      Accounting entries made for invoices and stock valuation on the interim accounts (stock input/output accounts) are now reconciled together for both sales and purchases. This will definitively help to have those accounts zero-outed when all operations are processed.
      
      The reconciliation is made as long as the stock valuation is set in real-time, whatever the costing method.
      
      Note that change change also allow a particular use case to be solved: when a purchase is made in a foreign currency whose rate change between the incoming shipment reception and the bill validation (there will be an automated exchange rate entry created).
      
      Was task 32331. Was PR #22483
      98ee1597
  5. Mar 27, 2018
Loading