Skip to content
Snippets Groups Projects
  1. Jan 17, 2020
    • qsm-odoo's avatar
      [FIX] web_editor, *: remove automatic content on undo/redo · eb4aac3a
      qsm-odoo authored
      * website_event
      
      Commit https://github.com/odoo/odoo/commit/a153ed42a09f8b7f5e0865112eb7d5affc22a353
      
      
      solved a big problem which was that when an undo/redo is performed, the
      whole DOM was reconstructed breaking all the JS relying on the old one.
      For example, the latest blog posts which are dynamically loaded in JS
      were not removed before saving since the JS relied on the old DOM... and
      this broke the page because that dynamic content contained non-valid
      XML markup. The solution was to destroy all JS widgets before applying
      an undo/redo and rebuilding them all afterwards. Ideally this operation
      should be done on the undo recording action but this would have a huge
      flickering impact since many DOM would be destroyed each time the user
      types text (flickering which is also bad on undo/redo but it is more
      acceptable).
      
      The problem now is the following: if a widget, like many, is declared
      like this:
      
      ```
      start: function () {
          this.$el.append(/* Some dynamic content on page loading */);
      },
      destroy: function () {
          this.$el.find(/* Dynamic content to remove */).remove();
      },
      ```
      
      Then it works in all standard cases: dynamic content is loaded on page
      load and is removed when saving the editor. But this happens with the
      undo/redo system:
      
      1. The users types text, we record an undo, which is the whole page
         current DOM, containing all the dynamic contents.
      
      2. The users hits CTRL-Z:
      
          a. We destroy all JS widgets, calling destroy, the dynamic content
             is removed from the page.
      
          b. We replace the whole DOM with the one that was saved. That one
             contains the dynamic content DOM.
      
          c. The JS widgets are recreated, calling start... creating the
             dynamic content again.
      
      Result: the dynamic content appears duplicated. On save, depending on
      how the destroy was implemented only the last generated content may be
      removed or both... but in any case it appears duplicated during edition.
      
      Hopefully, our current stable version do not contain that many dynamic
      content so a perfect amelioration of all of this can be found in master.
      As a fix, this commit introduces an extra step between (a) and (b):
      we remove the dynamic content of the DOM-to-re-apply before applying it.
      For this to work, widgets have to mark their dynamic content with the
      class 'o_temp_auto_element' when creating it. They also must add the
      content they replace on the 'data-temp-auto-element-original-content'
      attribute.
      
      closes odoo/odoo#43496
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      eb4aac3a
    • Jorge Pinna Puissant's avatar
      [FIX] base_vat: Correct management of the check of peruvian VAT without prefix. · c3e097ff
      Jorge Pinna Puissant authored
      
      partial backport of 88681f8f
      
      opw-2171237
      
      closes odoo/odoo#43471
      
      Signed-off-by: default avatarJorge Pinna Puissant (jpp) <jpp@odoo.com>
      c3e097ff
  2. Jan 16, 2020
  3. Jan 17, 2020
    • Christopher Ormaza's avatar
      [FIX] core: disable wait_callback during copy_from · c4583cf8
      Christopher Ormaza authored
      
      Apparently some solutions (e.g. bitnami) deploy odoo using async
      workers, and not all pg/psycopg2 features are supported in that mode,
      notably COPY FROM (bulk-copying data from a stream to postgres). Work
      around this issue by disabling "async mode" as we do the copy (by
      resetting the wait callback) then re-enabling it.
      
      While this is not an officially supported run mode, it should Do No
      Harm™ for normal operations and could help users and clients.
      
      Of important note: while this fixes an error running in async mode, it
      will also prevent the worker from yielding while copy_from is
      executing. Hopefully that doesn't take too long (as the entire point
      of the copy_from is to be fast) but there you are.
      
      Fixes odoo/odoo#24145
      
      closes odoo/odoo#25794
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      c4583cf8
  4. Jan 16, 2020
  5. Jan 15, 2020
  6. Jan 06, 2020
    • Richard deMeester's avatar
      [FIX] fields.py: no lose _protected on related_sudo · a1d1555a
      Richard deMeester authored
      
      If we are:
      
      - not in sudo
      - computing a compute field
      - using a related_sudo field
      
      we want to keep the env._protected dictionary when we `sudo` to get the
      related value, because if we don't we lost the protection of field we
      were currently computing.
      
      Original description:
      
      > When a "computed value A" relies on "computed value B" and
      > "computed value B" needs a related value (e.g. product.product from
      > product.template), then "_compute_related" in api.py will copy the
      > cache if the user is not superuser.
      >
      > The cache is not copying the values in "_protected", causing
      > "modified_draft" in fields.py to incorrectly invalidate the cache for
      > already computed values which should be protected by their inclusion
      > in "_protected".
      
      note: the added test does not fail without this change, it is just a
      partial backport of 12.0 to ensure what worked still worked.
      
      opw-2146097
      closes #40916
      closes #42714
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      Co-authored-by: default avatarNicolas Lempereur <nle@odoo.com>
      a1d1555a
  7. Jan 15, 2020
  8. Jan 14, 2020
    • Jason Van Malder's avatar
      [FIX] web: fix calendar view timezones by backporting 12.0 · 10dc3245
      Jason Van Malder authored
      
      Issue
      
          - Install Calendar with demo data
          - Change your timezone to Pacific/Tahiti
          - Check day view on calendar
      
          Some event disappear
      
      Cause
      
          Same issue here but for another TZ: OPW-34247
      
          Cause from JUC:
          "The problem is the initial search_read has a domain to filter the
          events using 00:00 UTC to 23:59 UTC boundaries. Those boundaries are
          not locale aware"
      
      Solution
      
          Tried on 12.0, it works good. Julien's fix was in 12.0, but there
          is a lot of changes since his commit.
      
          I backported as much as possible to prevent future TZ issues in
          v11.
      
          Backported tests are green in local.
      
      closes odoo/odoo#43286
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      10dc3245
    • Loan (lse)'s avatar
      [FIX] sale_mrp: BOM selection for COGS · 7714f7ca
      Loan (lse) authored
      - Create the FIFO & Automated products:
        Kit ABC: 2 variants, e.g. Black and White, invoice on delivered qty
        Kit A
        Kit B
        Kit C
      - Create the BOM for the variants of Kit ABC, in this order:
        Black: 1 unit of Kit A and 1 unit of Kit B
        White: 1 unit of Kit A and 1 unit of Kit C
      - Receive the components
        Kit A: 10 USD
        Kit B: 12 USD
        Kit C: 13 USD
      - Create a SO for Kit ABC (Black)
      - Validate the picking, create and validate invoice
      
      The COGS is incorrect: the amount is 23 instead of 22.
      
      This happens because the BOM selected is always the first BOM of the
      product template instead of the product-specific BOM.
      
      We select the BOM the same way it is done when it is exploded in:
      
      https://github.com/odoo/odoo/blob/95348a5e1dc4e69ce0edaf89de1124fe55ce4ec8/addons/mrp/models/stock_move.py#L161
      
      
      
      Note that if the BOM changed between picking creation and invoice
      validation, it will fail.
      
      opw-2153629
      
      closes odoo/odoo#43058
      
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      Co-authored-by: default avatarNicolas Martinelli <nim@odoo.com>
      7714f7ca
  9. Jan 13, 2020
  10. Jan 12, 2020
  11. Jan 10, 2020
    • Arnold Moyaux's avatar
      [FIX] stock: forbid to modify product on done move line · 3ec96c30
      Arnold Moyaux authored
      
      It happens that people modify the product on done stock.move.line
      (it's not possible without customisation, at least allow to import or
      to modify product and lot_id in the same view).
      
      During the write on stock.move.line only the lot,locations,package and
      owner are update on the quant. Not the product since it's not suppose to
      be modify. It leads to a stock.move.line with a correct information but
      a total mess on the quants with a lot updated and the previous product.
      Since the product is not modified, the product on the quant and the
      product on the lot linked to the same quant are different.
      
      closes odoo/odoo#42608
      
      Task: 2119471
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      3ec96c30
  12. Dec 30, 2019
    • Pratima Gupta's avatar
      [FIX] stock: do not recompute draft, done, cancel moves · 856ac41a
      Pratima Gupta authored
      
      Backport of commit 9ba3fc4c8767498890f7b5c4126f3bf2017efc97
      
      Usecase to reproduce:
      - Set a product with routes: MTO + Buy
      - Create and valide a SO
      - Cancel the delivery
      - Cancel the RFQ linked
      
      -> The delivery will be switch to confirmed state while it should remain
      cancel.
      
      It happens because the button_cancel on purchase.order call
      _recompute_state on move. _recompute_state modify the state to confirm,
      partially_available or available depending the reservation status.
      Howver it should never be call on 'draft', 'cancel' or 'done' moves
      since it would modify their state.
      
      A fix would be to filter the set of moves in order to exclude moves that
      are cancel, done or draft before using _recompute_state. However this is
      easy to forget and the issue would be probably redo in the future.
      
      A more stable fix is to add the filter in the _recompute_state directly.
      
      closes odoo/odoo#42484
      
      Task: 2157543
      Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
      856ac41a
  13. Jan 09, 2020
  14. Jan 08, 2020
    • Laurent Smet's avatar
      [FIX] account: Fix next sequence number on invoices · d7320c15
      Laurent Smet authored
      
      - Create a journal.
      - Create a vendor bill on this journal.
      => Odoo allows you to set a starting sequence number for your invoice.
      
      This number must always use the sequence used when posting the invoice.
      However, the invoice date was taken instead of the accounting date.
      
      Before this commit, when setting an invoice date at Y and an accounting date at Y - 1,
      the edited sequence was the one in Y - 1 but at the one in Y was used at the validation.
      
      closes odoo/odoo#42896
      
      Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
      d7320c15
  15. Dec 26, 2019
    • Nicolas Lempereur's avatar
      [FIX] mass_mailing: can unsubscribe in multidomain · fccf20ba
      Nicolas Lempereur authored
      The `unsubscribe` feature of mass mailings repose on having a link with
      HREF attribute `/unsubscribe_from_list` inside the mail message.
      
      When the mass mailing is sent:
      
      - relative URL are replaced by absolute URL (`/unsubscribe_from_list` is
        replaced by `{system parameter web.base.url}/unsubscribe_from_list`)
      
      - `{system parameter web.base.url}/unsubscribe_from_list` is replaced by
        the real mass mailing link containing info that will be used to
        unsubscribe the user.
      
      But there was an issue in the case of multiple domain, if this scenario
      happened:
      
      - system parameter web.base.url is http://domain1
      - a user use "Test" button on a mass mailing
      - system parameter web.base.url becomes http://domain2
      
      
      - the mass mailing is sent
      
      The unsubscribe link is broken, this is because the implementation of
      "Test Mailing" feature would update the mass mailing with absolute
      links, so if the domain change, we the `unsubscribe` link is no longer
      found and replaced into the source.
      
      opw-2124890
      closes #42373
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      fccf20ba
  16. Jan 06, 2020
    • Yannick Tivisse's avatar
      [FIX] project_timesheet_holidays: Allow HR Officers to generate timesheets · 78c984b9
      Yannick Tivisse authored
      
      Purpose
      =======
      
      Steps to reproduce:
      
      - Log in as admin
      - Make demo user 'Leaves Manager' in Settings/Users.
      - Log out and log in again as demo
      - Go to Leaves/Leaves to approve/Leaves
      - Select Pieter Parker's leave request and click 'Approve'.
      
      Current behavior:
      Access error occurs due to security restrictions on Analytic Line,
      Operation: write
      
      Expected behavior:
      The leave request should be approved as the Leaves Manager should have
      permission to approve leave.
      
      Closes #25114
      
      closes odoo/odoo#42772
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      78c984b9
    • Yannick Tivisse's avatar
      [FIX] hr_holidays: Fix multi-company ir.rule · 464df9fd
      Yannick Tivisse authored
      
      Purpose
      =======
      
      Steps to reproduce:
      
      Make sure you have multiple companies A, B and C.
      
      - UserA is HR manager but has rights for companies A, B and C.
        And he is allowed to approve the leave request.
      - UserB create a leave request in company B
      - UserC create a leave request in company C
      
      Odoo CE, If you go to the left menu: "Leaves to Approve" > Leaves, you
      can remove all the filters "To Approve" and "My Department Leaves". Now
      you see all the leaves.
      
      If you click on the request of UserB you get the error:
      (Document type: hr.holidays.status, Operation: read).
      
      Current behavior:
      The view "Leaves to Approve" > Leaves (hr.holidays.allocation.tree) allows
      to much. You can see all the request over all the companies. And when
      you try to open one, you get the error.
      
      Expected behavior:
      The view "Leaves to Approve" > Leaves (hr.holidays.allocation.tree). should
      only show the request of the current company.
      
      Closes #23162
      
      closes odoo/odoo#42766
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      464df9fd
    • Yenthe666's avatar
      [FIX] base: always return non-None from ir.actions.run · 9ad01ef2
      Yenthe666 authored
      
      `run_action_` hooks don't always return a value, in which case
      invoking run() over RPC will raise a TypeError (though the call itself
      should still succeed).
      
      Somewhat oddly, "standard" hooks (e.g. in mail) generally do
      things safely and return a `False`, but the "builtin" hooks (code,
      object create and object write) tend to return nothing, and thus break
      when invoked over RPC.
      
      Fixes #42268
      Closes #42272
      
      closes odoo/odoo#42752
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      9ad01ef2
    • Yannick Tivisse's avatar
      [FIX] l10n_in_hr_payroll: Fix Payslip analysis report · 4e8ec502
      Yannick Tivisse authored
      
      Closes #21527
      
      closes odoo/odoo#42754
      
      Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
      4e8ec502
  17. Jan 05, 2020
  18. Jan 03, 2020
    • Aaron Bohy's avatar
      [FIX] web: list: toggle group in nested lists · f5f651bd
      Aaron Bohy authored
      
      Let's assume a list view with a many2one field with enough related
      records to have the 'Search More' option. Let's click on it such
      that another list view opens in a dialog. Group this list.
      
      Before this rev., it crashed when the user clicked on a group to
      open/fold it.
      
      The crash occured because the (toggle_group) event handled by the
      list in the dialog wasn't stopped, so it was also handled by the
      other list, which had no clue of the group it had to toggle.
      
      Closes #36543
      
      closes odoo/odoo#42602
      
      Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
      f5f651bd
    • hveficent's avatar
      [FIX] purchase: avoid crash when canceling moves · 6816b674
      hveficent authored
      
      Canceling a move creates an activity to the related PO. However mail_activity
      creation requires write permission on PO's which is not granted in all
      cases. Activity creation being a side effect of the main business flow
      it can be sudo-ed.
      
      Allow Inventory Users to cancel Transfers originated from Purchase Orders.
      Unless user has Purchase User/Manager permissions he can't cancel transfers
      created from Purchase Orders.
      
      closes odoo/odoo#42555
      
      Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
      6816b674
    • Carlos Mayo's avatar
      [FIX] web: many2many_checkboxes: react to domain changes · 3b566803
      Carlos Mayo authored
      
      Let's assume a many2many_checkboxes widget in a form view with a
      dynamic domain (depending on another field in the view). At first
      rendering, the widget contains a checkbox for each value matching
      the domain.
      
      Before this rev., if the user changed the value of the field used
      in the domain, the many2many_checkboxes wasn't redrawn, so it still
      displayed the values matching the previous version of the domain.
      
      Closes #38509
      Closes #40173
      
      closes odoo/odoo#42564
      
      Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
      Co-authored-by: default avatarAaron Bohy <aab@odoo.com>
      3b566803
    • Jason Van Malder's avatar
      [FIX] purchase: prevent changes when a line has an invoice · 313dc51c
      Jason Van Malder authored
      
      Issue from rim:
      
          In runbot 12.3
          - Go to Purchase
          - Create a PO with one product line: qty 1 / unit price 1000
          - Validate the PO and create the Invoice
              => DON'T VALIDATE THE INVOICE YET
          - Go back to the PO, change the unit price to 2000
          - Go back to the invoice, validate it
          ==> the PO is marked as "fully invoiced" because the qty "1 unit"
              is counted as "invoiced"
      
          => we should not be able to change the price of a line that has
              already been invoiced, even in draft
      
      Cause
      
          It seems that in all the PO's invoices state, we can edit a PO line.
          No restriction?
      
      Solution
      
          Set the line price column to read only when they have a linked
          invoice.
      
      OPW-2161477
      
      closes odoo/odoo#42583
      
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      313dc51c
  19. Jan 02, 2020
  20. Jan 03, 2020
  21. Dec 30, 2019
  22. Jan 02, 2020
  23. Dec 31, 2019
  24. Dec 29, 2019
  25. Dec 27, 2019
    • Nicolas Martinelli's avatar
      [FIX] stock: unpack · 9c6fb547
      Nicolas Martinelli authored
      
      - Assign demo user to the Inventory / Manager group
      - Login with demo user
      - Open a picking, put some quantity in pack and validate
      - Go to the package
      - Unpack
      
      An AccessError is raised because writing on `stock.quant` in not
      allowed.
      
      Fixes #42135
      opw-2159512
      
      closes odoo/odoo#42406
      
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      9c6fb547
  26. Dec 10, 2019
    • Denis Vermylen's avatar
      [FIX] sql_db: ignore PG views when verifying table type · d8e74eb1
      Denis Vermylen authored
      Collisions in table names of ORM models with built-in PG structures such
      as "attributes", "domains", "routines", "parameters", ... could occur
      and render the result of `table_kind` meaningless.
      
      Based on what was done via https://github.com/odoo/odoo/pull/16651
      
       more
      than 2 years ago, it seems relying on our tables being in the 'public'
      schema is safe, even though it's only a default from PG. We reuse that
      same logic rather than the alternative of excluding
      ('information_schema', 'pg_catalog', ...), even though it looks safer at
      first. If we did the latter we'd have to change the other comparison for
      consistency, i.e. more risks.
      
      closes odoo/odoo#41574
      
      Signed-off-by: default avatarDenis Vermylen <Icallhimtest@users.noreply.github.com>
      d8e74eb1
  27. Dec 19, 2019
    • Fabien Meghazi's avatar
      [FIX] server: limit concurrent http threads · 4d4b3b70
      Fabien Meghazi authored
      
      Before this commit nothing prevented high concurrency on a threaded http
      server to consume too much resources, ending up failing requests either
      because the OS is unable to spawn that many threads
      (`RuntimeError: can't start new thread`), either because the Odoo db
      connection pool is full (`PoolError: The Connection Pool Is Full`).
      
      This commit adds the ODOO_MAX_HTTP_THREADS environment variable which
      allows to limit the amount of concurrent socket connections accepted by
      a threaded server, implicitly limiting the amount of concurrent threads
      running for http requests handling.
      
      Note that if a value has been provided to ODOO_MAX_HTTP_THREADS that cannot
      be parsed as an integer, a value will be automatically set to half the
      db connection pool size (which defaults to 64). This dynamic value is
      chosen because while most requests will borrow only one cursor
      concurrently, there are some exceptions where some controllers might
      allocate two or more cursors.
      
      closes odoo/odoo#42021
      
      Signed-off-by: default avatarFabien Meghazi <amigrave@users.noreply.github.com>
      4d4b3b70
  28. Dec 23, 2019
  29. Dec 20, 2019
Loading