Skip to content
Snippets Groups Projects
  1. Apr 13, 2023
    • Thomas Lefebvre (thle)'s avatar
      [FIX] hr_timesheet: display timesheets without task in portal · 52703359
      Thomas Lefebvre (thle) authored
      
      Issue:
      When a project is shared with portal users,
      only timesheets that are linked to tasks will be displayed.
      
      Solution:
      Change the domain that selects the timesheets to be displayed
      to take into account timesheets that are not linked to a task,
      but are in a project to which the portal user has access.
      
      opw-3253632
      
      closes odoo/odoo#118356
      
      X-original-commit: 50280240
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      52703359
    • Touati Djamel (otd)'s avatar
      [FIX] purchase_stock: don't set effective_date only for return pickings · 1495b54a
      Touati Djamel (otd) authored
      Steps to reproduce the bug:
      - Create a storable product “P1”:
          - route: dropship
      
      - Create a purchase order:
          - customer: Azure interior
          - Deliver to: Dropship
          - Dropship Address: any address
          - Receipt Date: Tomorrow
          - Product: “P1”
      
      - Conform the Picking
      - Go to the dropship transfer:
          - Validate the picking
      
      - Go to the Scheduled Action > Purchase reminder
      - Run Manually
      
      Problem:
      The reminder email for the delivery is sent While the picking is in the
      'done' status.
      
      When we run the Scheduled action, the `_send_reminder_mail` function is
      triggered in which we get the orders with the `_get_orders_to_remind`
      function but we filter the purchase orders which have an "effective_date"
      already set:
      https://github.com/odoo/odoo/blob/181c7d82e30d0848bbac7f7d0188e81aced0af07/addons/purchase_stock/models/purchase.py#L279
      
      but as in drop-shipping, the dest location is customer and the
      "effective_date" is not set:
      https://github.com/odoo/odoo/blob/16.0/addons/purchase_stock/models/purchase.py#L53
      
      
      
      opw-3246218
      
      closes odoo/odoo#118064
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      1495b54a
    • Soukéina Bojabza's avatar
      [FIX] website: reset a form properly for each submission success type · ac11470b
      Soukéina Bojabza authored
      
      Before this commit, some behaviors of the forms after being submitted
      were problematic:
      
      - with the `On Success` option set on `Redirect`, when going back to a
      form after submitting it (with the browser arrows), the fields were
      still filled.
      - with the `Show Message` option selected, when going in edit mode when
      the message was displayed, the submit button was still "loading", even
      after saving.
      
      This commit solves this issues by properly resetting the form at each
      start and restoring the submit button loading effect when the message is
      displayed.
      
      task-2798576
      
      closes odoo/odoo#115540
      
      Signed-off-by: default avatarVray Benjamin (bvr) <bvr@odoo.com>
      ac11470b
    • Carlos Serra-Toro's avatar
      [FIX] l10n_ch: Inconsistent return for `_find_or_create_bank_account()` · 6c7385c7
      Carlos Serra-Toro authored
      The method `_find_or_create_bank_account()` is defined for an
      account.bank.statement.line so that it returns either the bank
      account found or created. The extension made by l10n_ch does not
      return the record found/created by a call to super(), which may
      break reconciliations.
      
      The code for the reconciliations in which a record is expected to
      be returned can be seen at: https://github.com/odoo/odoo/blob/
      c0eb0d41/addons/account/models/
      account_bank_statement.py#L1232.
      
      The original implementation of `_find_or_create_bank_account()`,
      where a record is returned always, is at: https://github.com/
      
      
      odoo/odoo/blob/c0eb0d41/addons/
      account/models/account_bank_statement.py#L1282-L1291.
      
      closes odoo/odoo#113147
      
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      6c7385c7
    • Abdelouahab (abla)'s avatar
      [FIX] web: nested bullet lists · f7220566
      Abdelouahab (abla) authored
      
      To reproduce
      ============
      on a quotation's description write a description with two or more nested bulletlists
      on web it looks good, but when printing the quotation thes nested bulletlists are not
      correctly rendered.
      
      Problem
      =======
      nested bulletlists on report level need style to correct their display
      
      Solution
      ========
      add the style
      opw-3196888
      
      closes odoo/odoo#117932
      
      Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
      f7220566
    • Nasreddin Boulif (bon)'s avatar
      [FIX] mail_thread: save attachment from mail in same encoding · afe55366
      Nasreddin Boulif (bon) authored
      
      Steps to reproduce:
      
        - Configure incoming mail server and set it to create X record
          on incoming mails (X can be any model with a chatter)
        - Create a CSV file and set the encoding to UTF-16
        - Send the CSV file through Gmail to the Odoo instance
        - Go to model X and open the created record
        - In the chatter, click/download the CSV file
        - Open the downloaded file with Geany (or any file editor that can
          show the file encoding)
      
      Issue:
      
        The file encoding is not the same as the original file (utf-8 instead
        of utf-16).
        Working with Outlook.
      
      Cause:
      
        The difference between Outlook and Gmail is that Gmail provides the
        charset of the file.
      
        The content of the mail is retrieved using `email` python lib.
        The lib will try to retrieve the charset of the file and fallback
        on `ASCII` if not available, then return the decode content.
      
      ```python
        def get_text_content(msg, errors='replace'):
          content = msg.get_payload(decode=True)
          charset = msg.get_param('charset', 'ASCII')
          return content.decode(charset, errors=errors)
      ```
      
        Example:
        content = b'd\x00a\x00,\x00,\x00,\......'
        Outlook:
        charset = 'ASCII'
        return => 'd\x00a\x00,\x00,\x00...'
        Gmail:
        charset = 'UTF-16LE'
        return => 'da,,,,,\n,,,,,\....'
      
        In the post process of the attachment, the content is encoded in
        'utf-8' (to then encoded in base64) before creating the attachment
        record.
      
        Content encoded to 'utf-8':
        Outlook: b'd\x00a\x00,\x00,\x00...'
        Gmail:  b'da,,,,,\n,,,,,\n....'
      
        Therefore, when writing the file on the disk, the encoding is based
        on the binary content.
      
      Solution:
      
        When parsing the mail, add the encoding charset to the `info` variable.
        Then, when creating the attachment, use the charset in `info` (or
        fallback on 'utf'8' if no charset set) to encode the content.
      
      opw-3089009
      
      closes odoo/odoo#118384
      
      X-original-commit: 7874c388
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      Signed-off-by: default avatarNasreddin Boulif (bon) <bon@odoo.com>
      afe55366
  2. Apr 12, 2023
    • Adrien Guilliams (adgu)'s avatar
      [IMP] pos, l10n_fr_pos_cert: change price_manually_set behaviour · 11e06f78
      Adrien Guilliams (adgu) authored
      
      The price_manually_set variable was used to largely, we fix it
      by adding a price_automatically_set variable. The price_manually_set
      is now used when changing the price through the numpad, whereas
      price_manually_set is used to indicate that the price is not
      the price set in the database.
      
      closes odoo/odoo#118004
      
      Signed-off-by: default avatarHeinz Robin (rhe) <rhe@odoo.com>
      11e06f78
    • yhu-odoo's avatar
      [FIX] mrp: duplicate lot when auto-generate serial. · 1b840d06
      yhu-odoo authored
      
      To reproduce:
      1. Manually create lot "0000001" for a lot product
      2. Create a MO for this product and click generate-serial button.
      Validation error raised since we are trying to generate lot/sn "0000001"
      again.
      
      When useing action_generate_serial, ir.sequence always try create a
      lot/sn in form "00000dd". If user already created the same one, the
      generation will fail.
      
      We already tried to avoid this issue for sn in _get_next_serial() by
      finding the latest sn and create new one base on it.
      
      To fix, we also allow _get_next_serial to be applied to lot.
      
      Part of Tast-3187003
      
      closes odoo/odoo#117143
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      1b840d06
    • nni-odoo's avatar
      [FIX] l10n_id_efaktur: use invoice address · 16f075d1
      nni-odoo authored
      
      Based on change from PR odoo@df74fb6, the rule stated on the document attached has been reverted. It should be using the customer's tax address rather than the delivery address'. One of Indonesian customers are getting a warning letter from the government regarding this.
      
      3230742
      
      closes odoo/odoo#117607
      
      X-original-commit: 512fce88
      Signed-off-by: default avatarGrazioso Andrea (agr) <agr@odoo.com>
      16f075d1
    • Stanislas Gueniffey's avatar
      [IMP] web_editor: allow pasting HTML tables · a1e358a9
      Stanislas Gueniffey authored
      
      Previously, when a clipboardData contained both files and html content,
      we prioritised files. This is correct when the original content is an
      image (in which case the clipboard html may contain an image tag or be
      empty, depending on the source). This is however incorrect in at least
      one known case: copying a table from a spreadsheet app, as those usually
      generate an image of the table alongside the actual html table. In that
      case, we would rather keep the table.
      
      This commit differentiates the specific case where the HTML represents a
      table from other cases. In the former, priority is now given to the HTML
      content. In the latter, we keep the files as we did before.
      
      task-3165757
      
      closes odoo/odoo#115917
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      a1e358a9
    • Deependra Solanki's avatar
      [FIX] web_editor: should not remove tag on backspace in nested li · 7504dc1a
      Deependra Solanki authored
      
      Before this commit:
      
      When we create a nested list and change a tag of the one of
      the list item in nested list and press backspace from start it removes the tag.
      
      After this commit:
      
      Now pressing backspace from the start tag, the tag is not removed.
      
      task - 3147461
      
      closes odoo/odoo#115695
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      7504dc1a
    • Stanislas Gueniffey's avatar
      [IMP] web_editor: powerbox search from description · 36b02889
      Stanislas Gueniffey authored
      
      This commit changes web_editor's powerbox search feature to also look
      for matches in a command's `description`, in addition to its `groupName`
      and `title`.
      
      For example, typing /track will suggest the Checklist command among the
      suggestions as its description is "Track tasks with a checklist".
      
      Note that only exact matches are considered for the description, while
      fuzzy matches (with missing chars) work for other attributes.
      
      Also fixes a typo in a local variable name because it was hazardous to
      some people's eyesight.
      
      task-3188758
      
      closes odoo/odoo#113751
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      36b02889
  3. Apr 11, 2023
    • Louis (loco)'s avatar
      [FIX] website: fix the vanishing arrows of the image gallery snippet · ef7adab2
      Louis (loco) authored
      
      Steps to reproduce the bug:
      - Add an Image Gallery snippet on a the page.
      - Stay in edit mode and click on one of the arrows (left or right).
      - Bug -> The arrow disappears.
      
      This bug comes from the fact that the "oe_edited_link" class is added
      to the anchor of the arrow when clicking on it. Because of the scss
      related to this class, the position of the arrow is modified. This bug
      is fixed by adding the "o_not_editable" class to the anchor of the
      arrow. By doing so, the "oe_edited_link" is not added to the anchor of
      an arrow when clicking on it.
      
      task-3147271
      
      closes odoo/odoo#112058
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      ef7adab2
    • MerlinGuillaume's avatar
      [FIX] mail: disable the tracking of binary fields · 9a49f8e3
      MerlinGuillaume authored
      
      Tracked binary fields do not produce any message in the chatter
      
      Steps to reproduce:
      1. Install Sales and Studio
      2. Open any quotation
      3. Trigger Studio and add a signature field to the form
      4. With debug mode enabled, edit the field (by clicking on MORE when the
         field is selected) and set the Enable Ordered Tracking to 1
      5. Close Studio
      6. Edit the signature and save
      7. No message appears in the chatter to track the value
      
      Solution:
      Remove the `tracking` field from binary fields to prevent the user from
      trying to track it
      
      Problem:
      We shouldn't track binary data in the chatter and we cannot use the
      filenames
      
      opw-3055108
      task-3255810
      
      closes odoo/odoo#118221
      
      X-original-commit: 8506b9d6
      Signed-off-by: default avatarGuillaume Merlin (megu) <megu@odoo.com>
      9a49f8e3
    • paso-odoo's avatar
      [FIX] resource: external id not found in the system base.user_admin · 9482bdb5
      paso-odoo authored
      If applied, this commit will solve the external id issue of the base admin user.
      
      Before this commit:
      ==========================
      When we delete the admin user (base.admin_user) and try to login with a new user
      or try to write in a new user, this error will come.
      
      After this commit:
      ===========================
      The issue will be resolved after this commit and authorize new users without
      any errors.
      
      sentry - 3973828005
      see - https://tinyurl.com/2jm772jm
      
      
      
      closes odoo/odoo#115527
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      9482bdb5
    • niyasraphy's avatar
      [FIX] stock: remove quick_add from picking calendar view · 2c3f53d5
      niyasraphy authored
      
      before this commit, on clicking the picking calendar view, it allows the quick adding from the calendar view and entered value is going to the name field of stock.picking model.
      
      after this commit, quick adding will be disabled and on clicking form will be opened with selected date.
      
      closes odoo/odoo#118175
      
      X-original-commit: c06f88c2
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      2c3f53d5
    • kir-odoo's avatar
      [FIX] delivery: exclude neg qtys from shipping weight · 518c7e04
      kir-odoo authored
      
      This commit prevents inclusion of negative qty SO products from
      the calculation of its estimated shipping weight. Negative qtys can
      indicate a return, which would be a separate picking from the delivery
       => we shouldn't subtract their weight from the delivery. This
      subtraction, may have resulted in shipping rates being calculated as
      lower than they should have been within the SO.
      
      Additionally fixes the following use case (requires Fedex connector):
      - create a SO with 2 products with the same weight
      - set 1st product qty = 1
      - set 2nd product qty = -1
      - add shipping => Shipping Method = Fedex US
      - click on "Get Rate"
      
      An error will occur because the SO._get_estimated_weight() = 0, and
      you cannot have a rate for weight = 0
      
      TaskId - 3028023
      
      closes odoo/odoo#118164
      
      X-original-commit: 4f5cfbd9
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      518c7e04
    • Jinjiu Liu's avatar
      [FIX] mail: prevent long text in default note overflows the form view · 4333a87f
      Jinjiu Liu authored
      
      Reproduction:
      1. Install Project, go to Configuration -> Activity type
      2. Input a very long text in default note, the editable area spills out
      of the form view
      
      Fix: Odoo 16 fixes the issue, so the fix is aligning with 16
      
      task-3263534
      
      closes odoo/odoo#117897
      
      Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
      4333a87f
    • niyasraphy's avatar
      [FIX] website_profile: remove duplicated import in init · dd66a457
      niyasraphy authored
      
      before this commit, the controllers directory is
      imported twice in the init file.
      
      after this commit, the duplicated import is
      removed.
      
      closes odoo/odoo#118079
      
      X-original-commit: 3496c25b
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      dd66a457
  4. Apr 09, 2023
  5. Apr 08, 2023
    • Denis Ledoux's avatar
      [IMP] core: models `__repr__` should show when ids is wrong · d8e1e928
      Denis Ledoux authored
      
      As a developer,
      when you craft your records set manually,
      and wrongly use the API and set something weird in `ids`,
      something else than a tuple of integers,
      `repr` should help you to understand you did something wrong.
      
      e.g.
      
      before
      ```py
      In [1]: env['res.partner']._browse(self.env, '(1,)', 'bar')
      Out[1]: res.partner(1,)
      ```
      
      after
      ```py
      In [1]: env['res.partner']._browse(self.env, '(1,)', 'bar')
      Out[1]: res.partner'(1,)'
      ```
      
      We could put an assert in `_browse` to make sure `ids`
      is a tuple of integers, but this is considered a non-stable
      change, as it will suddenly crashes when you will update
      Odoo while it wasn't the case before.
      
      closes odoo/odoo#118088
      
      X-original-commit: ca263767
      Signed-off-by: default avatarDenis Ledoux (dle) <dle@odoo.com>
      d8e1e928
    • Julien Van Roy's avatar
      [FIX] account_edi_ubl_cii: UBLVersionID should not be present for Bis 3 · d0e59a51
      Julien Van Roy authored
      
      Tag UBLVersionID should not be present for UBL Bis 3 and its inheriting
      formats.
      
      The fonction infering the format from an xml etree needed to be apdated
      too, since we can no longer rely on the `UBLVersionID` node for UBL Bis
      3 and its inheriting formats. The `CustomizationID` node is used.
      
      opw-3249153
      
      closes odoo/odoo#117842
      
      X-original-commit: 863fa450
      Signed-off-by: default avatarQuentin De Paoli <qdp@odoo.com>
      Signed-off-by: default avatarJulien Van Roy <juvr@odoo.com>
      d0e59a51
  6. Apr 07, 2023
    • Abdelouahab (abla)'s avatar
      [FIX] account: origianl bills with encrypted PDF · 93af15db
      Abdelouahab (abla) authored
      
      To reproduce
      ============
      - Accounting > Vendor Bills > create a vendor bill and upload the pdf (attached on this ticket)
      - back to list view, select the created bill and print the original bills a user error is raised
      
      Problem
      =======
      when trying to add the banner we read the PDF and we found out that it's encrypted so we raise the error
      
      Solution
      ========
      if the PDF is encrypted, we log warning and carry on downloading the original bill.
      
      opw-3221796
      
      closes odoo/odoo#116987
      
      Signed-off-by: default avatarJohn Laterre (jol) <jol@odoo.com>
      93af15db
    • Kamen Zhekov's avatar
      [FIX] web_editor, website: fix website editor as restricted editor · 4af1c82e
      Kamen Zhekov authored
      
      When assigned the role of restricted editor, there are many ways to
      break the web_editor when trying to do actions that should be
      unavailable. There is a traceback for the following scenarios under
      some circumstances (mainly because of pages without editable areas or
      features without the proper access rights):
      
      - Drag and dropping snippet when Restricted Editor.
      - Clicking on product when Restricted Editor in /shop.
      - Clicking on product image on specific product page.
      - Clicking on user name (e.g. Marc Demo).
      - Clicking on menu items or logo.
      - Clicking on a blog's image in /blog.
      - Clicking on a blog's image on specific blog page.
      - Clicking on calendar's image in /calendar.
      
      There is now no longer a traceback which makes the editor crash or
      freeze. This mimics the behavior in other cases where the editor does
      not show a traceback, but there is no message indicating that the action
      is unauthorized.
      
      When accessing a menu that cannot be edited, the "Edit the menu" button
      is not shown to the restricted editor.
      
      task-2747895
      opw-3164176
      
      closes odoo/odoo#117840
      
      X-original-commit: bbf4e333
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      Co-authored-by: default avatarBenjamin Vray <bvr@odoo.com>
      Co-authored-by: default avatarqsm-odoo <qsm@odoo.com>
      4af1c82e
    • Mahdi cheikh rouhou (macr)'s avatar
      [FIX] calendar : change stop date for recurrent event · 97f51b24
      Mahdi cheikh rouhou (macr) authored
      
      Changing end time for recurrent event will generate an error.
      
      steps to reproduce the error:
      1- Create an event in the calendar app with recurrence on
      2- Save and close
      3- Edit this event again and select change all events at the top
      4- Change the ending time
      
      The error was happening because the wrong key was accessed in a
      dictionary
      
      opw-3236432
      
      closes odoo/odoo#117458
      
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      97f51b24
    • Renaud Thiry's avatar
      [IMP] base: Clear precommits on test cleanup · f41c2ba5
      Renaud Thiry authored
      
      Precommit hooks would stock data until a call to ``cr.flush`` was made.
      Notably, this happens when the ``assertRaises`` method is called.
      Functions were applied on records already cleared from the cache.
      
      This change adds a cleanup call for `TransactionCase` as it keeps
      the same cursor for all tests. Cursor precommits can now
      be safely executed inside tests.
      
      Task-2834304
      
      closes odoo/odoo#118011
      
      X-original-commit: 4d2fdbab
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      Signed-off-by: default avatarThiry Renaud (reth) <reth@odoo.com>
      f41c2ba5
    • Carlos Carral's avatar
      [CLA] Update Vauxoo's CLA · 0472569f
      Carlos Carral authored
      
      Incorporate Carlos Carral (carralc) as Vauxoo's contributor.
      
      closes odoo/odoo#117426
      
      Signed-off-by: default avatarMartin Trigaux (mat) <mat@odoo.com>
      0472569f
  7. Apr 06, 2023
  8. Apr 05, 2023
    • Julien Van Roy's avatar
      [FIX] account_edi_ubl_cii: fix typo in node name · 0847bb1b
      Julien Van Roy authored
      
      Fix typo in node name introduced after fixing a failed fw-port:
      e5a20e61
      
      closes odoo/odoo#117801
      
      Signed-off-by: default avatarQuentin De Paoli <qdp@odoo.com>
      0847bb1b
    • Paolo Gatti (pgi)'s avatar
      [FIX] l10n_it: Fixing some account type in ITA CoA · aa95e273
      Paolo Gatti (pgi) authored
      A small part of the accounts type were incorrectly changed in Odoo 15 by odoo/83039
      We are bringing the old type back.
      
      Task link: https://www.odoo.com/web#id=3263687&model=project.task
      
      
      task-3263687
      
      closes odoo/odoo#117795
      
      Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
      aa95e273
    • Mahdi cheikh rouhou (macr)'s avatar
      [FIX] mass_mailing_event : get corret list of attendees · 246cb22e
      Mahdi cheikh rouhou (macr) authored
      
      The list of attendees to contact for an event is wrong.
      
      Steps to reproduce the error:
      1-In the event app , have a canceled attendee
      2-Send an Email to attendees
      bug : the email will be sent to canceled attendees as well
      
      The problem was originated from the domain given by the inherited
      class, there was no condition on the state of the attendees.
      
      opw-3240100
      
      closes odoo/odoo#117567
      
      X-original-commit: 85ccbea0
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      Signed-off-by: default avatarMahdi Cheikh Rouhou (macr) <macr@odoo.com>
      246cb22e
    • Pierre-Yves Dufays's avatar
      [FIX] test_mass_mailing, {test_}mail: always apply blacklist for mass mailing · 8098b037
      Pierre-Yves Dufays authored
      
      Always apply the blacklist in mass_mail composition mode regardless of the
      recipient model implementing mail.thread.blacklist or not.
      
      This solves the problem of mail sent to black listed address for model not
      inheriting from mail.thread.blacklist.
      
      Technical notes:
      - it has been done in mail.compose.message _get_blacklist_record_ids ignoring
      the mixin mail.thread.blacklist to avoid model change in stable.
      - some tests have one added query because the blacklist is now queried for each
      batch mail sends even if the model of the recipient doesn't implement
      mail.thread.blacklist.
      
      Task-2834862
      
      closes odoo/odoo#96722
      
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      8098b037
    • Andy Quijada [Vauxoo]'s avatar
      [CLA] Update Vauxoo's CLA adding ajqn9094 · 8b16d691
      Andy Quijada [Vauxoo] authored
      
      Incorporate Andy Quijada (ajqn9094) as Vauxoo's contributor.
      
      I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
      
      closes odoo/odoo#117668
      
      X-original-commit: 53fc292a
      Signed-off-by: default avatarMartin Trigaux (mat) <mat@odoo.com>
      8b16d691
    • David (dafr)'s avatar
      [FIX] mrp_workorder: fix duration_percent out of range · d49246d7
      David (dafr) authored
      
      duration_percent field is a stored integer.
      In postgresql, integer are 4 Bytes long, which create a range of -2147483648 to +2147483647.
      With a small duration_expected, and a big duration, we can easily break these limits.
      
      OPW-3253333
      
      closes odoo/odoo#117728
      
      X-original-commit: 97892d04
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarDavid <dafr@odoo.com>
      d49246d7
    • Aurelien van Delft (avd)'s avatar
      [FIX] hr_holidays: speedup Time Off dashboard · 5a2efd2e
      Aurelien van Delft (avd) authored
      
      When opening the Time Off App, the JS performs an rpc to call
      hr_leave_type.get_days_all_request. Inside this method there are
      some __get__ on non-stored computed fields. This triggers
      a recomputation of said fields in _compute_leaves. _compute_leaves
      uses _get_employees_days_per_allocation.
      
      When there is an hr.leave.type with request_unit = 'hour', you may
      get lots of validated allocations by employee. When this is the case,
      _get_employees_days_per_allocation gets quite slow, especially the last
      part about 'Future available leaves'.
      
      This commit optimizes this part of _get_employees_days_per_allocation.
      In this part the allocations are grouped by employees
      and Intervals instances are of the form (start, stop, records). This means
      that for a given employee_id, all the records of one Intervals will have
      the same start and stop values. This allows us to move the call to
      _get_work_days_data_batch outside of the
      for future_allocation_interval in future_allocation_intervals._items loop.
      Because _get_work_days_data_batch is quite expansive, moving it out
      grealty speeds up the _get_employees_days_per_allocation method.
      
      Example speedup: in a database with 50 validated allocations for
      the same hr.leave.type and employee_id, the timing of
      _get_employees_days_per_allocation 7.39s -> 158ms
      
      opw-3123457
      
      closes odoo/odoo#116217
      
      Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
      5a2efd2e
  9. Apr 04, 2023
Loading