Skip to content
Snippets Groups Projects
  1. Nov 18, 2022
    • Aurélien (avd)'s avatar
      [FIX] res_currency: add order by to _select_companies_rates query · 8b7a3941
      Aurélien (avd) authored
      
      PG12 introduced an optimization for CTEs that automatically inlines
      CTEs if they are only refered once in the parent query. Prior to that
      CTEs were always materialzed, meaning that PG created a sort of temp
      table on the fly to store the result of the CTE's evaluation.
      
      Whereas this leads to performance improvements in general, in the
      particular case of _select_companies_rates this inlining becomes a
      performance bottleneck. This is because while the currency_rate CTE
      is only refered once in both purchase_report and product_margin,
      the join condition (cr.date_end is null or cr.date_end > ...)
      requires evaluating the CTE's date_end subquery twice. This, combined
      with the fact that in PG12 the planner goes for a Nested Loop JOIN instead
      of a HASH Join in PG10 makes the performances of the whole query
      much worse in PG12 than in PG10.
      
      Adding an ORDER BY (or an OFFSET 0, the resulting plan is the same)
      creates a kind of optimization fence that forces PG to evaluate the
      subquery first using its own plan. This removes the need to rescan the
      subquery each time the Merge JOIN filter has to be applied, which
      is a good strategy in this specific situation.
      
      The same result could be achieved by adding the keyword "MATERIALIZED"
      in the CTE definition. The issue is that this keyword did not exist
      in PG 10 so using it would require to check the PG version at runtime
      from python.
      
      Examples of query timings change before and after PR:
      
      Number of POs | Before PR | After PR
            2000    |     7s    |    345ms
            7000    |     23s   |    1.1s
      
      opw-2930578
      
      closes odoo/odoo#98844
      
      Signed-off-by: default avatarRaphael Collet <rco@odoo.com>
      8b7a3941
  2. Nov 16, 2022
  3. Nov 14, 2022
  4. Nov 13, 2022
  5. Nov 09, 2022
  6. Nov 08, 2022
    • Florian Vranckx's avatar
      [IMP] base: improve perfomance of has_group · 4344d399
      Florian Vranckx authored
      
      Using the already existing indexing on the model to slightly improve the perfomance.
      
      closes odoo/odoo#105280
      
      Signed-off-by: default avatarVranckx Florian (flvr) <flvr@odoo.com>
      4344d399
    • PNO's avatar
      [FIX] stock: block product type change if sales count · 1b2c045f
      PNO authored
      
      Steps to reproduce:
      - Create a product and complete a sales order.
      - Then try to change the product type.
      - The following message is shown:
      "You cannot change the products type because it is already used in sales orders."
      However, we can close the message and save.
      
      Problem:
      If some sales were already made, it should not be possible to change the product type.
      There is a warning message on the onchange but it's not blocking.
      This causes inconsistencies between the quantities and value shown in the quants and in the valuation layers.
      
      Solution:
      Raise an user error when trying to save the changes.
      
      opw-3000886
      
      closes odoo/odoo#101547
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      1b2c045f
  7. Nov 07, 2022
  8. Nov 06, 2022
  9. Nov 03, 2022
    • jbw's avatar
      [FIX] base: keep company currency active · 1e336810
      jbw authored
      
      This commit aims at preventing the deactivation of a company currency.
      Was the issue on 2852452 support ticket (v14). But it seems appropriate to merge it in 13.0 as it is probably a good idea that a company currency always stays active.
      
      How to reproduce bug:
      In 13.0:
      Install accounting with demo data > activate multi currency in settings > deactivate usd > create new invoice > select eur currency > cannot set usd currency back on invoice
      
      Reconcile JS traceback in 14.0:
      Install accounting with demo data > activate multi currency in settings > deactivate usd > go to accounting dashboard > click on reconcile 7 items on Bank journal > click on any “customer/vendor matching” line.
      
      closes odoo/odoo#91470
      
      Task: 2852452
      Signed-off-by: default avatarQuentin De Paoli <qdp@odoo.com>
      1e336810
  10. Oct 31, 2022
    • PermanAtayev's avatar
      [FIX] calendar: avoid MemoryError when getting recurrent ids · 527fc34c
      PermanAtayev authored
      When there are many `calendar.event`s (700K+), MemoryError happens when they are tried to be sorted
      before returning them in `get_recurrent_ids` method.
      
      [upg-377987](https://upgrade.odoo.com/web#action=150&cids=1&id=377987&menu_id=107&model=upgrade.request&view_type=form)
      Traceback from the upgrade request:
      ```
      Traceback (most recent call last):
        File "/home/odoo/src/odoo/12.0/odoo/addons/base/maintenance/migrations/base/tests/test_mock_crawl.py", line 220, in crawl_menu
          self.mock_action(action_vals)
        File "/home/odoo/src/odoo/12.0/odoo/addons/base/maintenance/migrations/base/tests/test_mock_crawl.py", line 347, in mock_action
          mock_method(model, view, fields_list, domain, group_by)
        File "/home/odoo/src/odoo/12.0/odoo/addons/base/maintenance/migrations/base/tests/test_mock_crawl.py", line 368, in mock_view_form
          records = model.search(domain, limit=3)
        File "/home/odoo/src/odoo/12.0/odoo/models.py", line 1581, in search
          res = self._search(args, offset=offset, limit=limit, order=order, count=count)
        File "/home/odoo/src/odoo/12.0/addons/calendar/models/calendar.py", line 1802, in _search
          events = self.browse(events.get_recurrent_ids(args, order=order))
        File "/home/odoo/src/odoo/12.0/addons/calendar/models/calendar.py", line 1261, in get_recurrent_ids
          return [r['id'] for r in sorted(result_data, key=key)]
        File "/home/odoo/src/odoo/12.0/addons/calendar/models/calendar.py", line 1259, in key
          for v, desc in vals_spec
        File "/home/odoo/src/odoo/12.0/addons/calendar/models/calendar.py", line 1259, in <listcomp>
          for v, desc in vals_spec
      MemoryError
      
      The issue is happening in the `key` function when data is being sorted before returning it. In this function to compare events for every key a list is returned.
      Returning a list for every element leads to a memory error because lists over allocate memory when they are created to make Time complexity of [appending to a list O(1) in amortized time](https://stackoverflow.com/questions/46664007/why-do-tuples-take-less-space-in-memory-than-lists
      
      )
      Over allocating memory a few times would not be a problem but given that this db has 700K+ `calendar.events`, over allocation causes a memory error. That's why it is better
      to return tuples instead of lists, which do not over allocate because they are immutable, which will resolve the MemoryError.
      
      closes odoo/odoo#103182
      
      X-original-commit: c53081f1
      Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
      527fc34c
  11. Oct 30, 2022
  12. Oct 28, 2022
    • JordiMForgeFlow's avatar
      [FIX] mrp: ensure only active BoMs are considered on product2bom · 5e07b367
      JordiMForgeFlow authored
      
      When executing the product2bom method it is possible that an active_test
      context is present in self. However, the method should not consider
      archived BoMs.
      
      closes odoo/odoo#100771
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      5e07b367
    • David (dafr)'s avatar
      [FIX] purchase: Add 'price_total' & 'price_tax' to the order lines tree · e99cdd64
      David (dafr) authored
      
      # Description
      The absence of those fields can generate a log note spam & performance issue when updating an order line value.
      
      # HOW TO REPRODUCE
      - Create PO with 40+ order lines (50 recommend) (* SA to reproduce would be nice)
      - Confirm PO (state needs to be "purchase")
      - Update the Ordered Quantity of the first line.
      - Save
      => PO Lines from page 2 and beyond have each created the following log message:
      "The ordered quantity has been updated."
      
      # Explanation
      The purchase.order.line onchange will not save any update on 'price_total' because it is not on the onchangeSpec.
      Then a purchase.order onchange is done, and this one does have 'order_line.price_total' on the onchangeSpec, forcing the onchange method to return the field 'order_line' (aka ALL the order lines) as updated.
      When saving the changes, the JS framework, who does not have the data for the order_lines on the 2nd page, will not correctly filter the fields with real changes, and add the 'product_qty' field (and more) to the "write" call for every order_line not in the 1st page.
      Then the write method, without checking if there is any real change on the product_qty, for each lines that has product_qty in the Write's values, will write in the log note and call a performance intensive method: _create_or_update_picking()
      
      OPW-2982004
      
      closes odoo/odoo#100064
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      e99cdd64
  13. Oct 26, 2022
    • Solan Delvenne (sode)'s avatar
      [FIX] snailmail: Fix name not appearing on snailmail cover · e058add2
      Solan Delvenne (sode) authored
      
      closes odoo/odoo#104196
      
      Signed-off-by: default avatarLouis Baudoux (lba) <lba@odoo.com>
      e058add2
    • Guillaume (gdi)'s avatar
      [FIX] website_blog: display all the blog posts when filtered · aa7f5a00
      Guillaume (gdi) authored
      
      Before this commit, following these steps:
      - Go to /blog
      - Activate the option Customize > Top banner - Name / Latest Post
      - Disable the option Customize > Full Width Cover
      - Click on the "guides" tag of the "Buying A Telescope" blog
      
      No blog is displayed. This was because the top banner post is not shown
      when the posts are filtered. Basically, once filtered, a blog post was
      always missing.
      
      Related to opw-2882492
      
      closes odoo/odoo#93680
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      aa7f5a00
    • qsm-odoo's avatar
      [FIX] website_blog: fix link on the top banner of /blog · f32992de
      qsm-odoo authored
      
      Before this commit, following these steps:
      - Go to /blog
      - Activate the option Customize > Top banner - Name / Latest Post
      - Disable the option Customize > Full Width Cover
      
      The URL to which we are redirected when we click on the blog of the
      post presented at the top of the page leads to an error.
      
      Indeed the URL of that link is something like "/blog?blog=blog.blog(2,)"
      because of the template wrongly using the 'blog_url' QueryURL which is
      defined in the case where we are rendering a blog page where no specific
      blog is selected. We define that as `QueryURL('/blog', ['tag'], ...)`
      but then parts of the template used it like this: `blog_url(blog=X)`
      thus generating an URL like "/blog?blog=blog.blog(2,)". Adding "blog" to
      the list of params would not be right as would create "/blog/blog/2"
      which is still wrong as we want "/blog/2". And of course the "/blog"
      prefix in the QueryURL definition is needed in case we only specify a
      tag via `blog_url(tag=X)` (we expect /blog/tag/X). Patching QueryURL or
      making blog_url a custom function instead of a QueryURL instance could
      be a solution but it was judged not stable enough. We'll do that in
      master. Here we only support "/blog?blog=blog.blog(2,)" URLs.
      
      Note that many parts of those templates do not use the `blog_url`
      function and simply build the URL by hand, which is why the bug only
      occurred for a very specific set of blog options.
      
      opw-2882492
      
      Part-of: odoo/odoo#93680
      Co-authored-by: default avatarGuillaume (gdi) <gdi@odoo.com>
      f32992de
  14. Oct 25, 2022
  15. Oct 24, 2022
    • Andrea Grazioso (agr-odoo)'s avatar
      [FIX] website_sale: fiscal position application · 17aa4051
      Andrea Grazioso (agr-odoo) authored
      
      Have the following taxes:
      - Tax A: 15%, included in price
      - Tax B: 21%, included in price
      
      Create a product P with list price 115 and tax A
      
      Have a fiscal positions FPOS configured with:
      - Detect Automatically checked
      - Country: Belgium
      - Map tax on product: A -> B
      
      Open a web shop session as guest, add P to cart
      Go to checkout: Price total will be 115
      Fill address details with Belgium address
      Go to confirmation page
      
      Error:
      Price total will be 100. In the application of fiscal position the wrong
      unit price is used
      
      opw-2973879
      
      closes odoo/odoo#101364
      
      Signed-off-by: default avatarWilliam Braeckman (wbr) <wbr@odoo.com>
      17aa4051
    • Solan Delvenne (sode)'s avatar
      [FIX] snailmail: mandatory cover page + handle cover page generation · 44a3ae0f
      Solan Delvenne (sode) authored
      
      Pingen's v2 API does not offer an endpoint to generate a Cover Page automatically with an API call anymore, thus the need to generate it and append it to the invoice from the client-side beforehand.
      Also make the Cover Page option mandatory due to the invoice being near
      impossible to format for Pingen's validation needs. (Odoo 13 Only)
      
      closes odoo/odoo#103385
      
      Signed-off-by: default avatarLouis Baudoux (lba) <lba@odoo.com>
      44a3ae0f
  16. Oct 23, 2022
  17. Oct 20, 2022
    • Ivan Yelizariev's avatar
      [FIX] web: convert python/js bool values in read_progress_bar · 73a7f4e4
      Ivan Yelizariev authored
      
      Because of an issue with converting bool values, read_progress_bar didn't work
      on grouping by bool fields (e.g. Active).
      
      Related tests worked fine because mocked server responses were different from
      real server responsed. So, we need to adjust mocked server too.
      
      opw-2870937
      
      closes odoo/odoo#95654
      
      Signed-off-by: default avatarJulien Mougenot (jum) <jum@odoo.com>
      73a7f4e4
    • pedrambiria's avatar
      [FIX] core: prevent overriding "no-store" for "Cache-Control" · 397e9179
      pedrambiria authored
      
      Before this commit: the "no-store" was overridden in developer mode.
      
      'no-cache' does not require that the response must not be stored in the
      cache. It only specifies that the cached response must not be reused to
      serve a subsequent request without re-validating.
      It is up to the browser what to qualify as a subsequent request. In
      Chrome, using the back button and duplicating the tab does not. So I
      agree that it's better to use 'no-store' in dev mode.
      
      The solution is to prevent changing the "Cache-Control" if it's "no-store".
      
      opw-2855802
      
      closes odoo/odoo#101590
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      397e9179
  18. Oct 19, 2022
  19. Oct 16, 2022
  20. Oct 11, 2022
  21. Oct 09, 2022
  22. Oct 07, 2022
  23. Oct 06, 2022
  24. Oct 04, 2022
    • Laurent Desausoi (lade)'s avatar
      [FIX] point_of_sale: adapt logo for multi companies customer display · 7a41e93f
      Laurent Desausoi (lade) authored
      
      Customer display does not show the appropriate logo when multi-company is
      enabled. The logo shown is always the logo of the default company.
      
      Step to reproduce the issue:
      1) Install Point of Sale and set up a second company
      2) Put a logo on both companies (different ones)
      3) Create a POS session on the newest company (not the default one)
      4) In this session, activate Customer Display
      5) Launch the session and open the Customer Display
      The logo shown is the logo of the default company.
      
      Solution: The issue is that when fetching the logo, we don't include
      information about the current company. Thus, we include the logo of the default
      company (at url /logo). We can easily specifiy which logo we need via the url
      /logo?company={company_id}. As dynamic information cannot be included into a
      CSS, we include this into the XML as it is done with other images rendered.
      In our case, we don't need to retrieve the logo and map it to base 64 (for
      ressources requiring to be logged in) because the logo is a resource available
      to anyone.
      
      opw-2745014
      
      closes odoo/odoo#93638
      
      Signed-off-by: default avatarTrinh Jacky (trj) <trj@odoo.com>
      7a41e93f
  25. Oct 03, 2022
  26. Oct 02, 2022
  27. Sep 30, 2022
  28. Sep 29, 2022
Loading