Skip to content
Snippets Groups Projects
  1. Jun 17, 2021
  2. Jun 24, 2021
    • William Braeckman's avatar
      [FIX] hr_recruitment: fix calendar_events · f23e07dc
      William Braeckman authored
      
      When using the Add button on the calendar view introduced with
      odoo/odoo#64948 the event would not be linked with the applicant.
      
      After further investigation the method used to get the applicant id in
      default_get was not flexible enough, the one from crm calendar has been
      'copied'
      
      Task ID: 2578165
      
      closes odoo/odoo#72731
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      f23e07dc
  3. Jul 01, 2021
    • Nicolas Lempereur's avatar
      [FIX] hr_holidays: request date tz whole company · de629275
      Nicolas Lempereur authored
      
      When setting the request_date_from and request_date_to when creating a
      leave that will be used to show the range of days of the leaves, we are
      using the current user timezone to determine it.
      
      eg. in UTC+2 if the leave begins at midnight on the 6th, we will see 6
      and not 5 which is the day in UTC.
      
      When creating a leave in a mode different than employee, when it is
      confirmed and a leave is created for each employee, we would use the UTC
      day instead which is a little unexpected.
      
      Without the fix, the added test fails with:
      
          AssertionError: datetime.date(2019, 5, 5) !=
          datetime.date(2019, 5, 6) : Timezone should be kept between company
          and employee leave
      
      opw-2573730
      
      closes odoo/odoo#73073
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      de629275
  4. Jul 09, 2021
  5. Jul 11, 2021
  6. Jul 09, 2021
  7. Jul 08, 2021
    • Ivan Yelizariev's avatar
      [FIX] mail: speed up read_progress_bar · d17c20e2
      Ivan Yelizariev authored
      
      This commit fixes the performance issue in getting statistics for
      ``activity_state`` (colored clock icon for overdue/today/planned) in
      CRM.  The query has been tested for several years on a large database
      (Odoo's own production database).
      
      Performance test on 29 K crm.lead records (activity_state):
      
      With a filter for 10 records:
      
      ```
      | measurement        | before | after |
      |--------------------+--------+-------|
      | number of queries  |     25 |     5 |
      | query time, ms     |     12 |    95 | (*)
      | remaining time, ms |     32 |     7 |
      ```
      
      All records:
      
      ```
      | measurement        | before | after |
      |--------------------+--------+-------|
      | number of queries  |   1326 |     5 |
      | query time, ms     |   1739 |   129 |
      | remaining time, ms |  47934 |    17 |
      ```
      
      As we can see in the last results, the time went from almost 50 seconds
      (not responsive at all) to 150 milliseconds (responsive).  The time
      increase in (*) may be caused by imperfect measurements, which are raw
      and not averaged measures.
      
      ---
      
      opw-2346901
      task-1915411
      
      closes odoo/odoo#67004
      
      Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
      Co-authored-by: default avatarNicolas Seinlet <nse@odoo.com>
      d17c20e2
    • Ivan Yelizariev's avatar
      [FIX] web: speed up read_progress_bar · e54d87b7
      Ivan Yelizariev authored
      
      The method is used to get progress per column in kanban view
      (green-yellow-red-red lines in Project, CRM etc).  There are two main
      usages:
      
      1. get statistics for ``kanban_state`` (red/green circles)
      2. get statistics for ``activity_state`` (colored clock icon for overdue/today/planned)
      
      Before this commit all cases were handled by calling search_read and then
      counting records per group in a python script.  This is very inefficient,
      especially for ``activity_state``.
      
      This new implementation relies on ``read_group`` when possible, i.e.,
      when both grouping fields (kanban column and progressbar field) are
      stored (case 1).  It then falls back on a naive implementation inside
      ``_read_progress_bar``.  Cases like 2 above can be addressed by
      overriding ``_read_progress_bar``.
      
      We also added some minimal test to ensure that we don't break anything.
      
      1. Performance test on 60 K project.task records (kanban_state):
      
      With a filter for 6 records:
      
      ```
      | measurement        | before | after |
      |--------------------+--------+-------|
      | number of queries  |      8 |     5 |
      | query time, ms     |     11 |     7 |
      | remaining time, ms |     21 |     9 |
      ```
      
      All records:
      ```
      | measurement        | before | after |
      |--------------------+--------+-------|
      | number of queries  |     67 |     5 |
      | query time, ms     |    300 |    55 |
      | remaining time, ms |   1780 |    12 |
      ```
      
      Co-authored-by: default avatarRaphael Collet <rco@odoo.com>
      
      ---
      
      opw-2346901
      task-1915411
      e54d87b7
  8. Jul 06, 2021
    • Adrien Widart's avatar
      [FIX] sale_stock: set invoice_status value when delivery is canceled · 9bedda18
      Adrien Widart authored
      
      Suppose the option "Lock Confirmed Sales" enabled and a product with the
      invoicing policy set to "Delivered quantities". When cancelling the
      delivery of such a product, the invoice status of the associated SO
      should be 'Nothing to Invoice'
      
      To reproduce the error:
      1. In Settings, enable "Lock Confirmed Sales"
      2. Create a product P:
          - Type: Consumable
          - Invoicing policy: Delivered quantities
      3. Create a SO with one P
      4. Confirm the SO
      5. Cancel the SO's delivery
      6. Check the invoice status (`invoice_status`)
          - 12.0: Either by modifying the view, or by adding the field with
      studio or directly via PSQL
          - 13.0+: The field can be enabled thanks to the options of the tree
      view
      
      Error: The invoice status is "Fully Invoiced" but the product hasn't be
      delivered and no invoice has been created
      
      OPW-2464343
      
      closes odoo/odoo#73310
      
      Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
      9bedda18
  9. Jul 07, 2021
  10. Jul 05, 2021
    • Touati Djamel (otd)'s avatar
      [FIX] mrp: fix BOM structure & cost · 06c17274
      Touati Djamel (otd) authored
      
      Steps to reproduce the bug:
      - Install manufacturing app
      - Create a product “A”
      - Create a Bill of Materials for product A > add any product > save
      - Create another Product “B” > Create a BOM and add the product “A” in quantity “0” > save
      - Click on “BOM Structure & Cost” for product “B” > open the sublevel BOM dropdown of the product “A”
      
      Problem:
      An error is triggered because the quantity of the product is "None"
      
      opw-2585033
      
      closes odoo/odoo#73233
      
      Signed-off-by: default avatarAnh Thao PHAM <kitan191@users.noreply.github.com>
      06c17274
    • Nasreddin Boulif (bon)'s avatar
      [FIX] product: reset `Based on` on change pricelist `Compute Price` · 3f409c08
      Nasreddin Boulif (bon) authored
      
      Steps to reproduce:
      
        - Create a new pricelist;
        - In the Price Computation, select "Formula" then
          change it to "Based on Cost";
        - Change the price computation back to "Percentage (discount);
        - Create a sale and set this new pricelist.
      
      Issue:
      
        Price discount made on the cost of the product instead to get back
        to sale price as default
      
      Cause:
      
        When switching `Compute Price` and != 'formula', not setting back
        `Based on` (base) to `Public Price` (list_price).
      
      Solution:
      
        If compute_price is changed and new value != 'formula'; set
        pricelist `Based on` to `Public Price`.
      
      opw-2587295
      
      closes odoo/odoo#73220
      
      Signed-off-by: default avatarbon-odoo <nboulif@users.noreply.github.com>
      3f409c08
  11. Jul 02, 2021
    • Mohammed Shekha's avatar
      [FIX] web: prevent no content helper on delete/archive list records · 33445209
      Mohammed Shekha authored
      
      before this commit: when deleting or archiving or unarchive all records of last
      page in listview user is displayed with NoContentHelper while we still have
      other records in previous page, user should be moved to previous page if all
      records of last page are deleted.
      
      after this commit: if user deletes or archives or unarchives all records of
      last page in list view then user is moved to previous page.
      
      task-2446911
      
      closes odoo/odoo#66523
      
      Signed-off-by: default avatarSimon Genin (ges@odoo) <ges@odoo.com>
      33445209
  12. Jul 04, 2021
  13. Jul 01, 2021
    • Paul Morelle's avatar
      [FIX] digest: avoid exception on user creation · 9bb031b4
      Paul Morelle authored
      
      Scenario to reproduce the issue on runbot 12.0 Community:
      - Go to Settings > Technical > Email > Digest Emails
      - Select the Weekly Digest
      - Click on Action > Delete
      - Click on OK
      - Go to Settings > Users & Companies > Users
      - Click on Create
      - Fill the Name and the Email Address
      - Save
      - Odoo Server Error - Missing Record
      
      Some users seem to delete this record to stop receiving the digest for
      everyone, including for future users.  The problem is that, even if the
      digest has been deleted, the config parameters are still referencing it.
      
      This commit prevents the exception by having an empty recordset if the
      digest does not exist.
      
      closes odoo/odoo#73077
      
      Signed-off-by: default avatarPaul Morelle <madprog@users.noreply.github.com>
      9bb031b4
  14. Jun 29, 2021
  15. Jun 16, 2021
  16. Jul 01, 2021
    • Ivan Yelizariev's avatar
      [FIX] google_calendar: make commit after user sync · 78a66573
      Ivan Yelizariev authored
      
      syncing calendar for a single user may take few minutes, which could easily lead
      to cron timeout. To avoid starting the syncronization over and over again, we
      should commit updates that are already done.
      
      The module already has many commit() calls, but those are not always used and
      hence we need to add a new one.
      
      ---
      
      opw-2577018
      
      closes odoo/odoo#73054
      
      Signed-off-by: default avatarIvan Yelizariev // IEL <yelizariev@users.noreply.github.com>
      78a66573
    • Adrian Torres's avatar
      [FIX] tests: remove f-string in classCleanUp backport · e9a1559f
      Adrian Torres authored
      
      This commit is a fixup to the earlier commits that backport CPython's
      3.8 classCleanups, due to the fact that the official supported python
      version for Odoo V12 is CPython 3.5, where f-strings are not available.
      
      This one slipped through due to the fact that v12 runbot does not
      actually run under Python 3.5 but 3.6+
      
      closes odoo/odoo#73074
      
      Signed-off-by: default avatarAdrian Torres (adt) <adt@odoo.com>
      e9a1559f
    • Adrian Torres's avatar
      [FIX] tests: make --test-file great again · a2463b21
      Adrian Torres authored
      
      Sort of but not really, this commit fixes a special case in which
      launching a --test-file of a file with at least two SavepointCases would
      create a postgresql deadlock and it would be impossible to terminate the
      Odoo process without sending a SIGKILL or waiting for the lock to
      timeout.
      
      This was introduced at #39368 and happens because of the way that
      unittests unwraps suites, to keep it short, when it unwraps the custom
      OdooSuite class internally, it ends up with a vanilla TestSuite with
      which to run the different test cases, and since #39368 depends on the
      overrides added to OdooSuite to function, the class cleanups are not
      triggered at the end of a test class (rollback, cache cleanups, env
      reset, registry reset, etc.).
      
      The fix is to manually unwrap the suite of tests to keep OdooSuite as
      the suite with which to call the tests, which was already done for
      --test-enable (although for different reasons, --test-tags?) which is
      why --test-enable didn't have any problems.
      
      This commit also fixes a typo I found on the backport, which meant
      classCleanups were not being executed if the setUpClass failed, but it
      had no effect on classCleanups during tearDownClass.
      
      Task-ID 2160398
      Depends on #43135
      
      closes odoo/odoo#73044
      
      Signed-off-by: default avatarAdrian Torres (adt) <adt@odoo.com>
      a2463b21
    • Adrian Torres's avatar
      [IMP] tests: use addCleanup and addClassCleanup where useful · 3854eee2
      Adrian Torres authored
      This commit takes advantages of the features added in the parent commit
      to have better/cleaner tests.
      3854eee2
    • Adrian Torres's avatar
      [IMP] tests: partially backport classCleanups from CPython 3.8 · 512abb7a
      Adrian Torres authored
      This commit partially backports bpo-24412, which allows the definition of
      class cleanups (addClassCleanup) and module cleanups (omitted),
      similar to instance cleanups (addCleanup).
      
      This is useful for tests that override unittest's setUpClass and
      could crash during its execution: If this happens, it is possible that a
      bunch of crap is left in the database or even worse, the cursor becomes
      completely fucked; Thanks to the addClassCleanup, we can undo the damage
      done by the setUpClass.
      
      Another benefit is that it is called unconditionally after tearDownClass
      is called, so it can also be called as a replacement and/or safer
      tearDownClass.
      512abb7a
  17. Jun 30, 2021
    • yograj tandel's avatar
      [FIX] web: datepicker week date offset · 2529ab67
      yograj tandel authored
      PURPOSE
      
      The week dates computed by our datepicker do not meet the ISO 8601 standard:
      
      The ISO 8601 definition for week 01 is the week with the first Thursday of the
      Gregorian year (i.e. of January) in it.
      The following definitions based on properties of this week are mutually
      equivalent, since the ISO week starts with Monday:
      - It is the first week with a majority (4 or more) of its days in January.
      - Its first day is the Monday nearest to 1 January.
      - It has 4 January in it. Hence the earliest possible first week extends from
      Monday 29 December (previous Gregorian year) to Sunday 4 January, the latest
      possible first week extends from Monday 4 January to Sunday 10 January.
      - It has the year's first working day in it, if Saturdays, Sundays and 1
      January are not working days.
      
      If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in W01. If
      it is on a Friday, it is part of W53 of the previous year. If it is on a
      Saturday, it is part of the last week of the previous year which is numbered
      W52 in a common year and W53 in a leap year. If it is on a Sunday, it is part
      of W52 of the previous year.
      https://en.wikipedia.org/wiki/ISO_week_date#First_week
      
      
      
      Since Jan 1st 2021 falls on a Friday, according to the ISO 8601 standard above,
      the first week of 2021 is the one starting on Jan 4th.
      Nevertheless, it looks like our datepicker simply assumes that the first week
      of the year is simply the one including Jan 1st.
      
      SPECIFICATION
      
      Fix the week dates of our datepicker to meet the ISO 8601 standard.
      
      Task - 2458112
      
      closes odoo/odoo#70473
      
      Signed-off-by: default avatarSimon Genin (ges@odoo) <ges@odoo.com>
      Co-authored-by: default avatarMohammed Shekha <msh@odoo.com>
      2529ab67
  18. Jun 29, 2021
  19. Jun 28, 2021
  20. Jun 27, 2021
  21. Apr 28, 2021
  22. Jun 10, 2021
  23. Jun 22, 2021
  24. Jun 17, 2021
  25. Jun 21, 2021
    • Ivan Yelizariev's avatar
      [FIX] uom: avoid unneeded qty conversion and fields fetching · a122db22
      Ivan Yelizariev authored
      
      This could save some time when `_compute_quantity` is used thousands times in
      request and there are thousands UOMs in the system
      
      * if qty is zero, then result is zero
      * if to_unit is the same, then result is `round((qty / factor) * factor) = round(qty)`
      
      ---
      
      opw-2549026
      
      closes odoo/odoo#72433
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      a122db22
    • Touati Djamel (otd)'s avatar
      [FIX] base: fix the VAT verification · 5182be96
      Touati Djamel (otd) authored
      Steps to reproduce the bug:
      
      - Go to settings > create a new company :
      	- Choose the country : `Mexico`
      	- fill in the VAT field : ESA2005273X1
      	- save
      - Validation error is triggered
      
      Problem:
      
      The Mexican VAT can be on the format: "MXESA2005273X1" or "ESA2005273X1".
      But only the "MX .." format is accepted for the moment,
      and it fails in the case of "ES.." because the function checks if it is a valid Espganol VAT number.
      
      In the case of failure, we use the `partner.commercial_partner_id.country_id` to get the country code.
      The problem is when creating the res.company, we also create a res.partner
      with a few fields within `VAT` except `country_id` field
      while we use it in the `check_vat` function : https://github.com/odoo/odoo/blob/7a7aacedde81998ec0f1a7f3283337236e56de42/addons/base_vat/models/res_partner.py#L167
      
      
      
      Opw-2573557
      
      closes odoo/odoo#72451
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      5182be96
    • MANALIMALPANI's avatar
      [FIX] auth_ldap: fix LDAP error handling · 24a3f669
      MANALIMALPANI authored
      
          In order to ensure consistent results of all error conditions returned
          by the LDAP server, the _authenticate() method should return `False`
          for every kind of exception, not just for INVALID_CREDENTIALS.
      
          This is not actually relevant in 12.0 as the result is exactly the
          same, due to the way the `entry` variable is being initialized, but it
          will make the code path "visibly consistent" across all supported
          versions
      
      closes odoo/odoo#72348
      
      Signed-off-by: default avatarOlivier Dony (odo) <odo@openerp.com>
      24a3f669
    • Adrien Widart's avatar
      [FIX] payment_sips: prevent clearing the session cookie · b60e1574
      Adrien Widart authored
      When buying a product on website shop, after the payment with SIPS, the
      page is redirected to an Error message: "We are not able to find your
      payment, but don't worry. You should receive an email confirming your
      payment in a few minutes. If the payment hasn't been confirmed you can
      contact us."
      
      To reproduce the error:
      1. In Payment Acquirers, enable Sips
      2. Go on website shop
      3. Add a product to the cart, Checkout
      4. Pay with Sips
          - Visa card number: 4100000000000000
      5. Back to Web-shop, if the payment has been successfully processed,
      repeat steps 2 -> 4
      
      Error: The message "Your payment has been successfully processed. Thank
      you!" is not displayed. Instead, the message "We are not able [...] you
      can contact us." is displayed.
      
      This message is displayed when:
      https://github.com/odoo/odoo/blob/5945806c151b13d9d4cc13aa0a6c96a6b1bbad5f/addons/payment/controllers/portal.py#L65-L69
      i.e., when the transactions list is empty. Here is how to get the list:
      https://github.com/odoo/odoo/blob/5945806c151b13d9d4cc13aa0a6c96a6b1bbad5f/addons/payment/controllers/portal.py#L38-L42
      It uses the session of the request. The cookie `session_id` is used to
      identify the current session. However, after the payment on SIPS, the
      page is redirected to `/payment/sips/dpn` with a POST request. Since the
      session cookie has the attribute `SameSite=Lax` and the HTTP request is
      a POST, the cookie will be filtered out:
      https://drive.google.com/file/d/1xfx3YWkfonO3nK-8Rew45uSoR4lkpjpY/view?usp=sharing
      
      
      (Browser information: This cookie didn't specify a "SameSite" attribute
      when it was stored and was defaulted to "SameSite=Lax," and was blocked
      because the request was made from a different site and was not initiated
      by a top-level navigation. The cookie had to have been set with
      "SameSite=None" to enable cross-site usage)
      As a result, the server creates a new one. This is the reason why the
      transactions list is empty: the list is based on a new session.
      
      Adding the attribute `save_session = False` to the route will prevent
      the server from creating a new session cookie and add it in the POST
      response.
      
      OPW-2518377
      
      closes odoo/odoo#72267
      
      Signed-off-by: default avatarAntoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
      b60e1574
  26. Jun 18, 2021
  27. Jun 20, 2021
Loading