Skip to content
Snippets Groups Projects
  1. May 16, 2023
    • Guillaume (gdi)'s avatar
      [FIX] website: compute company id for new users · eda9ad14
      Guillaume (gdi) authored
      When a new user is created from the website, the company id was always
      set to the first company of the database even if the website was the one
      of another company. This flow has been already fixed if there is the
      "Specific User Account" setting activated (see [this other commit]).
      This commit fixes the same issue but for every case.
      
      Steps to reproduce the issue:
      - Create 2 companies A & B
      - For each company, create a website linked to a different URL
      - Activate 'Free sign up' for company B
      - As a public user, go to website of company B
      - Go to 'Sign in > Don't have an account?' and create an account
      
      => If as an admin you check the company of the created user, it is
      company A instead of company B.
      
      [this other commit]: https://github.com/odoo/odoo/commit/77c708c516beb322df37220634e178ba82e894c9
      
      
      
      task-3277317
      
      closes odoo/odoo#120475
      
      Signed-off-by: default avatarBenoit Socias (bso) <bso@odoo.com>
      eda9ad14
    • jorv's avatar
      [FIX] microsoft_outlook,google_gmail: require username for OAuth2 · 0f6602c7
      jorv authored
      
      Current behavior:
      
      Connections for outgoing email servers using Outlook/Office365 or
      Gmail accounts will establish an OAuth2 authentication for the smtp server.
      Through the `ir_mail_server` form view, one can fetch the necessary
      tokens by logging in into their Microsoft/Gmail account.
      Not specifying an username (`smtp_user`) on the `ir_mail_server` record
      will not produce an error while fetching those tokens.
      But when trying to test the connection or use that server to send an email,
      even if the FROM header is correctly set (i.e. the account email address
      authorized to sent emails), the smtp connection will fail. This is due
      to the fact that when `smtp_user == False`, the respective method
      `_generate_outlook_oauth2_string` or respectively `_generate_oauth2_string`
      will not be called and send the necessary OAuth2 string when sending
      an email through the smtp connection.
      This will lead to a `5.7.57 Client not authenticated to send mail.` error.
      
      After this change:
      
      Add specific UserErrors that get called if `smpt_user == False` before
      the actions in `open_google_gmail_uri` and `open_microsoft_outlook_uri`
      get called. This forces the user to input a `smpt_user` (field Username)
      before the login page for OAuth2 gets called to fetch the tokens.
      Note: there is no check if the user inputs the right username, only
      that the field is not empty. So it is still possible to input an
      invalid username.
      
      opw-3268246
      
      closes odoo/odoo#121048
      
      Signed-off-by: default avatarStéphane Debauche (std) <std@odoo.com>
      0f6602c7
    • David Tran's avatar
      [FIX] sale: log notes with wrong quotation viewer · 3489fd16
      David Tran authored
      
      The note "Quotation viewed by customer" posted when a public/portal user
      access an order came with the order's partner name instead of the actual
      user's partner name
      
      This made confused for internal users to see something in internal note
      like **Colleen Diaz** with a message **Quotation viewed by customer
      Nicole Ford**
      
      This commit makes sure to use the right partner name except the
      quotation is viewed anonymously (with access token)
      
      closes odoo/odoo#121490
      
      Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
      3489fd16
    • Gauthier Wala (gawa)'s avatar
      [FIX] sale: Some followers of moves should not be added · 31046332
      Gauthier Wala (gawa) authored
      
      - Create a Deferred Revenue Model on a Current Liability account
      - Create a Sale Order yourself (User 1), with Salesperson User 2
      - Create the invoice from it
      - Remove the salesperson from the invoice and add User 3 instead
      - Change the account to the Revenue Model's one
      - Post the invoice
      - Post the deferred revenue created
      => User 2 is follower of the entries generated
      
      The problem is that the context comes from the sales order, and
      contains a `default_user_id` in the context.
      The solution provided is to remove it from the context given, as
      it serves no purpose (the invoices are already created).
      
      opw-3141495
      
      closes odoo/odoo#120419
      
      Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
      31046332
    • Julien Van Roy's avatar
      [FIX] account_edi_ubl_cii: unit prices should not be rounded · d7d41991
      Julien Van Roy authored
      When unit prices have more than 2 digits, it is currently not reflected
      in the UBL formats. Consequently, the line amounts are not equal to the
      unit price * quantity (assume there is no discount, charges or
      allowance) and it raises validation errors: "Invoice line net amount
      MUST equal (Invoiced quantity * (Item net price/item price base
      quantity) + Sum of invoice line charge amount - sum of invoice line
      allowance amount".
      
      To fix this, we no longer round the unit prices.
      
      NB: the decimal accuracy should be set in the settings (otherwise, the
      default is 2 digits for unit prices).
      
      See https://docs.peppol.eu/poacc/billing/3.0/bis/#_rounding
      
      
      
      opw-3290035
      task-3302904
      
      closes odoo/odoo#120821
      
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      d7d41991
  2. May 15, 2023
    • xO-Tx's avatar
      [FIX] website: correctly mark translatable attributes · 8b522e5c
      xO-Tx authored
      
      Steps to reproduce:
      
      - Go to a website page > Add a 'Form' block > Set an input "Placeholder"
      value.
      - Go to the page (in 'edit_translations' mode) > The translation of the
      input "Placeholder" attribute doesn't mark the input as translated and
      even after saving the translation, the input is still marked as
      "to_translate".
      
      The goal of this commit is to fix this issue by extending the same
      behaviour on the translated `<select/>` options (using `.oe_translated`
      class) and setting the right translation state on the input from the
      linked attribute translation `<span/>`.
      
      task-3323245
      
      closes odoo/odoo#121128
      
      Signed-off-by: default avatarBenoit Socias (bso) <bso@odoo.com>
      8b522e5c
    • Benjamin Vray's avatar
      [FIX] website: fix overflowing navbar links on mobile · 0a575bea
      Benjamin Vray authored
      
      This commit fixes a bug with the navbar links in the header of a website
      on mobile. When the text of a link is long enough to be wider than the
      screen, the text does not wrap to the next line as intended, but instead
      overflows to the right outside of the screen, causing part of the text
      to be hidden.
      
      Steps to reproduce the bug:
      
      - Edit the text of one of the menu links on a website to make it longer
      than the width of the mobile screen.
      - Bug: In mobile view, part of the link text is hidden.
      
      This bug occurs with both the "default" hamburger type and the
      "off-canvas" hamburger type.
      
      opw-3233684
      
      closes odoo/odoo#119998
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      0a575bea
  3. May 14, 2023
  4. May 12, 2023
    • Benjamin Vray's avatar
      [FIX] website_form: fix form redirect to anchor · 0604b951
      Benjamin Vray authored
      The commit [1] was recently merged with a bug, and this commit fixes it.
      
      The bug is due to the fact that when comparing the current page to a
      redirection with an anchor, we added a trailing slash if it was missing
      for the current page but not for the redirection. In some cases, this
      resulted in unintended behavior where the user was redirected to the
      same page instead of just scrolling to the anchor on the current page.
      
      Steps to reproduce the bug:
      
      - Open the "contact us" page in edit mode
      - Drag and drop a snippet below the form and create a link to that
      snippet by clicking on the "anchor" option button of the snippet.
      - Change the form redirection option to redirect to this newly created
      anchor upon form submission by copying the contents of the clipboard
      into the input of the option.
      - Save the page.
      - Fill out the form and click the submit button.
      - Bug: The page is reloaded instead of smoothly scrolling down to the
      bottom snippet without reloading the page.
      
      [1]: https://github.com/odoo/odoo/commit/fb087dbec96f5e533d1fdd9c2b0c2e00296c83de
      
      
      
      task-2172312
      
      closes odoo/odoo#120907
      
      Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
      0604b951
    • Florian Charlier's avatar
      [FIX] gamification: update internal users goals · 6c77dd82
      Florian Charlier authored
      
      For performance reason, we avoided computing goals for the set of users
      that didn't log in recently (See ec0c0f29).
      However, users can stay logged in for a while without having a new "log
      in event" (password asked), such that active internal users can keep
      old values in their challenges when reports are sent, which is not good.
      
      Until an improvement can be implemented in master, we drop this time
      constraint for active internal users.
      
      A test is added, checking the behavior of the method called by the cron.
      
      Task-3226408
      
      closes odoo/odoo#119271
      
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      6c77dd82
    • Mylyna Hy's avatar
      [IMP] point_of_sale: no CoA error visible for pos · b5106da3
      Mylyna Hy authored
      
      Problem: The error "There is no chart of accounts installed for this company..." appears for POS shop configurations
      if they don't have a chart template configured for the company. It doesn't take into account if the company has its
      own set of accounts so it will always show the error unless the chart template is set.
      
      Solution: Include an additional condition to check if the company has accounting entries which is used to check
      if the company has used its own set of chart of accounts for accounting.
      
      Purpose: The error will only appear if the company has no chart template set or no accounting entries.
      
      opw-3291399
      
      closes odoo/odoo#119901
      
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      b5106da3
    • Arnold Moyaux's avatar
      [FIX] stock: wrong variable reference · ea923a08
      Arnold Moyaux authored
      
      product variable used in the rounding precision come from the upper
      loop and won't work for all the quantites.
      
      opw-3229080
      
      closes odoo/odoo#120680
      
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      ea923a08
    • Christophe Simonis's avatar
      [FIX] core: ensure `odoo.upgrade` __path__ contains real directories · 4227b76e
      Christophe Simonis authored
      
      mimic what is done for `odoo.addons` __path__.
      
      closes odoo/odoo#121136
      
      X-original-commit: 2a981e6a
      Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
      4227b76e
  5. May 11, 2023
  6. May 10, 2023
    • Yannick Tivisse's avatar
      [FIX] hr_contract: Fix multi-company issue on api.constrains · 50319a83
      Yannick Tivisse authored
      
      Purpose
      =======
      
      Avoid mismatch between contracts from different companies and clarify
      error message.
      
      closes odoo/odoo#75553
      
      closes odoo/odoo#120650
      
      Related: odoo/enterprise#19647
      Related: odoo/upgrade#2777
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      50319a83
    • Mylyna Hy's avatar
      [FIX] stock: show exception log when cancel backorders · 92cd7d08
      Mylyna Hy authored
      
      Steps to Reproduce Issue for single picking:
      1. Install Sales, Inventory
      2. Create an SO and confirm
      3. Go to the transfer, assign the done value to be less than demanded
      4. Validate the transfer and cancel the backorder
      
      Current Behavior:
      There is no exception error on the SO chatter
      
      Expected Behavior:
      An exception error should be logged on the SO chatter
      
      Other Info: When cancelling a backorder for a single picking,
      the exception error about less quantity than expected is not logged on the SO.
      "process_cancel_backorder" does not call _log_less_quantities_than_expected.
      As defined in "process", the exception is only logged when validating multiple pickings at once but
      one is to backorder but the other is not.
      
      opw-3222508
      
      closes odoo/odoo#120043
      
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      92cd7d08
  7. May 09, 2023
    • kir-odoo's avatar
      [FIX] delivery: shipping carrier is set after delivery generated · 58f9139f
      kir-odoo authored
      
      Before this commit
      ==================
      when SO is confirmed and Delivery is created then add the shipping method
      in SO, in this case, the shipping carrier is not set in the existing undelivered
      delivery of that SO.
      
      After this commit
      =================
      So in this commit, we set the shipping carrier for undelivered delivery.
      
      taskId - 2946360
      
      closes odoo/odoo#116533
      
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      58f9139f
    • Touati Djamel (otd)'s avatar
      [FIX] stock: change product's company · a6666de7
      Touati Djamel (otd) authored
      
      Steps to reproduce the bug:
      - Connect with the company A
      - Create a consumable product “P1”
      - Create a receipt transfer with this product
      - confirm the transfer
      - Come back to the product form
      - limiter le produit que a la “Company B”
      
      Problem:
      no user error triggered
      Go to inventory > operation > transfer: a Traceback is triggered
      
      Before this commit, there is no verification while changing a product's
      company for consumable. That can lead to an issue where some operations
      cannot be done because of access errors. To avoid that, this commit
      prevents to change the product's company if some move lines for this
      product exist in another company.
      
      opw-3300559
      
      closes odoo/odoo#120702
      
      Signed-off-by: default avatarDjamel Touati (otd) <otd@odoo.com>
      a6666de7
    • Alvaro Fuentes's avatar
      [FIX] mail: allow to create a manual blacklist model · 8848bb57
      Alvaro Fuentes authored
      Issue 1: before this patch it was impossible to create a manual model
      marked as "Is blacklist". The reason is that a blacklist model
      implicitly need an `email` field, but such field is impossible to add in
      a manual model: the field must start with `x_`.
      
      Solution: append `x_` to the implicit email field. Note, in principle
      the user gets an error if `x_email` is not present. Solved by adding the
      field when creating the custom model. Ideally we should show some hint
      in the interface to make it more user friendly. That is out of the scope
      of this patch.
      
      Issue 2: when we have a manual model that is mail blacklist it's
      impossible to create its model class. We get an error because the MRO is
      not correct. The reason is that we are adding `mail.thread.blacklist`
      _after_ `mail.thread` in the `_inherit` list. That list is used to
      generated the `__bases__` of the model class[1]. According to Python's
      MRO rules[2], since `mail.thread.blacklist` appears after `mail.thread`
      as parents of the custom model class this order _must_ be respected. But
      `mail.thread` must appear _before_ `mail.thread.blacklist` because the
      latter inherits from the former. This is a contradiction and the MRO
      algorithm cannot succeed. To put it in a simple example:
      ```py
      class A: pass
      class B(A): pass
       # This fails:
       # class C(A, B): pass
       # The right order is:
      class C(B, A): pass
       # Equivalent to:
      class D(B): pass
       # C and D have the same MRO linearization excluding themselves
      assert D.mro()[1:] == C.mro()[1:]
      ```
      Example traceback:
      ```
      Traceback (most recent call last):
        File "/home/odoo/src/odoo/14.0/odoo/service/server.py", line 1201, in preload_registries
          registry = Registry.new(dbname, update_module=update_module)
        File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 89, in new
          odoo.modules.load_modules(registry._db, force_demo, status, update_module)
        File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 464, in load_modules
          registry.setup_models(cr)
        File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 263, in setup_models
          env['ir.model']._add_manual_models()
        File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 430, in _add_manual_models
          Model = model_class._build_model(self.pool, cr)
        File "/home/odoo/src/odoo/14.0/odoo/models.py", line 585, in _build_model
          ModelClass.__bases__ = tuple(bases)
      TypeError: Cannot create a consistent method resolution
      order (MRO) for bases BaseModel, mail.thread, mail.thread.blacklist, base
      ```
      
      Solution: check if a model inherits from `mail.thread.blacklist` first.
      There is no need to add `mail.thread` if inheriting
      `mail.thread.blacklist` because the inheritance is already implicit.
      
      This issue was observed during upgrades. We convert custom models and
      fields into manual to allow upgrading without custom code. This causes
      issues because the MRO error appears when a custom model inherits mail
      blacklist.
      
      [1]: https://github.com/odoo/odoo/blob/02f820fb0eaddbb3a4269a0967184c8aaf52c363/odoo/models.py#L585
      [2]: https://www.python.org/download/releases/2.3/mro/
      
      
      
      closes odoo/odoo#119169
      
      Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
      8848bb57
    • Sanket Brahmbhatt's avatar
      [FIX] base,tools: raise usererror instead of a valueerror · 59a3f75b
      Sanket Brahmbhatt authored
      
      This issue is generated when the user uploads an image of more than
      50.0 million pixels, so error would be generated. But, currently it raises a
      `ValueError` which results in traceback. So, we replace it with
      `UserError` so the user has an idea about Image size or pixel being excessive.
      
      closes odoo/odoo#118281
      
      Sentry: - 4075426049
      Signed-off-by: default avatarRémy Voet <ryv@odoo.com>
      59a3f75b
    • Julien Van Roy's avatar
      [FIX] mail,account_edi: fix creation of invoice upon email reception · b5214e1d
      Julien Van Roy authored
      When receiving an email on a mailbox with an alias that triggers the
      creation of invoices, 4 bugs could occur.
      
      1. If the xml received contains replacement characters (U+FFFD �), and
      the charset of the part of the email is "US-ASCII" the encoding of the
      string will fail, preventing the rest of the flow to be completed. Be
      more resilient, encode the string and ignores these characters if this
      case occurs.
      
      NB: sometimes, the charset is omitted for a Content-type: text/xml. This
      is valid but not recommended (see:
      https://www.ietf.org/rfc/rfc2376.txt). In this case, the default used is
      "US-ASCII". This means that any non-ascii char will be lost (they are
      replaced by the replacement character: �, see:
      https://github.com/python/cpython/blob/3.10/Lib/email/contentmanager.py#L67
      
      )
      when decoding the attachment.
      
      2. When the xml attachment is created in Odoo, the mimetype is
      'text/plain' (rather than 'application/xml'). Thus, the
      `_decode_attachment` needs to be more flexible when guessing the type of
      the attachment (to know which function to use to read the content of the
      attachment and create the invoice).
      
      3. When creating an invoice from an email with an xml attachment, the
      xml is attached as the `message_main_attachment_id`. It's only later on
      that the content of the xml is read and we possibly find the PDF in
      base64 inside. When creating the PDF attachment, it was not set as the
      `message_main_attachment_id`, so the PDF was not rendered on the right
      part of the invoice form view. Add a clause to replace the
      `message_main_attachment_id` in such a case.
      
      4. When the xml attachment represents a credit note, the move_type of
      the invoice created by the email alias needs to be changed. Indeed, the
      invoice is created before decoding the attachment, so we can only change
      the `move_type` later.
      
      opw-3144519
      opw-3149649
      
      closes odoo/odoo#119602
      
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      b5214e1d
  8. May 08, 2023
  9. Feb 10, 2023
  10. May 07, 2023
  11. May 06, 2023
  12. May 05, 2023
    • Andrea Grazioso (agr-odoo)'s avatar
      [FIX] account: search for deprecated account · 4305ea5a
      Andrea Grazioso (agr-odoo) authored
      
      Duplicate the default Account Payable (211000)
      Set the default Account Payable to Deprecated
      Create a Vendor Bill with a line
      Save
      
      Error will raise
      The account Account Payable (211000) is deprecated.
      
      opw-3199157
      opw-3229350
      
      closes odoo/odoo#120698
      
      Signed-off-by: default avatarBrice Bartoletti (bib) <bib@odoo.com>
      4305ea5a
    • pedrambiria's avatar
      [FIX] base: add `commercial_company_name` to the depends · 6bd2bdf0
      pedrambiria authored
      
      Before this commit: if you add a custom one2many field to the
      'res.partner', like x_related_commercial_partner_ids, that is related to the
      `commercial_partner_id` in the`res.partner` model, it won't update the
      display name of a contact in case of changing its parent_id name.
      
      Here are the steps to reproduce the problem:
       1. Create a new custom field with these values:
         a. Field Type = one2many
         b. Model = Contact
         c. Related Model = res.partner
         d. Relation Field = commercial_partner_id
       2. Create a new Contact that is the "Company" (e.g. "My Company")
       3. Create a new Contact that is the "Individual" (e.g. "My Name"), and
          put the "My Company" as its parent_id.
       4. Now the display_name is "My Company, My Name" which is correct
       5. Change the company name to "My new Company"
        -> display_name won't change, and is "My Company, My Name"
      
      The solution is to add the 'commercial_company_name' to the
      `display_name` depends.
      
      opw-3202894
      
      closes odoo/odoo#114344
      
      Signed-off-by: default avatarRémy Voet <ryv@odoo.com>
      6bd2bdf0
    • Julien Van Roy's avatar
      [FIX] l10n_account_edi_ubl_cii_tests: adapt test with prepaid amount · be7ca375
      Julien Van Roy authored
      Adapt the tests after commit
      https://github.com/odoo/odoo/commit/47905d21ab65f985291d78cb7ecb78f2f7cdcf67
      
      
      A down payment is no longer created when a prepaid amount is detected in
      a UBL/CII attachment.
      
      closes odoo/odoo#120653
      
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      be7ca375
    • Laurent Smet's avatar
      [FIX] account: Fix cascading computation leading to wrong move_name computation · 29d6101c
      Laurent Smet authored
      
      When l10n_mx_edi is installed and a payment is posted, the move_name field on account.move.line
      being a related to move_id.name is not well computed.
      That is because posting a move trigger the computed field in a protected mode due to `flush_recorset`.
      This mode prevents any computed field to be recomputed twice.
      This flush triggers `_compute_name` calling `sequence_mixin`, itself doing another `flush_recorset`.
      This extra flush triggers `_compute_l10n_mx_edi_cfdi_uuid` that access to `move.payment_id.reconciled_bill_ids`.
      This access to this field triggers its recomputation and then, `_compute_stat_buttons_from_reconciliation` is called.
      This method does `self.env['account.move.line'].flush_model()` that force the computation of `move_name` to `/`.
      `sequence_mixin` assigns the new `name` to the journal entry but `move_name` is not recomputed due to the
      protected environment.
      
      closes odoo/odoo#120411
      
      Signed-off-by: default avatarOlivier Colson (oco) <oco@odoo.com>
      29d6101c
  13. May 04, 2023
Loading