Skip to content
Snippets Groups Projects
  1. Jan 20, 2020
  2. Jan 17, 2020
    • qsm-odoo's avatar
      [FIX] web_editor, *: remove automatic content on undo/redo · 8630251c
      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#43512
      
      X-original-commit: eb4aac3a
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      8630251c
  3. Jan 20, 2020
  4. Jan 17, 2020
  5. Jan 19, 2020
  6. Jan 17, 2020
    • Nicolas Martinelli's avatar
      [FIX] hr_holidays: allocation multi-company · 9413222e
      Nicolas Martinelli authored
      
      As Mitchell Admin:
      - Install Leaves
      - General Settings > Multi Company
      - Create companies A (YourCompany) and B
      - Mitchell Admin should be an employee of A, not B
      - Switch to company B
      - Go to Leaves > Managers > All > Allocations
      
      An AccessError is raised in `_compute_number_of_hours_display` because
      we try to access `employee_id.resource_calendar_id.hours_per_day`.
      
      After this AccessError is solved, several others are raised when
      accessing a record. They are solved in this commit.
      
      opw-2160542
      
      closes odoo/odoo#43485
      
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      9413222e
    • Christopher Ormaza's avatar
      [FIX] core: disable wait_callback during copy_from · d077b224
      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#43465
      
      X-original-commit: c4583cf8
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      d077b224
    • Andrea Grazioso (agr-odoo)'s avatar
      [FIX] web: do not apply initial_ids on default favorite · 7b5efd53
      Andrea Grazioso (agr-odoo) authored
      
      Have more than 160 records in a model (i.e. Contacts).
      Create a sale order, search for customers clicking on Search More,
      do a search that will target records over the 160th.
      Save the search as favorite and put as default.
      Close and reopen the search widget.
      
      No records will display even if there should be, because after the
      search widget applied the domain specified by the favorite filter
      it will apply also the initial ids, fetched whitin the first 160
      records, thus making the resulting set void.
      
      Avoid applying the initial ids when the favorite is specified mitigate
      the issue
      
      opw-2167573
      
      closes odoo/odoo#43482
      
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      7b5efd53
  7. Jan 15, 2020
  8. Jan 16, 2020
  9. Jan 15, 2020
    • Richard deMeester's avatar
      [FIX] fields.py: no lose _protected on related_sudo · 6873803f
      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
      
      closes odoo/odoo#43376
      
      X-original-commit: 97bdb7a668b5c4c9ad759fc795e859207b6ed28d
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      Co-authored-by: default avatarNicolas Lempereur <nle@odoo.com>
      6873803f
    • fja-odoo's avatar
      [FIX] web_editor: save all child text nodes of oe_structure elements · eb71d25c
      fja-odoo authored
      
      When saving the content of an oe_structure, the starting text nodes
      were lost because only the internal *elements* were considered. Ending
      text nodes were kept since they are considered as the last element's
      tail by the etree library.
      
      task-2040764
      
      closes odoo/odoo#43016
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      eb71d25c
    • shreya thakrar's avatar
      [FIX] web: remove min-height of form sheet within a modal · 4cd52c73
      shreya thakrar authored
      We added min-height for `o_form_sheet` in form view with a commit[1] restoring
      the views design (after views refactoring).
      
      However, the min-height isn't very useful when form view is opened witin a
      modal (FormViewDialog). Especially, when the form view is having only few
      fields, the `o_form_sheet` container occupies unnecessary height and looks
      a bit ugly.
      
      This commit fixes the issues by setting the min-height to `0` for
      `o_form_sheet` container in such cases.
      
      [1] - https://github.com/odoo/odoo/commit/250e716c3a12#diff-01e46b3171a7282967199e5d45fca0e6R15
      
      
      
      TaskID: 2150471
      PR #41619
      
      closes odoo/odoo#43336
      
      X-original-commit: 8b030ede
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      4cd52c73
    • Luc De Meyer's avatar
      [FIX] account: don't overwrite statement_line_id when reconciling transfer account · 3d74e739
      Luc De Meyer authored
      
      Description of the issue:
      
      Transfer between Bank1 (550001) and Bank 2 (550002) of the same company via the intercompany bank account (580000) :
      
      Bank 1: minus 1000 EUR, we create the following accounting entry via the reconcile widget
      
      account 550001 credit 1000
      account 580000 debit 1000
      
      Bank 2 : Plus 1000 EUR
      
      When we select the counterparty 580000 entry of the Bank 1 statement via the reconcile widget
      than the statement_line_id of the entry from Bank 1 statement is replaced by the one of the Bank 2 statement.
      Hence this account.move.line is linked to the wrong statement line.
      
      closes odoo/odoo#42339
      
      Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
      3d74e739
  10. Jan 14, 2020
    • oco-odoo's avatar
      [FIX] l10n_ch: don't assume the bank account of the company always has a currency_id · 60a55834
      oco-odoo authored
      
      Since this field is not required on res.partner.bank (which is fine: we want it to be synchronized with the journal's currency, which is None if the journal uses company currency), the parameter received by validate_swiss_code_arguments ended out being an empty recordset in case the company was directly in CHF. This caused the QR code to never be displayed in this situation.
      
      closes odoo/odoo#43282
      
      Signed-off-by: default avatarLaurent Smet <smetl@users.noreply.github.com>
      60a55834
    • Nicolas Martinelli's avatar
      [FIX] purchase_mrp: dependency · 84f70e4f
      Nicolas Martinelli authored
      
      - Create 3 products: A, A1 and A2
      - Create a BOM kit: A is a kit containing A1 and A2
      - Purchase 1 unit of A
      - Receive the quantities
      
      The Received Quantity is set to 2 instead of 1.
      
      This happens because `_update_received_qty` is not called as expected.
      Indeed, `purchase_mrp` must depend on `purchase_stock` since it
      overrides `_update_received_qty`.
      
      opw-2166749
      
      closes odoo/odoo#43097
      
      Related: odoo/enterprise#7712
      Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
      84f70e4f
    • mreficent's avatar
      [FIX] purchase: not setting context is not empty context · 6138686d
      mreficent authored
      Previous versions of this action had a context. It was removed at odoo/odoo@2d3e6d7383aaa3c1589f22
      Set explicitly an empty context to force the removal when upgrading the module. Fine tunning of odoo/odoo@93465630090e2c42
      
      closes odoo/odoo#36007
      
      Signed-off-by: default avatarMartin Trigaux (mat) <mat@odoo.com>
      6138686d
    • Nicolas Lempereur's avatar
      [FIX] mass_mailing: can unsubscribe in multidomain · c5036bcb
      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 will no longer
      be found and replaced into the source.
      
      opw-2124890
      closes #42373
      
      closes odoo/odoo#43277
      
      X-original-commit: e5311b9ddb89b223486a8e1050e5c7a2d017ea07
      Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
      c5036bcb
  11. Jan 13, 2020
  12. Jan 14, 2020
  13. Jan 13, 2020
    • Goffin Simon's avatar
      [FIX] payment: Wrong extra fees with payment acquier · 581020c7
      Goffin Simon authored
      
      Steps to reproduce the bug:
      
      - Install Sales
      - Configure Paypal payment acquier
      - Add extra fees such as 10€ of domestic fee
      - Create a customer C with an email E and with no country
      - Create a quotation Q of 100€ for C and send it by email to C
      - Go in the email box of E and click on the link
      - Click on 'Sign and Pay' button
      - Sign Q and click on 'Pay'
      - Choose Paypal as payment acquier
      - Process the payment with Paypal
      
      Bug:
      
      An error log was displayed saying:
      
      Paypal incorrect data:
      mc_gross received 100 instead of 110
      
      PS: the domestic fee was not counted because the partner_country_id
      was not set in function render defined in model payment.acquirer
      
      Inspired from function create defined in model payment.transaction
      (addons/payment/models/payment_acquirer.py +961) where the domestic fee
      is counted.
      
      opw:2167104
      
      closes odoo/odoo#43197
      
      Signed-off-by: default avatarSimon Goffin (sig) <sig@openerp.com>
      581020c7
  14. Jan 14, 2020
  15. Jan 02, 2020
  16. Jan 13, 2020
  17. Dec 30, 2019
  18. Jan 13, 2020
    • Xavier Morel's avatar
      [FIX] core: ignore id field in o2ms · c44ffdfb
      Xavier Morel authored
      
      Followup to odoo/odoo#43117 (backporting from something which breaks
      in 12.3): if the o2m somehow has an id field, this field should be
      ignored when extracting values to save, for the purpose of both
      actually saving and extracting values for e.g. default_get.
      
      closes odoo/odoo#43204
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      c44ffdfb
  19. Jan 10, 2020
    • Xavier Morel's avatar
      [FIX] core: saving of o2m value init'd via onchange · 54c1c02d
      Xavier Morel authored
      
      In the SSF, o2m updates get initialized with no values (1, id,
      {}). The record data is only fetched when the "record" gets updated
      explicitly from which updates will hopefully get properly tracked &
      saved.
      
      However if the "record" was first initialized through an onchange
      values which are updated by the onchange (diverging from the db) those
      would not get tracked and thus wouldn't get saved when the record is
      saved.
      
      * use more specific placeholder (None) for "o2m records to update but
        we don't have values yet"
      * once we have values, always store them as an update-tracking dict
      * if we don't have values yet for an o2m and an onchange is trying to
        write to it, initialize with values from database first (might
        eventually be a good idea to initialize upfront though there's the
        question of what happens for default values and recursive views)
      * mark anything coming back from the onchange and differing from local
        values as changed (so they get sent out on save)
      * properly reify parent values for onchange instead of sending them
        as-is
      * the evaluation context for contexts (and domains) needs properly
        formatted values so use `_values_to_save` to get them, however it
        cares about neither required-ing nor filtering out e.g. unmodified
        fields, therefore add an awful toggle to handle this
      
      Task 2150302
      
      Probably todo in the future:
      
      * better UI for change-tracking dict, should have "snapshot"
        support (to freeze / discard previous changes)
      * cleanup save, it's unclear that it properly resets the form
      
      closes odoo/odoo#43117
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      54c1c02d
  20. Jan 09, 2020
    • Goffin Simon's avatar
      [FIX] delivery: Delivery Order Adding Freight Cost W/O Markup · c41d14f8
      Goffin Simon authored
      
      Steps to reproduce the bug:
      
      - Let's consider a delivery method DM with fixed price of 10€ and a margin of 20%
      - Let's consider a storable product P
      - Create a SO for P and get the rate (12€) but don't add it on the SO
      - Confirm the SO and process the delivery
      
      Bug:
      
      A SO line was created for the freight cost without the margin. So it was 10€
      instead of 12€.
      
      opw:2144894
      
      closes odoo/odoo#43083
      
      Signed-off-by: default avatarSimon Goffin (sig) <sig@openerp.com>
      c41d14f8
  21. Jan 10, 2020
    • Arnold Moyaux's avatar
      [FIX] stock: forbid to modify product on done move line · 265ee8b7
      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#43145
      
      Task: 2119471
      X-original-commit: 3ec96c30
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      265ee8b7
  22. Jan 12, 2020
Loading