Skip to content
Snippets Groups Projects
  1. Mar 13, 2023
  2. Mar 02, 2023
  3. Feb 27, 2023
    • Elias Regopoulos's avatar
      [FIX] base_iban: Avoid KeyError on IBAN with non-ASCII characters · fc468f5a
      Elias Regopoulos authored
      
      If the IBAN includes a non-ASCII alphanumeric character and has just the right length, the IBAN validation crashes with a KeyError before validation can take place.
      
      Fictional example: The supposed IBAN code "Bank München-Wiesn GmbH" gets normalized to "BankMünchenWiesnGmbH"; a string that starts with a valid country code ('BA', ie. Bosnia-Herzegovina) and happens to have the same length as Bosnia-Herzegovina's IBAN format (20 characters). Normally this erroneous IBAN would've been rejected as invalid, but Python throws a KeyError when trying to convert 'ü' to an int right before the validation step.
      
      We therefore need to also check if all characters in the IBAN code are within the expected range, namely [a-zA-Z0-9] (strictly speaking, the IBAN's specification range is only [A-Z0-9], but we can be lenient since Python's `int()` is case-insensitive).
      
      closes odoo/odoo#108338
      
      Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
      fc468f5a
  4. Feb 16, 2023
  5. Feb 02, 2023
  6. Jan 25, 2023
  7. Jan 16, 2023
    • Katherine Zaoral's avatar
      [FIX] sale_stock: invoice reporte lot_values · d3350522
      Katherine Zaoral authored
      
      Before this change, the lots info of the products that are shown in the
      invoice report were always computed, no matter if they were printed or
      not. It is always computing the lots information, no matter if it will
      be printed or not
      
      With this change, the lost info only is computed when is actually used
      and will be printed: that is when the user has the
      sale_stock.group_lot_on_invoice group.
      
      closes odoo/odoo#97348
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      d3350522
  8. Jan 15, 2023
  9. Jan 10, 2023
    • Nshimiyimana Séna's avatar
      [FIX] product: apply pricelist formula rounding AFTER currency conversion · ab6fe46e
      Nshimiyimana Séna authored
      
      The setup:
      * activate multicurrency and a secondary currency, for example the DKK.
        Make sure the exchange rate is not 1.
      * in Settings - Sales - Pricelists, activate Advanced Price Rules
      * create a new DKK pricelist with the following settings:
        * Compute Formula
        * Based on Sales Price
        * Discount 42% (or any another value)
        * Rounding Method 1.00
        * Apply on All Products
        * Min Quantity 10
      
      Steps to reproduce:
      * create a new sales order
      * set Pricelist = the DKK pricelist you created
      * add a product and set the quantity to 10
      
      You should see that the total, after application of the pricelist, is
      not rounded.
      
      Cause:
      The price is being rounded before conversion to the pricelist's
      currency.
      
      Solution:
      
      Finetuning of b7ec0a2e
      to make sure the pricelist base price is consistently rounded
      before applying the rule formula (surcharge, margins, rounding, ...).
      
      Previously, the price given to _compute_price was:
      
      * in the pricelist currency if the rule is based on another pricelist
      * in the product currency if the rule is based on the sales price
      * in the product cost currency if the rule is based on the cost
      
      Now, the price given is always in the pricelist currency.
      This modifies the API of the method in stable (modifying the currency
      of the price input), but is quite a logical change and required to fix
      the issue at hand.
      
      Note:
      The issue is fixed as of v15.2
      
      opw-3002376
      
      closes odoo/odoo#102920
      
      Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
      ab6fe46e
  10. Jan 08, 2023
  11. Jan 01, 2023
  12. Dec 25, 2022
  13. Dec 18, 2022
  14. Dec 12, 2022
  15. Dec 11, 2022
  16. Dec 04, 2022
  17. Dec 01, 2022
    • JordiMForgeFlow's avatar
      [FIX] purchase_mrp: filter cancelled moves when evaluating kit · 496f67ce
      JordiMForgeFlow authored
      
      The current behaviour does not filter the cancelled moves when
      evaluating if the product of the purchase order line is a kit.
      This causes that, in cases where you have a cancelled wrong receipt
      where the product was being received as a kit, if a new receipt is
      created without receiving as a kit Odoo will always expect it as a kit.
      
      After the fix, the cancelled moves will not be considered, as this is what
      should be expected from cancelled operations.
      
      closes odoo/odoo#106906
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      496f67ce
    • Solan Delvenne (sode)'s avatar
      [FIX] snailmail: overwrite margins in letters · 4abc7df7
      Solan Delvenne (sode) authored
      
      In order to pass the validation of the snailmail provider, the margins
      are required to have nothing but white pixels. To avoid letters being
      stuck until their layout is fixed, we fill the margins with white.
      
      closes odoo/odoo#106791
      
      Signed-off-by: default avatarFlorian Daloze (fda) <fda@odoo.com>
      4abc7df7
    • Tiffany Chang (tic)'s avatar
      [FIX] stock: relax SN quant restriction · cb9dbcb9
      Tiffany Chang (tic) authored
      Backport of
      https://github.com/odoo/odoo/commit/274dd3bf503e1b612179db92e410b336bfaecfb4
      
      
      (v15)
      
      Steps to reproduce:
      - create a product with tracking = 'lot'
      - create a receipt for the product with a done qty > 1 for 1 lot
      - change tracking of product to 'serial'
      - go to "Update Quantity" and try to update the existing quant
        inventory_quantity to 0
      
      Expected Result:
      It's possible to make the quant 0
      
      Actual Result:
      Confusing Validationerror occurs:
      "A serial number should only be linked to a single product."
      
      Error occurs because the corresponding Inventory adjustment location is
      not allowed to have more than quant.quantity > 1 so the user is never
      able to remove more than 1 of the quantity from their stock.
      
      opw-3062017
      
      closes odoo/odoo#106996
      
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      cb9dbcb9
  18. Nov 27, 2022
  19. Nov 23, 2022
  20. Nov 20, 2022
  21. 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
  22. Nov 16, 2022
  23. Nov 14, 2022
  24. Nov 13, 2022
  25. Nov 09, 2022
  26. 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
  27. Nov 07, 2022
  28. Nov 06, 2022
  29. 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
  30. 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
  31. Oct 30, 2022
  32. Oct 28, 2022
Loading