Skip to content
Snippets Groups Projects
  1. Jan 18, 2021
  2. Jan 17, 2021
  3. Jan 13, 2021
  4. Jan 15, 2021
  5. Jan 14, 2021
    • Romain Derie's avatar
      [FIX] website_sale: correctly use fiscal position to compute price · 761319a3
      Romain Derie authored
      
      Before this commit, if the user had a fiscal position for his current country,
      it wouldn't be used to compute the price of the products on the eshop.
      Note that:
        - the price would be correct on the cart, as those prices are coming from a
          sale order which correctly retrieves the fiscal position.
        - if the fiscal position is directly set on the partner, prices are correct
          on the eshop
      
      Step to reproduce:
        - Set Belgium as country on Portal user's partner
        - Create a 0% tax and a 15% tax
        - Create a fiscal position mapping 15% tax to 0% tax for Belgium country
          automatically detected
        - Create a product with 1000$ price and 15% tax set on it
        - Enable pricelist and select tax included in settings
        - Create a pricelist for Belgium and add a rule for the product you created
          to set a fixed price of 500$
        - Now visit eshop with Portal user
      
      The test product show 575$ instead of 500$ in eshop, while it will correctly
      show 500$ in cart.
      
      opw-2423215
      
      closes odoo/odoo#64477
      
      Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
      761319a3
  6. Jan 13, 2021
    • Jairo Llopis's avatar
      [FIX] mail: Do not consider reply if no "To:" is found · 8f094d3c
      Jairo Llopis authored
      
      If an email was sent with empty "To:" and a proper alias in "CC:" (or any of the similar valid headers that conform the `rpc_tos_localparts` array), before 40ae36b7 the email wouldn't get rejected. After that commit it would get bounced.
      
      This comes from the not-so-obvious new python idiom used, `all()`. Check this out:
      
      ```python
      >>> all([False])
      False
      >>> all([])
      True
      ```
      
      So, apart from the fix introduced in that commit, which seems valid, we have to make sure `email_to_localparts` actually has contents. Otherwise we are producing false bounces here.
      
      @Tecnativa TT23437
      
      closes odoo/odoo#49656
      
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      8f094d3c
  7. Nov 18, 2020
    • Benjamin Vray's avatar
      [FIX] web_editor: fix drop zones when dragging a snippet · e49480fe
      Benjamin Vray authored
      
      Before this commit:
      
      -when moving a snippet using the drag and drop button, two drop zones
      instead of one was added at the initial location of the dragged
      snippet.
      
      -when moving a snippet using the drag and drop button, no drop zone
      was added at the initial location of the dragged snippet if the snippet
      was alone in its parent. For example, the left jumbotron in the banner
      snippet.
      
      -the drop zones handled by the "children rules" were never vertical
      when it was necessary.
      
      This commit also refactors the code to avoid some duplicated lines.
      
      task-2312878
      
      closes odoo/odoo#61336
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      e49480fe
  8. Jan 05, 2021
  9. Jan 12, 2021
    • Ivan Yelizariev's avatar
      [FIX] base_automation: reset active_id(s) in onchange handler · 8fff0952
      Ivan Yelizariev authored
      
      If we change ``active_model`` in context, we have to reset active_id(s),
      otherwise we read a random records which may not exist.
      
      STEPS:
      1. Activate Developer mode
      2. Go to Settings > Technical > Automation > Automated Actions
      3. Define a new Automated Action with the following settings:
      - Model: Lead/Opportunity
      - Action To Do: Execute Python Code
      - Trigger: Based on Form Modification
      - Trigger Fields: Customer (crm.lead)
      - Python Code:
      ```
      raise Warning(records)
      ```
      4. Go to Contacts, create a new contact and save it.
      5. Click on the "Opportunities" Smart Button on the top left of the contact record.
      6. Click "Create".
      
      BEFORE: ``records`` in context read crm.lead, while id is for res.partner
      record
      
      AFTER: ``records`` is None
      
      ---
      
      opw-2424392
      
      closes odoo/odoo#64223
      
      Signed-off-by: default avatarIvan Yelizariev // IEL <yelizariev@users.noreply.github.com>
      8fff0952
  10. Jan 08, 2021
  11. Jan 11, 2021
    • Rémy Voet (ryv)'s avatar
      [FIX] stock: product search by location · 874d0a63
      Rémy Voet (ryv) authored
      
      Issues
      - In a database with a lot of locations (more than 10K)
      - Search by location in the product tree view with the complete name of
      the most "parent" location
      - We get a memorry error due to a giant SQL request:
      `psycopg2.ProgrammingError: memory exausted at near "(" ...`
      It is due to the `_get_domain_locations_new` which return a giant domain
      with a tons of `(location_id.parent_path', '=like', ...)` for location.
      Because the `_get_domain_locations` makes a ilike on the complete name,
      it will match parent but also all child of this parent (because of the
      complete works expected if there are loc of type 'view' between).
      If there are 10K child location of `WH/Stock`, it will
      match all child and the `_get_domain_locations_new` will return
      a extremely huge domain with a lot of useless condition.
      
      To Solve
      Minimize the domain created by the
      `_get_domain_locations_new`, avoid duplicate `parent_path` condition:
      e.g. `'|', ('location_id.parent_path', '=like', 'WH/Stock/%')
      ('location_id.parent_path', '=like', 'WH/Stock/Shell/%')`
      can be represented only by the first condition.
      We can also search all childs and add condition on ids before
      but it removes the optimization done in this method.
      
      opw-2379464
      
      closes odoo/odoo#64133
      
      Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
      874d0a63
    • Rémy Voet (ryv)'s avatar
      [FIX] stock: add index on `lot_id` on `stock.quant` · ef629d67
      Rémy Voet (ryv) authored
      
      backport of 58456523
      
      closes odoo/odoo#64308
      
      Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
      ef629d67
  12. Jan 08, 2021
    • Nasreddin (bon)'s avatar
      [FIX] account_facturx: Parse pdf invoice attachment from any Odoo >= v12. · fde39076
      Nasreddin (bon) authored
      
      Issue
      
      	- Init an instances of Odoo v12.0 'A' (or saas-12.3 or 13.0) and v14.0 'B'.
      	- Install "Accounting" app on instance A & B.
      	- Set your email server on instance A & B.
      	- Activate 'External email server' in settings of instance A.
      	- Set an email alias for "Vendor Bills" on instance A.
      	- Send a "Customer Invoice" from instance B to alias of instance A.
      	- Fetch for new mail (in case new vendor bill don't appear) on instance A.
      	- Open the new Vendor bill on instance A.
      
      	Data are not parsed from pdf attachment.
      
      Cause
      
      	Filename formating has changed in v14.0 :
      	- X < v14.0 : 'factur-x.xml'
      	- X >= v14.0 : 'INV_2020_12_0001_facturx.xml'
      
      Solution
      
      	Don't check filename anymore since can be changed or can come
      	from other services than Odoo.
      	Instead, ensure there is a specific tag in the xml tree.
      
      opw-2411002
      
      closes odoo/odoo#64155
      
      Signed-off-by: default avatarbon-odoo <nboulif@users.noreply.github.com>
      fde39076
  13. Jan 10, 2021
  14. Jan 07, 2021
    • Nasreddin (bon)'s avatar
      [FIX] misc: Babel; handle 'kur' (kurdish) locale · 1e59052a
      Nasreddin (bon) authored
      
      Issue
      
      	- add a new language with locale code KUR (for Kurdish)
      	- print any report with a datetime on it (RFQ for example)
      
      Cause
      
      	Babel (version < 2.7.0) does not handle locale "KUR".
      
      Solution
      
      	If wrong locale or not managed by Babel, try to fallback
      	on server default locale.
      	If still wrong locale or not managed, then fallback on "en_US" as locale.
      
      opw-2416482
      
      closes odoo/odoo#64169
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      1e59052a
  15. Jan 08, 2021
    • nie's avatar
      [FIX] portal: Due in %d days is not translated · db4a8593
      nie authored
      Steps:
      - Install Invoicing and load French
      - Go to Invoicing
      - Click an invoice due in the future
      - Click Preview
      - Switch the preview to French by modifying the URL like this: example.com/my/invoices/6 -> example.com/fr_FR/my/invoices/6
      
      Bug:
      "Due in %d days" is still displayed in English. The rest of the page is in French.
      
      Explanation:
      This is due to two things:
      1. `mail` and `portal` are both installed and we cannot have more than one `code` translation of a source [1]. Since `mail` is loaded before, alphabetically, `portal` doesn't add the duplicated translations with its own module name. When loading a web page, only the modules returned by `_get_translation_frontend_modules_domain()` are sent to the frontend. `mail` is not one of them and the duplicated translations are not sent. Since sending all the `mail` translations is overkill, this commit is modifying the format string. This won't change the text outcome, but will make the new sources unique and make the backend send these translations to the frontend.
      2. Translations in `portal_sidebar.js` are queried before the translation DB [2] is made. This results in an empty array and `_t()` returns the source. `session.is_bound` will wait until the app is fully loaded before querying.
      
      [1] https://github.com/odoo/odoo/blob/ad2d96db8ad3e1fd7af2edda218fc34c0c1d259a/odoo/addons/base/models/ir_translation.py#L290
      [2] https://github.com/odoo/odoo/blob/0de069b8ca9fb005ba5b076984f5677de25889ee/addons/web/static/src/js/core/translation.js#L51
      
      
      
      opw:2421501
      
      closes odoo/odoo#64160
      
      Signed-off-by: default avatarbackspac <backspac@users.noreply.github.com>
      db4a8593
  16. Dec 30, 2020
  17. Jan 07, 2021
    • Adrien Widart's avatar
      [FIX] mail: get current company activities · 0cfad3d5
      Adrien Widart authored
      
      In a multi-company configuration, when checking the documents that have
      one activity (e.g., a TODO activity), it shows all companies' documents
      
      To reproduce the error:
      (Install Documents. Let C1 be the current company)
      1. Create a second company C2
      2. Go to Documents > Configuration > Folders
      3. Create a folder F
      	- Company must be C1
      4. Go to folder F and upload a document D
      5. Schedule an activity on D:
      	- a To Do activity, with Due Date set to today
      6. Switch to company C2
      7. On top bar, check your activities
      8. Click on "1 Today"
      
      Err: The system displays all documents that have an activity scheduled for
      today. In our case, you see document D. Since you switched to company
      C2, you should not see this document. This error can even lead to a more
      problematic situation: in step 4, create a "Request Document" instead of
      uploading a file. In step 8, an AccessError will be raised and you will
      no longer be able to consult the documents that have a scheduled activity.
      
      When clicking on "1 Today", the server searches for documents that have
      an activity scheduled for today. However, this search does not contain
      any filters on companies. In most cases, the search domain will be
      improved on server-side, thanks to the access rules. But in some cases
      (e.g., using the Documents module), there isn't any rule about companies.
      
      This fix only concerns version 12 (from version 13 onwards, the user can
      see several companies' data at the same time).
      
      OPW-2416152
      
      closes odoo/odoo#64201
      
      Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
      0cfad3d5
    • Christophe Simonis's avatar
      [FIX] core: check module state inconsistencies after `end` upgrade scripts · 7115ac95
      Christophe Simonis authored
      Some modules may be removed by the upgrade scripts with the help of the
      ORM and are done in `end` scripts.
      This is the case for uninstalling the themes which use the `_theme_remove`
      method [1].
      
      [1] in 12.0: https://github.com/odoo/odoo/blob/e2084a4356f63249920d8c777e92f1710be8b5a6/addons/website_theme_install/models/ir_module_module.py#L337
      
      
      
      closes odoo/odoo#64199
      
      Signed-off-by: default avatarXavier Dollé (xdo) <xdo@odoo.com>
      7115ac95
  18. Jan 05, 2021
    • Yannick Tivisse's avatar
      Revert "[FIX] google_drive: fix traceback when add filter" · e2084a43
      Yannick Tivisse authored
      
      This reverts commit 82f236d9.
      
      The fix is actually not solving all the issues, and also introduce
      a behavior change. Actually, the expected result for filters like
      
      <filter string="My Pipeline" name="my" domain="[('user_id', '=', uid)]"/>
      
      will result into a evaluated filters, but invalid as the uid is set to
      the person configuring the google configuration, not the user who will
      use it.
      
      As it is tricky (or even impossible) to solve the issue properly in all
      the cases, we prefer to warn the user that the filter is invalid instead.
      
      closes odoo/odoo#64079
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      e2084a43
    • Adrien Horgnies's avatar
      [FIX] sale: speed-up invoice creation · ad2d96db
      Adrien Horgnies authored
      
      - At invoice creation, the stored fields that depends on `invoice_lines`
          are computed to be stored.
          This can slow down the invoice creation for a database with a lot of
          records on `account_move`.
      
          This commit speed-up the invoice creation by using SQL Joins to
          speed-up the searches.
          We cannot use `auto_join` on the `invoice_lines` field since it is
          not supported on many2many, thus we do it in SQL.
      
      opw-2390604
      backport of 67988972989e74443b6deb4d9a8e0c08a196ad4d
      
      closes odoo/odoo#63588
      
      Signed-off-by: default avatarAdrien Horgnies <AdrienHorgnies@users.noreply.github.com>
      ad2d96db
    • Adrien Horgnies's avatar
      [FIX] sale: search on invoice_ids · 8bbf273d
      Adrien Horgnies authored
      some fields may depend on invoice_ids, which lead to a perf issue when
      field is not searchable.
      
      opw-2390604
      BACKPORT of afb927076ea22f80c62fe4ea4165e18c7f946fe1
      8bbf273d
  19. Jan 04, 2021
    • Nicolas Galler's avatar
      [FIX] stock: run scheduler actions as super user · 7a2c23c7
      Nicolas Galler authored
      
      In `run_scheduler`, we are running certain functions as super user to
      avoid inter company and access rights issues.  This commit adds a
      `sudo()` call to the `action_assign()` call, in case some objects
      related to the retrieved moves are not accessible.
      
      In addition a commit call is moved up to apply after the
      `procure_orderpoint_confirm` call (as it was, it was applied after the
      `_action_assign` loop, but there is in fact already a commit in that
      loop, this lead to a somewhat random behavior where the replenish rules
      were sometimes rolled back and sometimes not, depending on whether the
      first iteration of the loop errored out or not)
      
      opw-2394706
      
      closes odoo/odoo#63935
      
      Signed-off-by: default avatarNicolas Galler <ngaller@users.noreply.github.com>
      7a2c23c7
  20. Jan 03, 2021
  21. Dec 31, 2020
  22. Dec 28, 2020
    • Ivan Yelizariev's avatar
      [FIX] base_data.sql: remove obsolete field size · 2a44e233
      Ivan Yelizariev authored
      those field sizes were deleted from orm definition in 2014 https://github.com/odoo/odoo/commit/026e38b48f3963aed08bba4e76a0a796d662f6a4
      
      
      
      STEPS:
      * set manifest's summary attribute to a long string
      * create empty database
      
      BEFORE: error
      
      ```
      2020-12-28 10:44:51,325 1 ERROR ? odoo.sql_db: bad query: UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')
      ERROR: relation "ir_module_module" does not exist
      LINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN...
                     ^
      
      2020-12-28 10:44:51,325 1 ERROR ? odoo.modules.registry: Failed to load registry
      Traceback (most recent call last):
        File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 86, in new
          odoo.modules.load_modules(registry._db, force_demo, status, update_module)
        File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 338, in load_modules
          odoo.modules.db.initialize(cr)
        File "/opt/odoo/custom/src/odoo/odoo/modules/db.py", line 63, in initialize
          info['sequence'], info['summary']))
        File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 173, in wrapper
          return f(self, *args, **kwargs)
        File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 250, in execute
          res = self._obj.execute(query, params)
      psycopg2.DataError: value too long for type character varying(256)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 88, in new
          odoo.modules.reset_modules_state(db_name)
        File "/opt/odoo/custom/src/odoo/odoo/modules/loading.py", line 558, in reset_modules_state
          "UPDATE ir_module_module SET state='installed' WHERE state IN ('to remove', 'to upgrade')"
        File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 173, in wrapper
          return f(self, *args, **kwargs)
        File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 250, in execute
          res = self._obj.execute(query, params)
      psycopg2.ProgrammingError: relation "ir_module_module" does not exist
      LINE 1: UPDATE ir_module_module SET state='installed' WHERE state IN...
      ```
      
      AFTER: database successfully created
      
      ---
      
      opw-2415057
      
      closes odoo/odoo#63820
      
      Signed-off-by: default avatarIvan Yelizariev // IEL <yelizariev@users.noreply.github.com>
      2a44e233
  23. Dec 29, 2020
  24. Dec 28, 2020
  25. Dec 27, 2020
  26. Dec 24, 2020
  27. Dec 11, 2020
    • Brice bib Bartoletti's avatar
      [FIX] point_of_sale: fix angloSaxon aml generation · e55fdf52
      Brice bib Bartoletti authored
      
      This fix corrects the anglosaxon lines generated by PoS.
      
      \## The issue:
      The anglosaxon line calculation assumes that all the account move lines
      are grouped by product for the entire PoS session.
      (and thus not split by pos_order)
      
      As a result, when the variable "have_to_group_by" is False, the anglosaxon
      lines are generated only once by product and only for ONE pos_order instead
      of the whole session.
      
      \## The fix:
      The fix solves this issue by using a loop and generating all the anglosaxon
      lines for each product in each order. The lines are then regrouped later on
      if required.
      
      \# Ticket \\#2333580
      
      I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
      
      closes odoo/odoo#63624
      
      Signed-off-by: default avatarpimodoo <pimodoo@users.noreply.github.com>
      e55fdf52
  28. Dec 23, 2020
    • Pierre Paridans's avatar
      [FIX] web: prevent crash on image resize/crop · c132f069
      Pierre Paridans authored
      
      When attempting to resize or crop an attachment through the '/web/image'
      route, if the attachment isn't actually an image (even if the record's
      mimetype says so) or doesn't match one of the format supported by PIL
      (Python Imaging Library) - like Apple's HEIF -  the request crashes with
      a "500 Internal Error".
      
      Although it makes sense to return a response with an HTTP error code, a
      more sensible approach would be to return a "404 Not Found" response
      instead.
      
      The point by handling the Exception thrown by PIL and returning a 404
      status code is to more closely match the semantic of this HTTP status
      code. Getting a resized version of a non-image doesn't really make sense
      as this resource doesn't exist at all ; hence the "404 Not Found"
      response. On the other hand returning a "500 Internal Error" would
      denote that a legitimate request failed on the server side, which is not
      the case here.
      
      Note: this difference of semantic, even if only visible in a regular
      browser, has its importance in the mobile apps because we use it to
      given a meaningful feedback to the user in case if failed HTTP requests.
      
      Note: the mimetype detection could be improved to ease the handling of
      this kind of errors but would require too much changes to be done in
      stable branch.
      
      Steps to reproduce in Documents:
      - rename an HEIF file with a ".jpeg" extension
      - upload it in documents
      - select the document in kanban view
      => the thumbnail in the document inspector (right panel) throws an HTTP
      error 500
      
      Steps to reproduce in Discuss:
      - rename an HEIF file with a ".jpeg" extension
      - upload it in a chat window
      => the thumbnail in the chat window throws an HTTP error 500
      
      opw-2417172
      
      closes odoo/odoo#63739
      
      Signed-off-by: default avatarAdrien Dieudonné (adr) <adr@odoo.com>
      c132f069
  29. Dec 22, 2020
  30. Dec 18, 2020
Loading