Skip to content
Snippets Groups Projects
  1. Mar 22, 2022
  2. Mar 21, 2022
    • Adrien Widart's avatar
      [FIX] {purchase_,}mrp: prevent kit structure changes · 62b47b31
      Adrien Widart authored
      When changing the structure of a kit, it lead to undesirable behaviors
      on Odoo
      
      Issue 01:
      1. Create 3 products P_kit, P_compo01, P_compo02
          - Type: Storable
          - Category: PC
      2. Create a bill of materials:
          - Product: P_kit
          - Type: Kit
          - Components:
              - 1 x P_compo01
      3. Create a purchase order PO with 2 x P_kit
      4. Confirm PO and process the receipt
      5. Edit the bill of materials of P_kit:
          - Add 1 x P_compo02 in components
      6. Return 1 x P_compo01
      7. Go back to the PO
      
      Error: The received quantity is 0 while it should be 1.0
      
      When processing the return, the received quantity is recomputed, which
      lead to:
      https://github.com/odoo/odoo/blob/59fcb31f5a0b8136dae26b70ca0087f9b5cf3d24/addons/purchase_mrp/models/purchase_mrp.py#L29
      However, since in the mean time the user added a new line in the BoM,
      `_compute_kit_quantities` doesn't find any associated SM
      (`bom_line_moves` is empty in [3]) and thus returns 0.
      
      Issue 02:
      (Need account_accountant. Use demo data)
      1. Create a product category PC:
          - Costing Method: AVCO
          - Inventory Valuation: Automated
          - Set up the Price Difference Account
      2. Create 3 products P_kit, P_compo01, P_compo02
          - Type: Storable
          - Category: PC
      3. Create a bill of materials:
          - Product: P_kit
          - Type: Kit
          - Components:
              - 1 x P_compo01
      4. Create a purchase order PO with 1 x P_kit
      5. Confirm PO and process the receipt
      6. Edit the bill of materials of P_kit:
          - Add 1 x P_compo02 in components
      7. Create and Post the bill
      
      Error: an Odoo Error is raised "ZeroDivisionError: float division by
      zero"
      
      While confirming the bill, some anglo saxo lines are generated. To do
      so, the valuation of the kit is computed: [1]. In the above case, it
      will lead to [2]. However, since in the mean time the user added a new
      line in the BoM, `_compute_kit_quantities` doesn't find any associated
      SM (`bom_line_moves` is empty in [3]) and thus returns 0. Back to [1],
      the quantity is used to divide the total price -> it will raise an error
      if this quantity is zero
      
      Suggestion:
      Such situations should not happen: once a product is used at least once,
      it should not become a kit nor have a new structure (if it was already a
      kit). Otherwise, `_compute_kit_quantities` will not correctly work since
      it is not possible to take the BoM changes into consideration.
      
      [1]
      https://github.com/odoo/odoo/blob/abfe37fcea5b20f77799d9331d4d011530880669/addons/purchase_stock/models/account_invoice.py#L72-L74
      [2]
      https://github.com/odoo/odoo/blob/75191404788ab83645ee35b779991ea6fcdfa406/addons/purchase_mrp/models/stock_move.py#L19
      [3]
      https://github.com/odoo/odoo/blob/7d1af314320547ab5e37c1d97cad22992c98565b/addons/mrp/models/stock_move.py#L275-L294
      
      
      
      OPW-2780855
      
      closes odoo/odoo#86821
      
      X-original-commit: 33fa43f7
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      62b47b31
    • Nicolas Bayet's avatar
      [FIX] web_editor: load odooEditor base style · c721d069
      Nicolas Bayet authored
      
      Before this commit
      The style for `li.oe-nested` was loaded only when the editor loaded.
      The problem is that the style needs to be visible even when the editor
      has never been loaded.
      
      After this commit
      The style for `li.oe-nested` is always loaded in the backend and in
      the frontend.
      
      Task-2793528
      
      closes odoo/odoo#86817
      
      X-original-commit: 6c26e24c
      Signed-off-by: default avatarDavid Monjoie (dmo) <dmo@odoo.com>
      c721d069
    • Thibault Francois's avatar
      [ADD] cloc: count loc in style file and from imported module · dc8f0662
      Thibault Francois authored
      
      Context
      -------
      
      Web design specific require a lot of work and need maintenance.
      So far the style files were not taken into account despite the
      amount of maintenance they require.
      
      With this commit they are going to be counted,
      knowing they still can be excluded in the manifest.
      
      Imported module allow to deploy frontend assets: stylesheet,
      javascript, xml template and Qweb view that require
      as well some maintenance. They are going to be counted
      
      Implementation
      --------------
      
      - Add method to parse css and scss file
      - Include .scss and .css file in the count
      
      - Add external_id to attachment that store
        frontend asset of imported module
      - Find all attachment with .js, .css, .scss, .xml
        from imported module
      - Find qweb view from imported module
      - cound the content of the attachment and the qweb view
      
      closes odoo/odoo#86816
      
      X-original-commit: d2e0b482
      Signed-off-by: default avatarChristophe Simonis <chs@odoo.com>
      Signed-off-by: default avatarThibault Francois <tfr@odoo.com>
      dc8f0662
Loading