Skip to content
Snippets Groups Projects
  1. Nov 16, 2022
    • Adrien Widart (awt)'s avatar
      [FIX] mrp: check SN uniqueness on WO · 8fe82ab0
      Adrien Widart (awt) authored
      When marking a WO as done, if the serial number defined is related to an
      unbuilt product, an error will be raised and the user will not be able
      to mark the WO as done
      
      To reproduce the issue:
      1. Create a BoM for product P with one operation
          - P is tracked by SN
      2. Produce one P with serial S
      3. Unbuild it
      4. Create and confirm a second MO with 1 x P
      5. Start the WO
      6. On tablet view, set the finished lot to S
      7. Mark the WO as done
      
      Error: a UserError is raised because "This serial number [...] has
      already been produced". However, this serial number has been unbuilt so
      the worker should be able to use it again
      
      When marking the WO as done, we check the uniqueness of the defined
      serial number. But:
      - The check is not accurate enough, hence the above error
      - The lot of the WO is a computed/inverse field based on lot of the MO
      - Once the WO closed, we can still change the lot of the MO
      - When marking the MO as done, a better method checks the SN uniqueness
      (does not fail in the above case)
      
      Therefore, the checking on WO side is useless. We should let the MO side
      handle this.
      
      Moreover, let's say that there is already one P in stock with serial S2.
      On tablet view, if the worker set the lot to S2, there should be a
      warning so he can be aware of the situation. This is already the case on
      MO side:
      https://github.com/odoo/odoo/blob/45e37b2ad7bdcfd9f9f7e1dabbd0a99c9a0b5cdc/addons/mrp/models/mrp_production.py#L694-L705
      
      
      
      (This commit is linked to a similar commit OE side, same opw)
      
      OPW-3002424
      
      closes odoo/odoo#105860
      
      X-original-commit: 402dfd0a
      Related: odoo/enterprise#33999
      Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      8fe82ab0
    • Nicolas Bayet's avatar
      [FIX] web_editor: prevent disconnection from peer to peer · 8bce8cd5
      Nicolas Bayet authored
      
      Before this commit, once a user was disconnected from internet (eg.
      network failure, laptop screen closed), the code disconnected the user
      from the peer to peer network and upon reconnection to the internet
      network, the code did not try to reconnect to the peer to peer network.
      
      This created a network partion in the peer to peer network each time
      a user disconnected and reconnected to the internet network.
      
      When there is a partition in the peer to peer network, the last subnet
      to write to the record erased the changes of another subnet without
      notification.
      
      This commit prevent the code to disconnect from the peer to peer network
      when there is any disconnection signal triggered.
      
      closes odoo/odoo#105857
      
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      8bce8cd5
    • Cao Đình Trung's avatar
      [FIX] maintenance: avoid empty close_date in done stage · e6d83c22
      Cao Đình Trung authored
      
      Steps to reproduce the error:
      - Install 'Maintenance'
      - Select 'Maintenance' -> 'Request Maintenance'
      - Create a maintenance request:
                + TH1: Save > Change stage to Repaired > 'Close date' =
      Date.Today()
                + TH2: Don't Save > Change stage to Repaired > Save > 'Close
      date' = blank
      
      closes odoo/odoo#105741
      
      Problem: App will show 'Close Date' blank
      Expected: App will display 'Close Date' as Date.Today()
      Solution: When Click on Save button -> Automatically get current date as end date
      X-original-commit: badc4ace
      Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
      e6d83c22
    • damr's avatar
      [FIX] 14.0 rating: submit rating feedback with 'get' method · 6be8ffec
      damr authored
      
      In rating/controllers/main.py, the method action_submit_rating accepts
      only post request. This creates a problem when you're trying to use the
      web editor on the template as well as when you just paste the url in
      your browser, for those are get request. The current behavior is a crash
      with 'method not allowed'. This commit's purpose is to change the method
      so it also accept get request. The use case of editing the feedback
      rating page is arguable but it schould not crash.
      
      The behavior after this commit is that the web editor is enable for the
      page, and relaoding the page does not crash anymore.
      
      task-3047893
      
      closes odoo/odoo#105868
      
      X-original-commit: d8f3c941
      Signed-off-by: default avatarLaurent Stukkens (ltu) <ltu@odoo.com>
      6be8ffec
    • Adrien Widart (awt)'s avatar
      [IMP] purchase_stock: add test · d4af926a
      Adrien Widart (awt) authored
      
      A commit [1] has recently be added to fix an issue. It actually fixes
      another issue too:
      1. Create a product P
          - Storable
          - With one packaging PK for 10 x P
      2. Create and confirm a PO
          - Order Lines:
              - 10 x P with PK
      3. On the PO, decrease the quantity of P to 8
      
      Without [1], a return is created for the difference. With [1], the
      existing picking is correctly updated.
      
      This commit adds a test to protect the use case.
      
      [1] 20fa7c6f
      
      OPW-3027110
      
      closes odoo/odoo#105430
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      d4af926a
    • Adrien Widart (awt)'s avatar
      [FIX] sale{,_stock}: decrease qty of SOL · 7a1e8592
      Adrien Widart (awt) authored
      When decreasing the qty of a SOL, if there is already a packaging
      defined, a return will be created for the difference
      
      To reproduce the issue:
      1. Create a product P
          - Storable
          - With one packaging PK for 10 x P
      2. Create and confirm a SO
          - Order Lines:
              - 10 x P with PK
      3. On the SO, decrease the quantity of P to 8
      
      Error: a return is created for the difference. Instead, the existing
      picking should be updated
      
      At some point, we try to merge the stock moves (`10 x P` and `-2 x P`)
      and, to do so, they must have the same `product_packaging_id`:
      https://github.com/odoo/odoo/blob/08f53ffa30479cfb452ebaed61b42655eb0e6a95/addons/stock/models/stock_move.py#L808-L813
      
      However, on the SO, when decreasing the quantity, an onchange tries to
      find the best packaging. Because the new quantity is not a multiple of
      PK, this one is not returned. As a result, the SO has no more packaging
      and so does the new stock move (`-2 x P`). Therefore, the stock moves
      can not be merged and a new picking (the return) is created.
      
      This commit updates the onchange method so it behaves the same way as
      purchase side:
      https://github.com/odoo/odoo/blob/20fa7c6f0f5c9cdfae2519ea8d0ff849d7fa3b9e/addons/purchase/models/purchase.py#L1224-L1231
      In this onchange, the same diff has recently be added for another reason
      (see [1])
      
      [1] 20fa7c6f
      
      OPW-3027110
      
      Part-of: odoo/odoo#105430
      7a1e8592
    • Nshimiyimana Séna's avatar
      [FIX] base_vat: keep leading zeros on San Marino tax id · 7dc79fd1
      Nshimiyimana Séna authored
      
      ### Steps to reproduce
      * install the *VAT Number Validation `(base_vat)`* and Contacts module.
      * Create a new contact from San Marino and set their Tax Id to SM05426
      * Save the contact
      
      You should see that the leading zeros have been removed on the Tax Id
      (here, SM05426 became SM5426)
      
      opw-3007722
      
      closes odoo/odoo#105822
      
      X-original-commit: 24207914
      Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
      7dc79fd1
    • Adrien Widart (awt)'s avatar
      [FIX] mrp_subcontracting_dropshipping,purchase_stock: return to supplier · b45d21c5
      Adrien Widart (awt) authored
      
      When returning a dropshipped and subcontracted product to the supplier
      location, the received quantity of the PO line will be incorrect
      
      To reproduce the issue:
      1. Create two storable products P_compo, P_Finished
      2. Create a BoM:
          - Product: P_finished
          - Type: Subcontracting
          - Subcontractors: a subcontractor S
          - Components: 1 x P_compo
      3. Create and confirm a PO:
          - Vendor: S
          - Deliver To: Dropship
          - Drop Ship Address: a partner P
          - Products: 1 x P_finished
      4. Validate the receipt
      5. Create a return with 1 x P_finished:
          - Update SO/PO quantities: True
          - Return Location: Partner Locations/Vendors
      6. Validate the return
      7. Go back to the PO
      
      Error: The qty received is 2, it should be 0
      
      There is currently no code to handle the return of a dropshipped product
      
      OPW-3030895
      
      closes odoo/odoo#105793
      
      X-original-commit: 8276a9b5
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      b45d21c5
    • Adrien Widart (awt)'s avatar
      [FIX] mrp_subcontracting_dropshipping: return to stock location · 22cf944d
      Adrien Widart (awt) authored
      When returning a dropshipped and subcontracted product to an internal
      location, the received quantity of the PO line will be incorrect
      
      To reproduce the issue:
      1. In Settings, enable "Storage Locations"
      2. Create two storable products P_compo, P_Finished
      3. Create a BoM:
          - Product: P_finished
          - Type: Subcontracting
          - Subcontractors: a subcontractor S
          - Components: 1 x P_compo
      4. In Locations, edit WH/Stock:
          - Return location: True
      5. Create and confirm a PO:
          - Vendor: S
          - Deliver To: Dropship
          - Drop Ship Address: a partner P
          - Products: 1 x P_finished
      6. Validate the receipt
      7. Create a return with 1 x P_finished:
          - Update SO/PO quantities: True
          - Return Location: WH/Stock
      8. Validate the return
      9. Go back to the PO
      
      Error: The qty received is 2, it should be 1 (it should not be 0 since
      the product has been returned to an internal location)
      
      In `/purchase_stock._compute_qty_received`, there is already a code to
      anticipate such a situation (i.e., a user who returns a dropshipped
      product to his stock location):
      https://github.com/odoo/odoo/blob/bf3c398f0644f690c64815b2b6e298aed7bedd70/addons/purchase_stock/models/purchase.py#L300-L305
      However, the methods `_is_dropshipped` and `_is_dropshipped_returned` do
      not include the feature subcontracting + dropshipping. This is the
      reason why, in `_compute_qty_received`, the above condition is not
      respected and why we add the return stock move to the received qty.
      
      OPW-3030895
      
      X-original-commit: 0486e2e5
      Part-of: odoo/odoo#105793
      22cf944d
    • CarmenMiranda's avatar
      [REF] pos_restaurant: Split _get_order_lines method · 45762416
      CarmenMiranda authored
      
      Splitting the method `_get_order_lines` will allow making it
      inheritable, this way more order line fields can be added and expand
      them easily and avoid having to overwrite it.
      
      closes odoo/odoo#105599
      
      Signed-off-by: default avatarTrinh Jacky (trj) <trj@odoo.com>
      45762416
  2. Nov 15, 2022
  3. Nov 14, 2022
  4. Nov 13, 2022
  5. Nov 11, 2022
  6. Nov 10, 2022
    • qsm-odoo's avatar
      [FIX] website: make address selection in editor more robust · e6ae027e
      qsm-odoo authored
      
      Using the "gps picker" (for example with the "Google Map" snippet) was
      not flawless. The autocomplete menu which shows up when the user enters
      an address is handled by the gmap API. It was actually not working at
      all on Firefox for an unknown reason. Not listening to blur events on
      the input seems to solve the issue. This commit also prevents triggering
      a value change if the same address is reselected which seems to make
      address changes a bit more robust too.
      
      opw-2976261
      
      closes odoo/odoo#105485
      
      X-original-commit: 50bf0b7f
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      e6ae027e
    • qsm-odoo's avatar
      [FIX] website: prevent warning on each google map snippet initialization · 51477f23
      qsm-odoo authored
      Some part of the google map API was deprecated and showed a warning
      at each snippet redraw. Probably harmless but since the related API are
      really capricious, best satisfy them as much as possible, even in
      stable versions.
      
      opw-2976261
      
      X-original-commit: b761c8fe
      Part-of: odoo/odoo#105485
      51477f23
    • qsm-odoo's avatar
      [FIX] website: properly warn users of Google API errors · ca274dc2
      qsm-odoo authored
      Before this commit, when adding a google map snippet in the DOM, the
      user was asked for its API key if not already configured, thanks to an
      user-friendly dialog. However, in the case it was misconfigured (while
      the editor dialog prevents some misconfiguration, configuration via the
      backend allow any random key to be given), the UX was terrible: the
      google map is simply removed without any notification.
      
      Misconfiguration can be:
      - Invalid API key
      - "Maps JavaScript API", "Places API" or "Maps Static API" not enabled
      - Billing not enabled
      
      Now notifications/messages warn about those things and reopens the key
      configuration dialog, which contains links to the gmap API documentation
      and now more information.
      Hopefully, this can be improved even further later. Indeed, this is
      still not perfect as there is no reliable way to understand google
      responses. E.g. even with the three mentioned API and billing enabled,
      sometimes the google map API still returns errors indicating "not
      enabled APIs" but it cannot be reproduced reliably. During my test it
      was systematic for 15min at some point but now there is none, ever. Like
      if there was a delay after enabling an API on the google console before
      it stops sending errors... although the API works immediately.
      
      Notice that in 15.0, this snippet is shown in debug mode only and we
      encourage users to use the new "Map" snippet which does not require any
      configuration.
      
      opw-2976261
      
      X-original-commit: a5282701
      Part-of: odoo/odoo#105485
      ca274dc2
    • Jinjiu Liu's avatar
      [FIX] sale_stock: lot number not shown in refund invoices · 15194cec
      Jinjiu Liu authored
      
      This commit is to compute correct lot number for serial/lot tracked
      products on refund invoices
      
      Reproduction:
      1. Install Sale, Accounting, Inventor. In setting of Inventory, enable
      Lots & Serial Numbers, Display Lots & Serial Numbers on Invoices,
      Display Lots & Serial Numbers on Delivery Slips.
      2. Create a product with lot/serial number
      3. Create a order of this product, confirm. Click the delivery and
      validate it.
      4. Back to the SO, create an invoice, confirm and print it, the serial
      number shows.
      5. At the invoice, click “Add credit note”, choose “Full refund” (2
      invoices for the SO) or “Full refund and new draft invoice” (3 invoices
      for the SO), the lot number doesn’t show in new draft invoice or the
      refund invoice
      
      Reason: the current lot number tracking workflow focused on invoicing
      different numbers of products and making sure it gets the correct
      lot/serial number. It doesn’t include the refund invoice case.
      
      Fix: since the current working logic works great with invoicing products
      which are delivered from the warehouse to the customer, we can reuse
      this logic for refund invoices for products which are returned from the
      customer to the warehouse. In the refund and return case, we switch the
      calculation of warehouse and customer. Thus, a return can be seen as a
      delivery from the customer to the warehouse.
      In the code, we set a new variable, return_source_usage, to check if the
      account move type is a delivery or a return. If it’s an invoice for
      return, we take the opposite of the previous invoiced product quantity.
      Because in a refund, previous invoiced is now considered as refunded.
      In the original workflow, when sml.location_id.usage is “customer”, it’s
      a return and we update the returned_qty and the related quantities. In
      the new workflow, if the invoice is a refund one, we do the same steps
      when sml.location_id.usage is “internal”, e.g. when the stock move line
      is a delivery, we consider it a return.
      
      For refund invoices. There are two choices of refunding:
      1. refund and a refunding invoice: 2 invoices for the order, one is the
      original one, another is the refund
      2. refund and create a new draft invoice: 3 invoices for the order,
      original one, a new draft one and the refund.
      
      In the second case, we will create a new draft invoice. If we simply
      apply the original work logic, the lot number will not be printed on the
      draft invoice. This is because the previous amls list includes its
      original invoice. We have to filter out the duplication of the same
      invoice to print the right lot number for the new draft invoice.
      
      Added the report test for two refund cases, one for cancel (Full refund)
      and another for modify (Full refund and new draft invoice)
      
      opw-2879714
      
      closes odoo/odoo#105282
      
      X-original-commit: 012e25f2
      Signed-off-by: default avatarLaurent Smet <las@odoo.com>
      Signed-off-by: default avatarLiu Jinjiu (jili) <jili@odoo.com>
      15194cec
    • Thomas Josse (thjo)'s avatar
      [FIX] event_sale: remove 'need to be paid' banner for free ticket · a2de4051
      Thomas Josse (thjo) authored
      
      This commit fixes an issue where if a ticket is free, the registration would
      still "need to be paid" by the attendee.
      
      This behavior is contradictory for a free ticket, so the attendee now has to
      pay the ticket if it is not paid and is not a free ticket.
      
      task-3012928
      
      closes odoo/odoo#105542
      
      X-original-commit: 2b0587fb
      Signed-off-by: default avatarWarnon Aurélien (awa) <awa@odoo.com>
      a2de4051
    • Ivan Yelizariev's avatar
      [FIX] payment_adyen: add missing fields to api call · d15f08de
      Ivan Yelizariev authored
      It's needed to use "Automatic Risk assessment" feature in Adyen.
      
      Technical docs:
      https://docs.adyen.com/risk-management/configure-manual-risk/required-risk-field-reference
      
      
      
      opw-3004646
      
      closes odoo/odoo#102094
      
      Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
      d15f08de
    • Florian Vranckx's avatar
      [IMP] base: improve perfomance of has_group · 604162ed
      Florian Vranckx authored
      
      Using the already existing indexing on the model to slightly improve the perfomance.
      
      closes odoo/odoo#105318
      
      X-original-commit: 4344d399
      Signed-off-by: default avatarVranckx Florian (flvr) <flvr@odoo.com>
      604162ed
  7. Nov 09, 2022
    • Romain Derie's avatar
      [FIX] website, *: hide .s_popup itself too, not only its .modal child · cfd53b8f
      Romain Derie authored
      *: website_mass_mailing (tests)
      
      - Web Editor facts:
      Since the refactoring of the editor done at [1], the cookies bar popup
      is receiving a `contenteditable=true` attribute, making it receive the
      chrome default `height` style for such elements.
      The problem is that if this cookies bar's modal is hidden, the bar will
      be shown as a thin empty white bar.
      
      - Website Builder / Popup Snippet / Cookies bar facts:
      A popup element is composed of a `.s_popup` parent containing the actual
      `.modal` BS modal. Our internal logic and events are hiding and showing
      this inner `.modal` modal element without considering its `.s_popup`
      parent. It means that when the `.modal` is hidden, its `.s_popup` parent
      is not touched and kept visible.
      It might looks like it's not an issue as it would just be an empty
      element (its only child is hidden) but it leads to some issues as
      explained just above: an ugly white bar is shown.
      Note that the cookies bar is nothing more than a `.s_popup` snippet.
      
      - Web Editor facts 2:
      During the mentioned refactoring [1], they actually added some code to
      hide this bug once you were playing with the edit mode (mainly for when
      you clicked on the invisible panel element or before saving).
      But this code was actually not fixing the case when you just entered
      edit mode.
      
      This commit simply remove that "edit only" web editor logic and add a
      new one in charge of simply synchronizing the `.s_popup` snippet
      visibility with its `.modal` BS modal in a public widget (which is
      obviously also executed in edit mode).
      
      Finally:
      - note that if there is no way through regular flow to arrive to the
        same result with a normal popup snippet, it is still concerned by this
        issue and you can reproduce it by moving it somewhere else in the DOM
        and/or simply adding it the `contenteditable=true` attribute.
      - we already fixed that issue a few months/years ago, I couldn't find
        a commit related to that so I don't know if it was due to the same
        root cause
      - in case one is wondering why we simply couldn't do that in the already
        existing `_onHideModal` of the `PopupWidget`, it is because that
        `hide.bs.modal` is not called when entering edit mode, because the
        `destroy` is destroying it before hiding the modal. The event is thus
        not fired. And we can't move the hide part before the destroy's super
        because otherwise, it would go through the normal hidden process which
        is creating a "seen" cookie for the popup as if it was closed
        manually.
      
      [1]: https://github.com/odoo/odoo/commit/740168ce8d27da3d6a7156d2d79655a898394923
      
      
      
      task-2754108
      
      closes odoo/odoo#103382
      
      Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
      Co-authored-by: default avatarqsm-odoo <qsm@odoo.com>
      cfd53b8f
Loading