Skip to content
Snippets Groups Projects
  1. Nov 27, 2022
  2. Nov 24, 2022
  3. Nov 20, 2022
  4. Nov 14, 2022
    • FrancoisGe's avatar
      [FIX] *: override save checks that the save is valid · 46b93da5
      FrancoisGe authored
      
      The goal of this commit is to avoid the execution of code depending
      on the validity of the save of a Record.
      
      Before this commit, several override save functions in Record execute
      code after the record's save without checking if the record's save has
      taken place.
      
      Override before:
      export class NewRecord extends Record {
          async save() {
              const isSaved = await super.save(...arguments);
              // doAction
              return isSaved;
          }
      }
      
      Override after:
      export class NewRecord extends Record {
          async save() {
              const isSaved = await super.save(...arguments);
              if (isSaved) {
                  // doAction
              }
              return isSaved;
          }
      }
      
      How to reproduce the problem:
          Go to a form view with a Record having its save override function.
          Edit a record in such a way to have an invalid field
          Click on the save button
      
      Before this commit:
      The doAction is executed
      
      After this commit:
      The doAction is not executed
      
      Real use case
      - Go to the form view of a lead in CRM
      - Change stage
      - Clear the name field
      - Click on save button
      
      Before this commit:
      A call to get_rainbowman_message is made
      
      After this commit:
      No call to get_rainbowman_message is made.
      
      closes odoo/odoo#105468
      
      Related: odoo/enterprise#33817
      Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
      46b93da5
  5. Nov 13, 2022
  6. Nov 10, 2022
  7. Oct 30, 2022
  8. Oct 23, 2022
  9. Oct 16, 2022
  10. Oct 09, 2022
  11. Oct 04, 2022
  12. Oct 03, 2022
  13. Oct 02, 2022
  14. Sep 27, 2022
  15. Sep 25, 2022
  16. Sep 23, 2022
  17. Sep 20, 2022
  18. Sep 01, 2022
    • Victor Feyens's avatar
      [CLN] sale: cleanups · 920c1fa0
      Victor Feyens authored
      Methods ordering (after place of call)
      String guidelines (double quoted strings for strings shown to the user)
      
      Part-of: odoo/odoo#98068
      920c1fa0
  19. Aug 25, 2022
    • Thibault Delavallée's avatar
      [MOV] various: move and split mail data · d13d251a
      Thibault Delavallée authored
      Just doing the summer file cleaning. Move mail data into files named based on
      their model, easing maintenance and searching for those data.
      
      Spotted during Task-2207626 (Rating: Delay rating notification to ease feedback)
      
      Part-of: odoo/odoo#98661
      d13d251a
  20. Aug 04, 2022
  21. Aug 03, 2022
    • william-andre's avatar
      [REF] accounting v16. Yeeeeaah · d8d47f9f
      william-andre authored
      
      TLDR:
      * invoices are implemented using computed methods instead of onchange
      * the synchronization only happens when switching tabs in the Form view
        to improve perfs.
      
      _______________________________________________________________________
      
      The whole engine of the synchronization of Invoices to the Journal
      Entries has been refactored
      * by using computed fields instead of onchange functions
      * by synchronizing only from invoice to journal entry in `create` and
        `write`
      * by saving when switching tabs on the Invoice form, to synchronize
        before showing the values
      
      This comes with numerous advantages:
      * no need to call the onchange methods manually
      * no need to use the Form emulator to build invoices (i.e. EDI, OCR,
        intercompany, ...)
      * the performance for invoices with many lines improves drastically, going
        from 2 minutes to 4 seconds to create an invoice with 500 lines
      * the model is more declarative, we can now see how the values are computed
        instead of having the values being copied from various places.
      * remove the hack in `onchange` that disabled the recursivity of it,
        which was unexpected and needed to be managed manually in all the
        onchange methods
      
      This means that:
      * Some fields need to be exclusively computed on journal entries values
        or invoice values, more specifically the Tax Summary widget.
        It is now
          - computed from entry lines, when opening the view
          - computed from invoice lines when changing those, because the tax lines
            will need to be recomputed anyways, erasing previously set values
          - set with an inverse function when saving; after the sync has been done
      * Some possible operations previously possible have been dropped.
        (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
        This is because such a behavior was undefined (how is changing the balance going
        to affect the unit price? How is the amount currency going to affect it?)
      
      _______________________________________________________________________
      
      Implementation Details
      ----------------------
      
      The "dynamic lines", meaning the payment terms and the tax lines are now
      only created in the `create` and `write` functions.
      In order to reduce code duplication, it has been implemented using
      context managers used in both `account.move` and `account.move.line`
      These context managers help comparing the values before/after, acting
      like a local `onchange`, but getting benefit from the dirty flags from
      the `compute` dependences.
      This is relying on computed fields on the move (`needed_terms`) and on
      the lines (`compute_all_tax`) which contain the values needed for the
      related move.
      Depending on the needed values and the existing values (`term_key` and
      `tax_key`, respectively) the context manager will determine what needs
      to be created/updated/deleted.
      
      Some related changes are to produce a `dict` instead of a `str` for the
      `tax_totals` (previously `tax_totals_json`) fields, by simplicity to
      reduce the complexity of IO, and simplicity of debugging, because the
      logic of the field needed to change (cannot be computed at the same time
      anymore since it needed the lines to be synced)
      
      By simplicity, and also because it makes more sense, some boolean fields
      have been merged into `display_type`:
      * `is_rounding_line`
      * `exclude_from_invoice_tab`
      * `is_anglo_saxon_line`
      
      The `price_unit`, `quantity` and other "invoice fields" are now not set
      anymore on lines that are not product lines since it didn't make any
      sense to have it.
      
      Performances
      ------------
      
      You have to keep in mind that a simple `create` didn't compute a lot of
      fields, for instance not taxes were set, no payment terms,...
      Now it does.
      
      ```python
      import random
      from timeit import timeit
      from odoo import Command
      domain = [('company_id', 'in', (False, self.env.company.id))]
      products = self.env['product.product'].search(domain).ids
      partners = self.env['res.partner'].search(domain).ids
      taxes = self.env['account.tax'].search(domain).ids
      def create(nmove, nline):
          self.env['account.move'].create([
              {
                  'move_type': 'out_invoice',
                  'partner_id': random.choice(partners),
                  'invoice_line_ids': [
                      Command.create({
                          'name': f'line{i}',
                          'product_id': random.choice(products),
                          'tax_ids': [Command.set([random.choice(taxes)])],
                      })
                      for i in range(nline)
                  ]
              }
              for j in range(nmove)
          ])
                                                                   # After  | Before
      print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
      print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
      print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
      print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
      print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
      print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
      ```
      
      Another metric that can be used is running the test suite with
      `--test-tags=/account` (only `account` installed)
      * before: 404s, 267127 queries (366 tests)
      * after: 318s, 232125 queries (362 tests)
      
      Why this commit title?
      ----------------------
      
      Someone told me that this was the perfect way of naming your commits.
      c04065ab
      
      task-2711317
      
      closes odoo/odoo#96134
      
      Related: odoo/upgrade#3715
      Related: odoo/enterprise#29758
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      d8d47f9f
  22. Jul 22, 2022
  23. Jul 07, 2022
  24. Jun 10, 2022
  25. May 31, 2022
    • Florian Charlier's avatar
      [IMP] event_sale: add event revenue reporting · 18406560
      Florian Charlier authored
      
      As an event manager, it can be difficult to estimate how much of the revenue
      was generated by the events. To give clear insights, we will add new reports
      to the 'event' module.
      
      With those new reports, the user can group the revenues by event (type),
      ticket, product, etc. The user will then be able to quickly see which tickets
      and events are the most profitable ones. The reports will be accessible only if
      the user installed the 'sale' module.
      
      Task-2679881
      See odoo/enterprise#24472
      
      Part-of: odoo/odoo#81583
      Co-authored-by: default avatarFlorian Charlier <flch@odoo.com>
      Co-authored-by: default avatarJulien Banken <jbn@odoo.com>
      18406560
    • Florian Charlier's avatar
      [IMP] event{,_sale}: unstore seat fields · a0e7f695
      Florian Charlier authored
      With stored computed seat attributes, the database can be flooded with update
      queries for the stored values for the event (ticket) seats computations (such
      as reserved, expected, and available seats).
      This can especially occur when a communication is sent to many people about
      an event with a registration link, many users may want to register at the same
      time, possibly resulting in concurrent_update errors.
      
      In this commit, we remove the `store=True` attribute of those fields, and
      therefore remove the Reporting/Event feature depending on them and rewrite some
      domain searches and _compute fields in the event and event_sale modules.
      
      This also impacts the way constraints are enforced on the number of
      registrations vs defined maximum as no stored value is directly available.
      
      For performance reasons, all events and tickets are now shown on backend form
      views, with seat availability added in their displayed name.
      
      Misc
      To avoid delaying the inevitable, the Event configurator modal/wizard now
      validates event/ticket consistency at closing.
      
      The UI of the RegistrationEditor wizard is also improved:
      * A warning alert will tell users that free registrations were not confirmed
      because of insufficient seat availability.
      * A first step to better explain the consequences of the actions taken on the
      modal was to be taken, here via the description and buttons wording.
      
      Tests
      Query counts are (indeed reduced) and updated. However, as local testing with
      `test-tags=/test_event_full` ("tef_only") is currently not reliable, these
      values were updated by applying the same change from the commit as the one seen
      for the runbots, while a "?" is appended to show this uncertainty.
      
      Task-2654816
      See odoo/upgrade#3118
      
      Part-of: odoo/odoo#81583
      a0e7f695
    • Horacio Tellez's avatar
      [FIX] event_sale: ticket price is not correctly updated · 1991306e
      Horacio Tellez authored
      
      When using the product configurator for event tickets the
      price was not updated when picking a ticket with a different
      price.
      This of course is to the desired behavior.
      
      This commit makes sure the unit price is correctly
      recomputed when the ticket is modified on the SO
      line.
      
      Task - 2767301
      
      closes odoo/odoo#85208
      
      Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
      1991306e
  26. May 09, 2022
    • Demesmaeker's avatar
      [IMP] sale: ask confirmation for SO cancellation · 27a6d5df
      Demesmaeker authored
      Before this commit, when cancelling a SO, the wizard opened only when
      there were draft invoices or delivered picking in the order.
      
      In order to complete the notification flow of the SO and avoid
      unexpected  cancellation of orders, the user must now confirm
      cancellation and gets to possibility to send an email notification.
      
      task-2660895
      
      Part-of: odoo/odoo#81569
      27a6d5df
  27. Mar 23, 2022
  28. Mar 02, 2022
    • Vincent Schippefilt's avatar
      [IMP] *: use _read_group instead of read_group · 05fc9a67
      Vincent Schippefilt authored
      
      This commit modifies most of the usages of read_group and uses
      _read_group instead. _read_group doesn't join automatically on the
      many2one fields when no order_by is specified, making it more performant
      when the "name" of the many2one is not relevant, which is the case for
      most back-end cases
      
      closes odoo/odoo#84908
      
      Task-id: 2479334
      Related: odoo/enterprise#24877
      Signed-off-by: default avatarRaphael Collet <rco@odoo.com>
      05fc9a67
  29. Feb 28, 2022
    • Jinjiu Liu's avatar
      [FIX] event_sale: Added a domain condition on attendee_count in SO · bef898e1
      Jinjiu Liu authored
      
      Reproduction:
      1. Start the process to buy (register) 2 tickets for an event
      2. Go back to “review order” and reduce the quantity to 1
      3. Sign up with a new portal user and create an account
      4. Change the number of tickets to 2
      
      Reason: the seats_expected in event.event has a different computation
      logic from the attendee_count in sale.order. In event.event, the
      seats_expected does not count canceled registrations. In sale.order, the
      attendee_count counts the canceled registrations. But they are both
      shown as "Attendees" in the statinfo widget of form views
      
      Fix: Added a domain condition to filter out canceled registrations when
      computing attendee_count in SO
      
      opw-2739310
      
      closes odoo/odoo#85491
      
      X-original-commit: 88fecdc4
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      bef898e1
  30. Feb 21, 2022
  31. Feb 10, 2022
  32. Jan 19, 2022
  33. Jan 12, 2022
  34. Dec 23, 2021
  35. Dec 16, 2021
    • Thibault Delavallée's avatar
      [REF] website_event_*: remove manual datetime patch · 23791177
      Thibault Delavallée authored
      Use freezegun as it is more easy to use and allow to remove a lot of extra
      boilerplate. Indeed manually patching datetime is a PITA as a lot of imports
      have to be patched.
      
      A custom patching has to be done for create_date, as it is done using a value
      stored on the cursor (cr._now), based on SQL now. As it has nothing to do
      with standard python library it cannot be patched using freezegun.
      
      Task-2703285 (Event performance improvements)
      Task-2703289 (Event testing and coverage)
      
      Part-of: odoo/odoo#81068
      23791177
    • Thibault Delavallée's avatar
      [REF] event(_*): clean tests common files · db19463f
      Thibault Delavallée authored
      Purpose is to have a common event class for users and useful stuff (customers,
      products, ...) but lessen usage of common test data through sub modules.
      Indeed having a "global event type" test data updated in various addons is
      actually complicated to maintain.
      
      Sub add-ons are updated to use mainly the ``EventCase`` test class holding
      users and side data. Data specific to those modules (event type with some
      specific configuration notably) is created and used in tests in the given
      module only, and not through generic event_type_complex and event_0 test
      data anymore.
      
      With this commit tests are more localized to their add-on and modifying data
      in a given add-on has less chances to have unwanted side effect in other event
      submodules unit tests.
      
      Task-2703285 (Event performance improvements)
      Task-2703289 (Event testing and coverage)
      
      Part-of: odoo/odoo#81068
      db19463f
Loading