Skip to content
Snippets Groups Projects
  1. Sep 05, 2023
    • Jinjiu Liu's avatar
      [FIX] website_sale: add conditions to make sure partner's name exists · 593277de
      Jinjiu Liu authored
      Reproduction:
      1. Install Event, Sales, Website, Contacts
      2. Login as Admin, create a new portal user 123, set the password as 123
      3. Go to Contacts, find the created user, add a shipping address, leave
      the name blank
      4. Open another tab login as the portal user, place an order
      5. At the Address step, Edit the billing address, change the name from
      empty to “Test Name”, click next
      5. An error is thrown cause the new name is not equal to empty value
      
      Fix: this fix aimed the conditions we have in the previous PR: https://github.com/odoo/odoo/pull/111708
      This change will allow the user to add a name for shipping address at
      checkout.Without the fix, if you
      change the name of a shipping address, it won’t be able to get through.
      This is because of how we manage the shipping address, e.g. shipping
      address is managed as child partners. For shipping address, the check
      can_edit_vat is always false. See here: https://github.com/odoo/odoo/blob/14.0/addons/portal/models/res_partner.py
      Another check, e.g. if shipping is being edited, is added to make sure
      name/email can be changed for delivery address. For internal user, the
      editing of shipping address is not blocked because of the `share` check.
      But the same condition is used to ensure the consistency in case we
      change how the shipping address is managed in the future.
      
      Note: if the data is '' for name for example, the pre-process will
      convert it to `False`. Thus the edge case that `'' != False` doen't
      exist anymore
      
      Related PR: https://github.com/odoo/odoo/pull/111708
      
      
      
      opw-3126325
      
      closes odoo/odoo#134328
      
      X-original-commit: 38ca3917
      Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
      Signed-off-by: default avatarJinjiu Liu (jili) <jili@odoo.com>
      593277de
    • Yann Papouin's avatar
      [FIX] sale_timesheet: Invalid `read_group` usage · fb47754e
      Yann Papouin authored
      
      `read_group` signature is not respected: the offset integer param is filled with a list
      
      closes odoo/odoo#134265
      
      X-original-commit: d805521d
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      fb47754e
    • Andrea Grazioso (agr-odoo)'s avatar
      [FIX] sale_timesheet_margin: sale order line cost · cb551051
      Andrea Grazioso (agr-odoo) authored
      
      Set Default UoM on Timesheet Settings page: Hours
      Set [Employee] Timesheet Cost (HR Settings tab): 65.00/hour
      Create a product [TEST] as follows:
      - Product type: service
      - Invoicing Policy: Based on Timesheets
      - Create on Order: Project & Task
      - Unit of Measure: Days
      - Purchase UoM: Days
      - Sales Price: 1.00
      - Cost: 0.00
      Create a sales order
      Add an order line with product [TEST], quantity 1
      Confirm. Project and task will be created
      On the task add a 1 hour timesheet entry for [Employee]
      Save and go back to the SO
      
      Issue: SO line cost is incorrectly computed.
      
      opw-3378688
      
      closes odoo/odoo#133448
      
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      cb551051
    • tsm-odoo's avatar
      [FIX] mail: fix push to talk key registration · ecb77c94
      tsm-odoo authored
      
      Before this commit, the push to talk key was not correctly
      captured. Indeed, Alt/Control/Shift/Meta was condifered
      twice when present, resulting in an incorrect HotKey registration.
      
      Steps to reproduce:
      - Go a discuss channel
      - Access the call setting menu
      - Try to set your push to talk key to "Ctrl + Alt"
      - The HotKey is incorrect ("Ctrl + Alt + Alt").
      
      task-3058665
      
      closes odoo/odoo#134248
      
      Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
      ecb77c94
    • Adnan Saiyed's avatar
      [FIX] web_editor: unexpected copy paste behaviour of link · db6d65a4
      Adnan Saiyed authored
      
      Current behaviour before commit:
      
      -When pasting copied content from editor inside
      link inserts text with HTML content, in result
      the pasted content seems isolated from the link.
      
      e.g. <a href="#">te[]st</a>
      	+ pasting <h1>123</h1>  <=>
      	<a href="#">te<h1>123</h1>st</a>
      
      Desired behaviour after commit:
      
      -Now only text content is pasted which makes
      pasted content as a part of the link.
      
      e.g. <a href="#">te[]st</a>
      	+ pasting <h1>123</h1>  <=>
      	<a href="#">te123st</a>
      
      closes odoo/odoo#125776
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      db6d65a4
  2. Sep 04, 2023
    • prye-odoo's avatar
      [FIX] hr_holidays: handle tz attribute error if user timezone empty · 2b0f9e39
      prye-odoo authored
      When a user tries to create a leave request without linking an employee
      with the user and without a configured login user timezone, a traceback
      will be generated.
      
      Steps to reproduce:
      - Install the "hr_holidays" module.
      - Create a new user, e.g., "Test user", and login with another browser.
      - Login as an admin user and go to Settings > Users & Companies.
      - Search for "Test user" and set Timzone as empty.
      - Go to the Time Off menu and create a leave request; after that, a traceback
      will be generated.
      Error: AttributeError: 'bool' object has no attribute 'upper' 
      
      When a user tries to create a leave request without linking an employee with the
      user and without a configured login user timezone, the
      _get_start_or_end_from_attendance() function of the "hr.leave" object will call
      at that time timzone not getting.
      Code reference:
      https://github.com/odoo/odoo/blob/15.0/addons/hr_holidays/models/hr_leave.py#L111
      
      
      
      Sentry-4441512696
      
      closes odoo/odoo#133955
      
      Signed-off-by: default avatarSofie Gvaladze (sgv) <sgv@odoo.com>
      2b0f9e39
    • Nicolas Bayet's avatar
      [FIX] web_editor: prevent creation of RTCPeerConnection when offline · 8f9a3e1e
      Nicolas Bayet authored
      
      Before this commit, when the browser was offline and when an attempt
      to make a RTCPeerConnection was made, a traceback was raised by
      firefox:
      
      > InvalidStateError: Can't create RTCPeerConnections when the network is
      > down
      
      This commit prevents the creation of the RTCPeerConnection when the
      browser is offline.
      
      task-3186872
      
      closes odoo/odoo#133770
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      8f9a3e1e
    • utag-odoo's avatar
      [FIX] website: make navbar content invisible when block invisible · d120b838
      utag-odoo authored
      
      Steps to reproduce:
       1. Go to the website
       2. Add website languages
       3. Drag Table Of Content
       4. Select snippet block
       5. Go to customize the block
       6. Select visibility conditionally - set visible/hide for languages.
      
      Before the commit, selecting block visibility conditionally makes only
      the block is invisible but not the navbar content is invisible due to the
      absence of the `data-visibility-id` attribute.
      
      In this commit, handling conditional visibility of the navbar when the
      the snippet block is invisible.
      Also, This PR addresses an issue where a scroll bar was appearing on
      `list-group-item` elements in Bootstrap 4.1.3. The scroll bar was caused
      by the CSS property `margin-bottom: -1px;`.
      
      task-3373943
      
      closes odoo/odoo#126705
      
      Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
      d120b838
    • Odoo's Mergebot's avatar
      [FW][MERGE] base, (test_)mail, various: be defensive in email formatting · bf090c48
      Odoo's Mergebot authored
      
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      RATIONALE
      
      Two main use case of corner case usage of 'email' fields are tested in this PR
      and their support is improved
      
        * formatted emails: `"Full Name" <email@domain.com>` stored into the 'email'
          field;
        * multi emails: `email1@domain.com, email2@domain.com` stored into a single
          'email' field;
      
      IMPLICATION
      
      Email field is generally managed as "containing a valid email". This means
      it is sometimes used as it in 'formataddr' as well as to perform searches or
      identification checks. Example of issue: partner 'Raoul' has a formatted email
      like "Raoul" <raoul@raoul.fr>. Using 'formataddr' in email_from leads to
      
        from: "Raoul" <"Raoul" <raoul@raoul.fr>>
        -> which is incorrect (but often dynamically corrected by email servers);
      
      Email field holding multi-emails are not normalized, as current normalize
      is done only if the field holds a single email. It means
      
        * no easy finding based on 'email_normalized', e.g. various tools like
          '_mail_find_partner_from_emails' or 'find_or_create' do not find partners
          based on this email;
        * no exclusion list management;
        * issue with formatting, like
      
        to: "Raoul" <raoul@raoul.fr,raoul.other@raoul.fr>
        -> which is incorrect (but often dynamically corrected by email servers);
      
      USAGE: OUTGOING EMAILS
      
      Those use cases currently generate faulty outgoing emails. This is valid for
      recipients ('email_cc', 'email_to') as well as author ('email_from').
      
      For formatted emails: `email_to` is formatted again based on name and email
      which leads to sending emails to `"Full Name" <"Other"<email@domain.com>>`.
      
      Note that multi emails without formatting may work as it leads to email_to
      `"Full name" <email1@domain.com,email2@domain.com>`. Some outgoing email
      servers correctly send multiple emails. It depends on their fault
      tolerance.
      
      USAGE: FIND BASED ON EMAIL (NORMALIZED)
      
      When searching for partners (e.g. using '_mail_find_partner_from_emails' or
      'find_or_create') normalized version of input is used.
      
      In case of multi emails sanitize is 'False', as normalization expects a single
      email in the field. Therefore no partner is found. In processes that do a
      "search or create" (e.g. using a template on a record) this leads to creating
      a new partner (or several partners in case of multi emails) each time.
      
      USAGE: OTHER FLOWS
      
      Other flows are build on top of '_mail_find_partner_from_emails' / 'create'
      of outgoing emails and are impacted by formatted email / multi email usage.
      Those include notably
      
        * mass_mailing: '_message_get_default_recipients' should be defensive to
          give correct values when creating mailing emails;
        * mass_mailing: faulty emails is based on normalize and multi-emails are
          considered as faulty and ignored;
        * after post hook: '_message_post_after_hook' tries to link messages without
          author (but email_from) with newly-created partners, when partners are
          created from chatter. It is therefore impacted by those corner cases;
        * marketing_automation: built on top of mass_mailing and suffers from the
          same issues;
      
      USAGE: UNICODE
      
      Unicode in emails should be supported. 'formataddr' and IrMailServer notably
      received fixes to support unicode. Some check performed on email addresses
      fail when unicode is involved, which leads to some emails not being sent
      while they could.
      
      USAGE: WRONG EMAIL FORMATTING
      
      With input 'name email@domain.com' (missing chevrons allowing to clearly spot
      the email part) 'getaddresses' returns ('', 'name email@domain.com) i.e. the
      whole input is considered as being the email.
      
      To improve the heuristic we can add a fallback by recalling 'getadresses'
      on the input with spaces replaced by commas when it found only an email and
      no name. The new email will be split into sub pairs allowing to find the real
      email and various name parts, allowing to make a new name / email pair.
      
      Emails should not contain spaces thus this is coherent with email formation.
      This fallback actually comes from a specific code done in '_parse_partner_name'
      of Partner model. Supporting it directly at tools level make the behavior
      coherent for all models.
      
      SPECIFICATIONS
      
      This PR contains first tests to cover current support of those use cases. Then
      we gradually improve support of multi-emails and formatted emails in various
      layers of mail code, from mail.mail to mass_mailing or email formatting.
      
      See individual commit for more explanation, each of them solving a specific
      issue / use case.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      closes odoo/odoo#133958
      
      Forward-port-of: odoo/odoo#74474
      Related: odoo/enterprise#46698
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      bf090c48
    • Thibault Delavallée's avatar
      [FIX] mail: correctly parse formatted email in JS · 8694ff1e
      Thibault Delavallée authored
      Formatted emails using our own formataddr contains quotes to correctly
      separate name from emails, like'"Name" <email@domain.com'. However
      JS parse function does not correctly handle quotes, assuming everything
      being left of opening chevron is the name.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      Part-of: odoo/odoo#133958
      8694ff1e
    • Thibault Delavallée's avatar
      [FIX] tools, base, mail: add a fallback when parsing wrongly-formatted emails · 325e0ab4
      Thibault Delavallée authored
      With input 'name email@domain.com' (missing chevrons allowing to clearly spot
      the email part) 'getaddresses' returns ('', 'name email@domain.com) i.e. the
      whole input is considered as being the email.
      
      To improve the heuristic we can add a fallback by recalling 'getadresses'
      on the input with spaces replaced by commas when it found only an email and
      no name. The new email will be split into sub pairs allowing to find the real
      email and various name parts, allowing to make a new name / email pair.
      
      Emails should not contain spaces thus this is coherent with email formation.
      This fallback actually comes from a specific code done in '_parse_partner_name'
      of Partner model. Supporting it directly at tools level make the behavior
      coherent for all models.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@b2f3f0f3e13cef993541bcd093e61ffbb6a8c92e
      Part-of: odoo/odoo#133958
      325e0ab4
    • Thibault Delavallée's avatar
      [IMP] tools, base, mail: better support non-ascii / IDNA when normalizing · 2ca736b8
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      As of rfc5322 section 3.4.1 local-part is case-sensitive. However most main
      providers do consider the local-part as case insensitive. With the introduction
      of smtp-utf8 within odoo, this assumption is certain to fall short for
      international emails. We now consider that
      
        * if local part is ascii: normalize still 'lower' ;
        * else: use as it, SMTP-UF8 is made for non-ascii local parts;
      
      Concerning domain part of the address, as of v14 international domain (IDNA)
      are handled fine. The domain is always lowercase, lowering it is fine as it
      is probably an error. With the introduction of IDNA, there is an encoding
      that allow non-ascii characters to be encoded to ascii ones, using 'idna.encode'.
      
      Also remove usage of 'email_re' in mailing email check. It is too restrictive
      compared to real formatting we support (or try to). Valid outgoing emails
      were directly canceled, notably when containing unicode.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@a70327daaf3b88af887f657c222222e7baec29c1
      Part-of: odoo/odoo#133958
      2ca736b8
    • Thibault Delavallée's avatar
      [IMP] various: support multi-emails in mailings · 6c53bc6f
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS: MAIL COMPOSER IN MAILING
      
      When using the composer with a mailing, it currently skips recipients whose
      email is a multi-email due to the strict usage of 'email_normalize'.
      
      We can improve multi-email support by effectively checking for the first
      email found, using the "less strict" mode of normalize. It means more emails
      are detected as valid, and therefore sent.
      
      Due to lower support of multi-emails when sending emails, this even allows
      to send multiple emails as all emails are mailed.
      
      SPECIFICATIONS: DEFAULT RECIPIENTS
      
      Mailings are generally done using default recipients, aka using a model method
      that returns the people to mail: customers ('partner_id'), customer emails
      ('email_from'), specific implementation, ...
      
      This is implementation using '_message_get_default_recipients' that returns
      'partner_ids', 'email_to' and 'email_cc' that are then used in the mail
      composer to generate final recipients.
      
      In this commit we better handle the content of email fields to avoid issues
      with multi-emails. For that purpose we correctly split the content of those
      fields. We now have several 'email_to' for records having multi-emails instead
      of a single badly-formatted 'email_to'.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@516ccbc9e716b887cbf712c72af37fd2a3c7dbe9
      Part-of: odoo/odoo#133958
      6c53bc6f
    • Thibault Delavallée's avatar
      [IMP] various: support multi-emails in '_message_post_after_hook' · 99828563
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      Post-message hook is used in various apps to link records to a newly created
      created partner. This is the case notably when used with a template as it
      creates partner on the fly based on emails to always handle partners.
      
      We now check either the complete 'email', either the normalized version of
      it to avoid comparison issues with multi emails and formatted emails. As
      'email_normalized' now supports multi-emails by storing the first found one
      it helps finding the partner.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@62f28f1b898ff9f37bb74345a814e83b37386181
      Part-of: odoo/odoo#133958
      99828563
    • Thibault Delavallée's avatar
      [FIX] mail: support multi email in '_mail_find_partner_from_emails' · 6d083592
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      Tool method '_mail_find_partner_from_emails' that searches for partners based
      on email is improved to support multi-emails input. Instead of skipping
      multi-email (current behavior of 'email_normalize') we now consider first
      found email in the input.
      
      It is used notably to match incoming email / partners or suggest recipients
      in Chatter.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@b8458b092089245c5123f272e4b772beb9b387ed
      Part-of: odoo/odoo#133958
      6d083592
    • Thibault Delavallée's avatar
      [IMP] tools, base, mail: use first found email in 'email_normalized' · cb103c48
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      When having multi-emails input in an email field, 'email_normalized' field is
      currently 'False', as they expect the field to contain a single email. This
      has several drawbacks
      
        * searching partners or fetching information based on emails does not work as
          most tool methods use 'email_normalized' which is False (see e.g.
          '_message_partner_info_from_emails', '_mail_find_partner_from_emails'
          or 'find_or_create');
        * blacklist is not available as it is based on 'email_normalized';
        * mass_mailing wrongly considers those emails as invalid and cancel their
          mail and related trace, as it tries to skip sending emails to invalid
          emails;
      
      Be more defensive and use first found email in case of multi-emails field.
      Other emails are ignored. It is already an improvement that does not break
      flows in stable and allow more emails to be sent.
      
        before
        -> email: '"Raoul" <raoul1@raoul.fr>, raoul2@raoul.fr'
        -> email_normalized: False
        after
        -> email: '"Raoul" <raoul1@raoul.fr>, raoul2@raoul.fr'
        -> email_normalized: raoul1@raoul.fr
      
      A side effect is that it helps finding back some partners, as indicated in
      tests where less phantom partners are created.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@bafc060f639539475abf06221ab590637e6fb8dc
      Part-of: odoo/odoo#133958
      cb103c48
    • Thibault Delavallée's avatar
      [FIX] mail: avoid multi-emails in outgoing emails 'from' · 0a3fc96c
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      When building the final 'from' of outgoing emails using 'formataddr' we
      have issues if email contains multi emails or formatted email. Having a
      wrongly formatted email in 'email_from' leads to issues as it is badly
      recognized by email providers, could be considered as being phishing and
      also breaks reply_to mechanism.
      
      Main fix of this commit is to extract emails and rebuild the 'email_from'
      based on found emails. 'from' of sent emails is now the first found email
      in 'email_from' field of related <mail.mail> record like
      
        -> before: email_from: '"Raoul" <raoul@raoul.fr>, raoul2@raoul.fr'
        -> after: email_from: '"Raoul" <raoul@raoul.fr>' and raoul2 is ignored
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@441746d0119b72125b0338f5cfb97db0b10c399c
      Part-of: odoo/odoo#133958
      0a3fc96c
    • Thibault Delavallée's avatar
      [IMP] various: use 'email_formatted' instead of 'formataddr' · a6e9fcff
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      When possible, use 'email_formatted' field on partner, instead of calling
      'format_addr'. That way management of corner case input (multi emails and
      double encapsulation) is managed by the computed field itself.
      
      When 'format_addr' has to be used, ensure email part is normalized to avoid
      formatting issues.
      
      Also use tools to extract emails instead of 'email_re' regex when possible.
      That way all code extracting and managing emails go through the same stack.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@9ef715fb994564af9e933ba31933a09eca97c24f
      Part-of: odoo/odoo#133958
      a6e9fcff
    • Thibault Delavallée's avatar
      [IMP] mail: split multi-emails partners for outgoing emails · 326df6f9
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      When building the final 'email_to' of outgoing emails using 'formataddr' we
      have issues if email contains multi emails or formatted email. Main fix of
      this commit is to extract emails and rebuild the 'email_to' list based on
      found emails.
      
      E.g. partner Raoul - email: "Raoul" <raoul@raoul.fr>
       -> before: to: "Raoul" <"Raoul" <raoul@raoul.fr>> (double format)
       -> after: to: "Raoul" <raoul@raoul.fr>
      
      E.g. partner Raoul - email: raoul1@raoul.fr, raoul2@raoul.fr
       -> before: to: "Raoul" <raoul1@raoul.fr, raoul2@raoul.fr>
          single email with multiple emails, depends on server fault tolerance)
       -> after: to: "Raoul" <raoul1@raoul.fr>, "Raoul" <raoul2@raoul.fr>
          multi emails
      
      Fix that computation by using all normalized emails found in 'email' fields
      and rebuilding a formatted email based on name + those emails. We do not
      use `email_formatted` as it is not really multi-enabled. We prefer a local
      defensive approach to be as tolerant as possible with respect to user inputs.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@0058013c86231fc608f1324bc03586e3764760fe
      Part-of: odoo/odoo#133958
      326df6f9
    • Thibault Delavallée's avatar
      [IMP] base: avoid double formatting in partner 'email_formatted' field · 3e739e34
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      SPECIFICATIONS
      
      Main fix in this commit: fix multiple nested formatting in 'email_formatted'
      computation for <res.partner>. Other use cases are mainly left untouched as
      we let users deal with their input. In summary :
      
        * double format: if email already holds a formatted email, we should not use
          it to compute email_formatted, like
      
            name: Name / email: 'Format' <email@domain.com>
            -> before '"Name" <"Name" <email@domain.com>>"
            -> after '"Name" <email@domain.com>''
      
        * multi emails: sometimes this field is used to hold several addresses
          like email1@domain.com, email2@domain.com. We currently let this value
          globally untouched by extracting emails and joining them, as we do not
          expect email_formatted to be a list of emails. Extractin emails allows
          to filter out extra text stored in email field, like
      
            name: Name / email: text, email1@domain.com, email2@domain.com
            -> before: "Name" <text, email1@domain.com, email2@domain.com>
            -> after: "Name" <email1@domain.com,email2@domain.com>
      
        * invalid email: if something is wrong, better keep it in email_formatted
          than harcoding "False". Indeed this eases management and understanding
          of failures at mail.mail, mail.notification and mailing.trace level. This
          behavior does not change as it was already implemented like that even if
          not sure it was intended;
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@853bb98b81bcc6376c7f468391643306aea25d99
      Part-of: odoo/odoo#133958
      3e739e34
    • Thibault Delavallée's avatar
      [FIX] mail: make mail_to computation of mailing traces deterministic · 1ef74dc6
      Thibault Delavallée authored
      When having several possible emails to contact the first one is saved on the
      trace model. Indeed a trace is normally linked to a unique recipient but
      in case of multi-emails in an email field, several emails are available.
      
      This commit ensure computation keeps the original mail_to when making emails
      adresses uniques before sending mails and creating traces.
      
      Followup of odoo/odoo@213d5d396c811d8e07ce928c0d31a7f47756a644
      
      Task-2612945 (Mail: Defensive email formatting)
      
      Part-of: odoo/odoo#133958
      1ef74dc6
    • Thibault Delavallée's avatar
      [IMP] crm: add test for '_message_get_suggested_recipients' · 4b41259c
      Thibault Delavallée authored
      This method is still not really tested, except its override of 'mail.thread.cc'.
      So better have a test, especially in CRM that has some specific overrides.
      Formatted email and multi-email input are tested, to check their current
      support. Next commits will try to improve that, notably avoid formatting
      issues.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@340c362798b1cdb2ddb171de385bca45677724af
      Part-of: odoo/odoo#133958
      4b41259c
    • Thibault Delavallée's avatar
      [IMP] base, test_(mass_)mail(ing): add tests for multi / formatted email fields · a50de5e1
      Thibault Delavallée authored
      PURPOSE
      
      Be defensive when dealing with email fields, notably when having multi-emails
      or email field containing an already-formatted email.
      
      RATIONALE
      
      Add tests related to not standard usage of email field. Two main use cases
      are tested here
      
        * formatted emails: `"Full Name" <email@domain.com>` stored into the 'email'
          field;
        * multi emails: `email1@domain.com, email2@domain.com` stored into a single
          'email' field;
      
      Additional tests: tests with unicode / ascii / case / wrong formatting are also
      added to check the support in normalize and format methods.
      
      IMPLICATION
      
      Email field is generally managed as "containing a valid email". This means
      it is sometimes used as it in 'formataddr' as well as to perform searches or
      identification checks. Example of issue: partner 'Raoul' has a formatted email
      like "Raoul" <raoul@raoul.fr>. Using 'formataddr' in email_from leads to
      
        from: "Raoul" <"Raoul" <raoul@raoul.fr>>
        -> which is incorrect (but often dynamically corrected by email servers);
      
      Email field holding multi-emails are not normalized, as current normalize
      is done only if the field holds a single email. It means
      
        * no easy finding based on 'email_normalized', e.g. various tools like
          '_mail_find_partner_from_emails' or 'find_or_create' do not find partners
          based on this email;
        * no exclusion list management;
        * issue with formatting, like
      
        to: "Raoul" <raoul@raoul.fr,raoul.other@raoul.fr>
        -> which is incorrect (but often dynamically corrected by email servers);
      
      USAGE: OUTGOING EMAILS
      
      Those use cases currently generate faulty outgoing emails. This is valid for
      recipients ('email_cc', 'email_to') as well as author ('email_from').
      
      For formatted emails: `email_to` is formatted again based on name and email
      which leads to sending emails to `"Full Name" <"Other"<email@domain.com>>`.
      
      Note that multi emails without formatting may work as it leads to email_to
      `"Full name" <email1@domain.com,email2@domain.com>`. Some outgoing email
      servers correctly send multiple emails. It depends on their fault
      tolerance.
      
      USAGE: FIND BASED ON EMAIL (NORMALIZED)
      
      When searching for partners (e.g. using '_mail_find_partner_from_emails' or
      'find_or_create') normalized version of input is used.
      
      In case of multi emails sanitize is 'False', as normalization expects a single
      email in the field. Therefore no partner is found. In processes that do a
      "search or create" (e.g. using a template on a record) this leads to creating
      a new partner (or several partners in case of multi emails) each time.
      
      USAGE: OTHER FLOWS
      
      Other flows are build on top of '_mail_find_partner_from_emails' / 'create'
      of outgoing emails and are impacted by formatted email / multi email usage.
      Those include notably
      
        * mass_mailing: '_message_get_default_recipients' should be defensive to
          give correct values when creating mailing emails;
        * mass_mailing: faulty emails is based on normalize and multi-emails are
          considered as faulty and ignored;
        * after post hook: '_message_post_after_hook' tries to link messages without
          author (but email_from) with newly-created partners, when partners are
          created from chatter. It is therefore impacted by those corner cases;
        * marketing_automation: built on top of mass_mailing and suffers from the
          same issues;
      
      USAGE: UNICODE
      
      Unicode in emails should be supported. 'formataddr' and IrMailServer notably
      received fixes to support unicode. Some check performed on email addresses
      fail when unicode is involved, which leads to some emails not being sent
      while they could.
      
      SPECIFICATIONS
      
      Add tests related to those corner cases. Also add tests for computation of
      `email_formatted` field of Partner model. It currently generates wrong email
      values for the same corner cases (multi emails, formatted emails).
      
      Tests are also added for the computation of `email_normalized` field used
      notably for blacklists. It is not computed currently when being in multi
      email mode which prevents from any blacklist mechanism as well as make
      email finding harder. `_mail_find_partner_from_emails` tool method is also
      tested with multi email as it uses the same heuristic as normalized email
      field.
      
      Tests are also added for mass mailing, when having to mail documents that
      have a partner with formatted emails / multi-emails, or that have an email
      field with formatted emails / multi-emails.
      
      Also restore a test removed at odoo/odoo@afcb7349083c669dbda18b9b1955eabbe14ea675 while it should have been
      updated to state that email addresses containing non-ascii characters are
      supported.
      
      Add some tests for tools methods used in various email processing flows.
      Unicode tests are also added.
      
      In future commits we will try to make email usage a bit more defensive to
      try to lessen issues with that kind of use cases.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@6e0b1a318447ffef3857c9fd5c975108a1c3944e
      Part-of: odoo/odoo#133958
      a50de5e1
    • Thibault Delavallée's avatar
      [FIX] base, mail: ensure ordering of search on partner / user · 845f3742
      Thibault Delavallée authored
      Add 'id' in partner ordering, to be sure searching on duplicated partners is
      deterministic.
      
      In mail, use standard ordering when searching on users to be deterministic.
      As ordering on users is based on name then login which is unique, this is a
      safe ordering and can be used as it.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@24f3c99ab83d38b30c96f391af96cd6999fbba82
      Part-of: odoo/odoo#133958
      845f3742
    • Thibault Delavallée's avatar
      [FIX] mail: defensively evaluate 'partner_to' on mail templates · 779ac52f
      Thibault Delavallée authored
      MailTemplate model has a 'partner_to' field is dynamically rendered to contain
      partners being recipients. After rendering it should hold a comma-separated
      list of partner IDs.
      
      However as we are unsure it was correctly written better be defensive. We now
      check that we can effectively transform items to IDs using 'isdigit()'.
      
      Task-2612945 (Mail: Defensive email formatting)
      
      X-original-commit: odoo/odoo@f96834b402214a8f51900d26c5845703b81c7501
      Part-of: odoo/odoo#133958
      779ac52f
    • Walid's avatar
      [FIX] stock_landed_costs: reconcile LC after posting the bill · 14fd2bae
      Walid authored
      
      Steps to reproduce:
      - Create a PO (fifo automated product)
      - Recieve product
      - Create the bill and add the landed cost product to it
      - Create the landed cost before posting the bill
      - Post the bill
      
      Bug:
      when creating the landed costs if the bill is already posted
      the created amls are reconciled otherwise they aren't
      
      Fix:
      reconcile the landed costs amls after posting the bill
      
      opw-3377088
      
      closes odoo/odoo#131395
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      14fd2bae
    • William Henrotin's avatar
      [FIX] {sale_}purchase{_stock}: select sellers depending on date · b06b0a77
      William Henrotin authored
      
      Commit 72a17baf force the PO `date_order` to be >= at ` today() to
      ensure the select_seller method take the right seller price. This
      introduces an error in the MPS module that may need to create PO in the
      past.
      
      Instead, this commit patch the call to `_select_seller` to take at least
      `today()`
      
      closes odoo/odoo#134068
      
      Opw: 3167094
      X-original-commit: c88fd161
      Related: odoo/enterprise#46764
      Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      b06b0a77
    • Thomas Lefebvre (thle)'s avatar
      [FIX] hr_holidays_attendance: correct date overtime attendances · b82a3383
      Thomas Lefebvre (thle) authored
      
      Issue:
      ------
      The `date` field of the `hr.attendance.overtime` model
      records is not the date of the related leave.
      
      Cause:
      ------
      We use: `fields.Date.today()` instead of the leave field `date_from`.
      
      Solution:
      ---------
      Use `date_from` field of `leave`.
      
      opw-3433480
      
      closes odoo/odoo#133607
      
      Signed-off-by: default avatarSofie Gvaladze (sgv) <sgv@odoo.com>
      b82a3383
    • hmai's avatar
      [FIX] web_editor: clear format button always visible · 0f916d4b
      hmai authored
      
      This commit makes the clear button of the toolbar always visible
      even if no style is applied.
      
      Since the display is controlled by the css, we removed the concerned
      style.
      
      Task-3459819
      
      closes odoo/odoo#132606
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      0f916d4b
  3. Jul 12, 2023
  4. Sep 03, 2023
  5. Sep 02, 2023
    • Nshimiyimana Séna's avatar
      [FIX] l10n_it_stock_ddt: account for pricelist in the DDT report · fbef1d79
      Nshimiyimana Séna authored
      
      Bug:
      When printing DDT documents for a delivery with a pricelist applied, the
      total value shown comes from the product's original price and not the
      modified pricelist price.
      
      Setup:
      - install `sale_management` and `l10n_it_stock_ddt`
      - have a product P with a price A
      - create a pricelist that where P has a price B
      
      Steps to reproduce:
      - activate DDT report printing
      - create a quotation set the pricelist you created and the product P
      - validate the quotation
      - go to the associated delivery and validate it
      - print the DDT report
      
      You should see that the price mentioned on the DDT report does not
      account for the pricelist. (price A is shown, instead of B)
      
      opw-3171295
      
      closes odoo/odoo#133639
      
      X-original-commit: 9bdb0ed2
      Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
      Signed-off-by: default avatarSéna Serge Nshimiyimana (sesn) <sesn@odoo.com>
      fbef1d79
  6. Sep 01, 2023
    • Benoit Socias's avatar
      [FIX] website_crm: restrict CRM columns to users having CRM rights · b0b65831
      Benoit Socias authored
      
      If leads are created using live chat, users without CRM rights cannot
      access the visitors list anymore because the lead/opportunity
      information is not available to them.
      
      This commit limits the display of `lead_count` to the
      `sales_team.group_sale_salesman` group.
      
      In 14.0, the column still appeared without the `lead_count` value
      displayed, but clicking on it raised a traceback.
      
      Steps to reproduce:
      - Install `website_crm_livechat`
      - Login as Mitchell Admin
      - Send a message in the live chat
      - Go to Discuss
      - Answer the livechat message with `/lead New`
      - Go to Settings / Users / Marc Demo
      - Remove the Sales rights
      - Logout
      - Login as Marc Demo
      - Go to the Website / Reporting / Visitors page
      
      => The page could not be reached and an access right error message was
      generated.
      
      opw-3475301
      
      closes odoo/odoo#133933
      
      X-original-commit: dcb53f42
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      Signed-off-by: default avatarBenoit Socias (bso) <bso@odoo.com>
      b0b65831
    • Valeriya(vchu)'s avatar
      [FIX] sale_product_configurator: fix read properties error of undefined · f1c86c52
      Valeriya(vchu) authored
      
      If sales, inventory, project and renting are installed and product
      configurator is enabled, when user adds one storable product and
      confirms the order and adds one service product after the traceback
      appears caused by reading properties of undefined variable parentList.
      
      opw-3324320
      
      closes odoo/odoo#131210
      
      Signed-off-by: default avatarValeriya Chuprina (vchu) <vchu@odoo.com>
      f1c86c52
    • Xavier Morel's avatar
      [FIX] base: encoding guessing of html module descriptions · fd353d7d
      Xavier Morel authored
      
      I missed a critical issue in #133708: various users had discovered
      they could already fix description issues by adding an XML declaration
      to their document which is very cool (though technically not really
      valid).
      
      What is a lot less cool is that lxml gets *extremely* unhappy when
      asked to parse *strings* with an encoding declaration, raising a
      ValueError, so the purported fix breaks on any module which does that,
      which seems to include a lot of OCA modules.
      
      Gate the encoding guessing by bailing if the document has an XML
      declaration, in which case we just assume the author knows what
      they're doing and we leave them alone. For extra safety, check the
      encoding declaration in ascii and utf16. Could also have checked for
      BOMs, but lxml seems to not care about them overly much (in fact it
      seems to prefer them decoded which is odd).
      
      closes odoo/odoo#133919
      
      Reported-by: @rezak400
      X-original-commit: 51d37560
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      fd353d7d
    • Dawn Hwang's avatar
      [FIX] sale_timesheet: Fix browse in _default_invoicing_timesheet_enabled · c9726d59
      Dawn Hwang authored
      
      The context in the list controller sets active_id as active_ids[0] which
      means the default function will only check the first sale order's order
      lines to calculate the default
      
      Now it checks the active_ids first to see whether there are multiple
      selected
      
      closes odoo/odoo#133635
      
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      c9726d59
    • Xavier Morel's avatar
      [FIX] base: correctly parse utf8 html module descriptions · ab10cd17
      Xavier Morel authored
      
      Apparently `lxml.html.document_fromstring` (and possibly other
      `lxml.html` loaders) parses byte-strings as latin1 regardless of their
      actual encoding, maybe because python2, maybe because there's a super
      legacy html4 parser underlying it.
      
      Either way that means ever since loading
      `static/description/index.html` files was added 10 years
      ago (4bf6a7ea) `_get_desc` has been
      loading these files in latin1 rather than the utf8 most people would
      expect.
      
      Add an explicit decoding phase to try and load html description files
      in UTF8. Fall back to latin1 in case there are description files which
      are genuinely in latin1, or even just some random-ass broken stuff
      which very much isn't utf8 (the extended-ascii encodings -- of which
      latin1 is one -- will happily accept and mangle any input as every
      byte value is valid, utf8 is a lot more structured).
      
      Closes #127846
      
      closes odoo/odoo#133740
      
      X-original-commit: 4dbc3b00
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      ab10cd17
  7. Aug 31, 2023
    • Yaroslav Soroko (yaso)'s avatar
      [FIX] hw_drivers: Error-proof Interfaces · e8f700f7
      Yaroslav Soroko (yaso) authored
      
      Before, when instatating the interfaces if there was an error inside
      Odoo could stop. This PR prevents that and simply avoids instantiating
      the interface which causes the error.
      
      closes odoo/odoo#133791
      
      Signed-off-by: default avatarQuentin Lejeune (qle) <qle@odoo.com>
      e8f700f7
    • Antoine Guenet's avatar
      [FIX] mass_mailing: preserve comments when testing a mailing · d6568e0b
      Antoine Guenet authored
      
      When sending a mailing we make sure to preserve comments (in particular
      so that MSO comments can be read by Outlook). However this was not the
      case when testing a mailing using the Test button in the form view.
      
      task-3488162
      opw-3290548
      opw-3479234
      
      closes odoo/odoo#133754
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      d6568e0b
    • Dawn Hwang's avatar
      [FIX] sale_timesheet: Check for so_line before unlinking invoice lines · dde30798
      Dawn Hwang authored
      
      Steps to reproduce:
       1. Create an SO with billable timesheet entries
       2. Create an invoice
       3. If using enterprise, first cancel the invoice and reset the timesheet
        entries back to draft, then set the invoice back to draft
       4. Remove the sale order items from the timesheet entries
       5. Remove the invoice line associated with the timesheet entries
      
      Current behavior:
       - Throws an error since the so_line value from read_group is now
         False and is not subscriptable
      
      Expected behavior:
       - Removes the invoice lines
      
      Fix:
       - Check that the so_line is not False before continuing with the logic
      
      closes odoo/odoo#133748
      
      Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
      dde30798
Loading