Skip to content
Snippets Groups Projects
  1. Sep 20, 2023
    • Mathieu Walravens's avatar
      [FIX] stock_account: correct accounts for dropship return · 30de83a5
      Mathieu Walravens authored
      
      Before this commit:
      When returning a dropshipping, the valuation layers created do not have
      the correct accounts on it:
       - Valuation -> Input   for the first SVL
       - Output -> Valuation  for the second SVL
      
      After this commit:
      For a dropshipped move, valuation layers have the following chain
      of accounts:
       - Input -> Valuation   for the first SVL
       - Valuation -> Output  for the second SVL
      Therefore, the return should have it reversed:
       - Output -> Valuation  for the first SVL
       - Valuation -> Input   for the second SVL
      
      Steps to reproduce:
      1. Create a dropship product with automated inventory valuation
      2. Create a Sales Order, go on the PO and confirm it
      3. Set quantities and validate dropshipping
      4. Return delivered product (dropship return)
      
      opw-3391174
      
      closes odoo/odoo#132864
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      30de83a5
  2. Jul 28, 2023
    • Tom De Caluwé's avatar
      [FIX] stock_account: avoid negative values after revaluation · 75bb9886
      Tom De Caluwé authored
      
      When performing a manual stock revaluation, the value difference is distributed
      equally among the available stock. This method breaks down however in case of a
      devaluation where some items in stock are already valued less than the unit
      cost difference: this results in a negative value.
      
      This commit will prevent such devaluations by raising a UserError whenever the
      remaining value of a stock.valuation.layer becomes negative. Additionally, after
      a revaluation, the standard_price field will now also be updated for fifo valued
      products.
      
      opw-3340298
      
      closes odoo/odoo#126157
      
      Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
      75bb9886
  3. Jul 14, 2023
    • Mathieu Walravens's avatar
      [FIX] stock_account: correct value for returns · 4261c6ba
      Mathieu Walravens authored
      
      Before this commit:
      When returning a transfer in AVCO/FIFO, the return's value is not always
      the same as the original delivery. The unit cost for the return was
      rounded, which introduced rounding errors.
      
      After this commit:
      When returning a transfer in AVCO/FIFO, the return's unit cost is not
      rounded, allowing the correct value to be set.
      
      Steps to reproduce:
      1. Create a product and change its category costing method to AVCO
      2. Purchase the product qty: 1 price: 13.13
      3. Purchase the product qty: 1 price: 12.20
      4. Sell the 2 product and deliver it
      5. Create a return for the delivery
      6. The value on the delivery is 25.33, but 25.34 on the return
      
      opw-3358531
      
      closes odoo/odoo#126546
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      4261c6ba
  4. Apr 19, 2023
  5. Mar 16, 2023
    • David (dafr)'s avatar
      [FIX] stock_account: Compensate rounding error on small quantities · a76fb7ff
      David (dafr) authored
      
      To reproduce the issue:
      1. Create a product:
         - Type: Storable
         - Category:
           - Costing Method: AVCO
      2. IN 2 @ 4.63/u
      3. IN 5 @ 3.04/u
      4. OUT 0.1
      5. Repeat step 4 70 time in total, so that the final quantity is 0
      6. Open the inventory valuation of the product
      
      Error: the total value is $-0.04 instead of $0.
      The compensation of rounding issue is stuck by a check that ensure we don't erase a valuation error.
      
      However, this check can never succeed with small quantities, here is the mathematical proof:
      °Current check: rounding_error <= qty * curr_rounding / 2
      With:
      1) rounding_error >= curr_rounding
      2) 0 < qty < 2
      3) v1 = rounding_error / curr_rounding
      4) v2 = qty / 2
      We can be sure that:
      5) v1 >= 1 because of 1)
      6) v2 < 1 because of 2)
      7) v1 > v2 because of 5) and 6)
      
      ° rounding_error <= qty * curr_rounding / 2
      ° rounding_error * curr_rounding <= qty * curr_rounding / 2 * curr_rounding
      ° rounding_error / curr_rounding <= qty / 2
      ° v1 <= v2
      ==>> This contradict 7), hence this check can never be True for qty < 2
      
      To fix this issue, we change the check to:
       ° rounding_error <= qty * curr_rounding / 2 OR rounding_error <= curr_rounding
       Where the 1st part doesn't change, but the second one is true when rounding_error == curr_rounding
      
      closes odoo/odoo#115516
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      a76fb7ff
  6. Mar 15, 2023
    • David (dafr)'s avatar
      [FIX] stock_account: AVCO manual price change Rounding error · 6af7d682
      David (dafr) authored
      
      ## To reproduce:
      => Import 5 units of P1 at $5
      => Import 2 units of P1 at $2
      ----> Current valuation: Qty 7, Value $37, Std Price $5.29 (rounded)
      => Change standard Price to 7
      ----> Current valuation: Qty 7, Value $48.97, Std Price $7
      
      ## Solution:
      To compute the value delta, we don't use the current standard_price (which may be rounded), but the current value_svl.
      
      OPW-3233260
      
      closes odoo/odoo#115311
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      6af7d682
  7. Mar 02, 2023
    • William Henrotin's avatar
      [FIX] stock_account: compensate rounding error · ae060c63
      William Henrotin authored
      To reproduce the issue:
      1. Create a product:
         - Type: Storable
         - Category:
           - Costing Method: AVCO
      2. IN 1000 @ 0.17
      3. IN 800 @ 0.23
      4. OUT 1000
      5. OUT 800
      6. Open the inventory valuation of the product
      
      Error: the total value is $-6.00, it should be zero
      
      Once all products received, the standard price is $0.20. Its value
      has been rounded because the real value is
      `(1000 * .17 + 800 * .23) / 1800 = 0,196666667`
      The standard price will create a difference when using the products,
      because:
      `(1800 * .20 = 360) != (1000 * .17 + 800 * .23 = 354)`
      That's the reason why a feature tries to compensate such rounding
      errors. So, step 4, when preparing the values of the out-SVL, we
      check if there is a rounding error, and we find a difference of $6,
      which is correct. However, the difference is above the treshold, so
      we will not consider it as a rounding error:
      https://github.com/odoo/odoo/blob/3ff51daa93a1d670b8f67f79418d4dd48e94875f/addons/stock_account/models/product.py#L197-L200
      
      
      
      Here is the issue: the threshold is based on the outgoing quantity
      (1000) while the value difference is based on the whole quantity
      (1800). This difference should also be proportional to the outgoing
      quantity.
      
      Note: The fix will still not work with a small quantity. The only and
      best solution is to change the type of the SVL unit cost into a
      float.
      
      OPW-3101374
      
      Part-of: odoo/odoo#108072
      Co-authored-by: default avatarAdrien Widart (awt) <awt@odoo.com>
      ae060c63
  8. Dec 07, 2022
    • mafo-odoo's avatar
      [FIX] stock_account, purchase_stock: no stock account in manual valuation · 9dc7835c
      mafo-odoo authored
      
      Issues:
      1) When the inventory valuation is Manual the stock accounts field of the
      product category should be empty and they should be set when the
      inventory valuation is Automated.
      2) For the moment at installation all the categories have the Manual default
      value and the comapy account default values for the stock accounts (not
      respecting condition 1)
      
      Solutions:
      For issue 1 we add checks on the write and create functions of the product
      category model so that after creation/modification the instance respect the
      condition
      For issue 2 we add at the end of the post_hook script some code to set an
      empty stock account property for every product category.
      
      opw-2746384
      
      closes odoo/odoo#98379
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      9dc7835c
  9. Oct 27, 2022
  10. Jun 09, 2022
  11. Jun 01, 2022
  12. Apr 29, 2022
    • Adrien Widart's avatar
      [FIX] stock_account: round SVL's value of incoming move · 306f3be8
      Adrien Widart authored
      The SVL of in/out moves may be different because of rounding
      
      To reproduce the issue:
      (Need purchase,sale_management,stock)
      1. In Settings, enable "Multi-Currencies"
      2. Edit the USD currency:
          - Rounding factor: 1.0
      3. Create a product category PC:
          - Costing Method: FIFO
      4. Create a product P:
          - Type: Storable
          - Category: PC
      5. Create a purchase order PO with one line:
          - Product: P
          - Quantity: 0.5
          - Unit Price: 3.0
          - Taxes: None
      6. Confirm the PO and receive P
      7. Create a sale order SO with 0.5 x P
      8. Confirm the SO and deliver P
      9. Inventory > Reporting > Inventory Valuation
      
      Error: The quantity of P is zero but its total value is 0.50$
      
      When receiving P, a SVL is created but does not round the value. So, we
      have 0.5 x P in stock with a value equal to $1.50
      Then, when deliver the product, the FIFO process is executed and create
      a second SVL. However, this time the value is rounded:
      https://github.com/odoo/odoo/blob/2e4fdcb84ba6375bb51fe71355168cebe2d922a0/addons/stock_account/models/product.py#L290
      
      
      Therefore, the SVL of the out move has a value equal to $2. This
      explains why, when checking the inventory valuation, the value is $-0.50
      
      OPW-2724864
      
      closes odoo/odoo#89743
      
      X-original-commit: bf9b03a8
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      306f3be8
  13. Apr 12, 2022
    • Yolann Sabaux's avatar
      [FIX] stock_account: compute new price with correct rounding · 2d6f4213
      Yolann Sabaux authored
      
      Steps to reproduce:
      
      Decimal Accuracy - Product Price = 2
      - create a product `alc 50%` with BOM (10 unites = 1 unit Water [cost=0.14]; 1 unit Alc [cost=0.08])
      - Set `quantity on hands` = 10,000
      - Trigger `Compute Price from BoM`
      
      -> In Reporting > Inventory Valuation; click on the layer; in Other Info: You will see "Product value manually modified (from 0.0 to 0.022000000000000002)"
      => It can cause computing mistakes as we changed the costs
      
      Cause:
      
      The value is calculated as the difference between the New Price (cost) and and the current Product Standard Price (cost).
      But, on one hand the Product Standard Price is rounded to the number of digits defined in the Decimal Accuracy for the Product Price.
      On the other hand, the New Price is used as is with no rounding.
      
      If we add an extra step and modify the cost of the Water to 0.45 and trigger again the `Compute Price from BoM` we will have:
      "Product value manually modified (from 0.02 to 0.053000000000000005)"
      
      Solution:
      
      Use for the New Price the same rounding precision as we use for the Standard Price.
      
      Example:
      
      Product		Price/unit
      --------------------------
      Water		0.14
      Alc. 100%	0.08
      
      BoM: Alc. 50%
      Product		Quantity Needed
      --------------------------
      Water		0.1
      Alc. 100%	0.1
      
      Cost/unit of Alc. 50%: 0.022 => 0.02 (standard_price is rounded)
      Set Quantity on Hand: 10,000
      
      Stock Valuation: 200 = 10,000 * 0.02
      => The standard_price is rounded to the second digit when intialized
      
      Product         Price/unit
      --------------------------
      Water           0.45
      Alc. 100%       0.08
      
      BoM: Alc. 50%
      Product         Quantity Needed
      --------------------------
      Water           0.1
      Alc. 100%       0.1
      
      Cost/unit of Alc. 50%: 0.053
      Set Quantity on Hand: 10,000
      
      Stock Valuation WITHOUT FIX: 530 = 200 (first layer) + 330 (second layer) = 0.02 * 10,000 + (0.053-0.02) * 10,000
      Stock Valuation WITH FIX: 500 = 200 (first layer) + 300 (second layer) = 0.02 * 10,000 + (0.05-0.02) * 10,000
      
      => Without fix, the value is computed with the rounded standard_price and the not rounded new_price.
      => With fix, the new_price is rounded the same way as the standard_price
      
      opw-2724975
      
      closes odoo/odoo#87600
      
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      2d6f4213
  14. Apr 06, 2022
    • David (dafr)'s avatar
      [FIX] stock_account: Return product with revaluation layer · bfd1a06b
      David (dafr) authored
      
      How to reproduce:
      1- Create Product Category "PC" AVCO|FIFO Automated.
      2- Create Storable Product "P" with product category PC and unit cost to 1.
      3- Create SO with 10 units of P.
      4- Create PO with 10 units of P and unit cost of 2.
          Delivery of the SO should now have 2 IV layers, with one being "Revaluation of XXX (negative inventory)"
          Global IV of P should be 0 qty, 0 value.
      5- Return the delivery order of SO.
      6- Open valuation of the return
      
      Error: The value is 0, should be 20
      In `_get_price_unit`, `price_unit` is taken on the last svl of the origin_returned_move_id, in our case it's the revaluation layer.
      `_get_price_unit` now take all svls of origin_returned_move_id into account.
      
      OPW-2784033
      
      closes odoo/odoo#88110
      
      X-original-commit: f8e2f2a4
      Signed-off-by: default avatarArnold Moyaux <arm@odoo.com>
      bfd1a06b
  15. Mar 14, 2022
    • anhe-odoo's avatar
      [FIX] stock_account: don't update inventory valuation for negative quantity · 673a6b69
      anhe-odoo authored
      
      Expected Behaviour
      
      When updating the cost of a product with a negative quantity and then
      making an inventory adjustment, the final value should be corrected according
      to the current cost of the product
      
      Observed Behaviour
      
      In the case we had a negative quantity when changing the cost, the compensation
      layer will be ignored when doing an inventory adjustment afterward, leading to
      an incorrect total value in the inventory valuation
      
      Reproducibility
      
      This bug can be reproduced following these steps:
      - Create Storable product with costing method = AVCO Automated, Update cost to 100$
      - Sell 10 units of this product (Inventory valuation at -1000 $ for -10 units)
      - Update cost of the product to 10 $ (Inventory valuation at -100 $ for -10 units)
      - Create an inventory adjustment to set the quantity of the product to 0.
      ==> Inventory valuation is a 900 $ for 0 unit of our product
      
      Related Issues/PR
      
      - opw-2635692
      
      closes odoo/odoo#86328
      
      X-original-commit: 2e4fdcb8
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarHendrickx Anthony (anhe) <anhe@odoo.com>
      673a6b69
  16. Feb 15, 2022
    • Adrien Widart's avatar
      [FIX] stock_account: return product with PU equal to zero · 3ad98f7d
      Adrien Widart authored
      
      To reproduce the issue:
      (Need purchase,sale_management)
      1. Create a product category PC:
          - Costing Method: FIFO
      2. Create a product P
          - Type: Storable
          - Category: PC
      3. Create a PO with 1 x P @ 10 + Receive P
      4. Create a PO with 1 x P @ 0 + Receive P
      5. Create a SO with 1 x P + Deliver P
      6. Create a SO with 1 x P + Deliver P
      7. Process a return for sold P at step 6
      8. Open the valuation of the return
      
      Error: The value is 10, should be 0
      
      In `_get_price_unit`, `price_unit` is defined with the correct value
      (i.e., `0`), but the if-condition of the `return` is not respected, so
      another value is used
      
      OPW-2735502
      
      closes odoo/odoo#84590
      
      X-original-commit: c1f7c1dc
      Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
      Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
      3ad98f7d
  17. Jan 14, 2022
    • Adrien Widart's avatar
      [FIX] stock_account: base reversed anglo-saxon AML on original one · ef412908
      Adrien Widart authored
      When reversing an invoice that contains some anglo-saxo AML, the new
      anglo-saxo AML should have the same unit price than the original one
      
      To reproduce the issue:
      (Need account_accountant,purchase)
      1. Create a product category PC:
          - Costing Method: AVCO
          - Inventory Valuation: Automated
      2. Create a product P:
          - Type: Storable
          - Product Category: PC
      3. Create a purchase order PO01 with 2 x P for $10
      4. Confirm PO01 and process the receipt
      5. Create and Post an invoice INV01 with 2 x P
          - As listed in the journal items, the anglo-saxo lines have been
      generated with a value of $20
      6. Create a purchase order PO02 with 2 x P for $20
          - The cost of P becomes $15
      7. Confirm PO02 and process the receipt
      8. Add a credit note to INV01:
          - Credit Method: Partial Refund
      9. Set the quantity of P to 1
      10. Post the new invoice INV02
      
      Error: The anglo-saxo lines are listed in the journal items, which is
      correct, but their value is $15 (the new cost of P) while it should be
      $10
      
      When reversing an invoice with the "partial refund" method, the
      anglo-saxo lines are generated via the regular flow (as if it were a
      "standard" invoice). Therefore, when getting the unit price of the line,
      it uses the product's standard price. In such situation, it should use
      the unit price of the original line.
      
      OPW-2646926
      OPW-2628215
      
      Part-of: odoo/odoo#82547
      ef412908
  18. Apr 13, 2021
  19. Mar 02, 2021
  20. Feb 23, 2021
    • Rémy Voet (ryv)'s avatar
      [FIX] stock_account: fix rounding adjustment · 90694e09
      Rémy Voet (ryv) authored
      
      This fix (odoo/odoo#46850) was too permissive and fix too much
      stock valuation issues (other than rounding error) under the hood.
      The problem of the "too permissive" is will hide some errors
      without get any feedback about them. Also, it changes the SVL value
      without any explanation.
      
      To avoid the first issue, apply a threshold on the rounding adjustment.
      This threshold is '(quantity_out * smallest_value_of_the_currency) / 2'
      (`smallest_value_of_the_currency` = `rounding` field of the related
      currency).
      Also to improve debugging, add a line in the description
      about the rounding adjustment done in a SVL
      
      task-2452786
      
      closes odoo/odoo#66662
      
      X-original-commit: 74ba8039
      Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
      90694e09
  21. Jan 27, 2021
  22. Nov 30, 2020
    • Nicolas Martinelli's avatar
      [FIX] account, stock_account: invoice in multi-currency · 9e1aec78
      Nicolas Martinelli authored
      
      - Activate Anglo-Saxon accounting
      - Set a foreign currency rate to 2.0
      - Create a product A:
        Inventory Valuation: 'Automated'
        Costing Method: 'Standard Price'
        Cost: 10.0
        Public Price: 100.0
      - Create an invoice in foreign currency
      - Add 1 unit of A => the total amount is 200.0
      - Confirm the invoice
      
      The Amount Due is 100.0 instead of 200.0.
      
      This happens because the Anglo-Saxon lines have the company currency,
      while the other lines have the foreign currency. Because of this, the
      `_compute_amount` method considers the move as multi-currency to compute
      the various amount. However, the Anglo-Saxon lines should be neglected.
      
      This happens from 14.0 because all lines have a currency. In previous
      versions, lines in the company currency didn't have the `currency_id`
      set.
      
      opw-2390107
      
      closes odoo/odoo#62543
      
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      9e1aec78
  23. Sep 29, 2020
    • William Henrotin's avatar
      [FIX] stock_account: empty move valuation · 569d4379
      William Henrotin authored
      
      The validation of a stock move without quantity done create an empty
      stock valuation layer. This is not a wanted behavior as :
      1. it create record without useful information (0 value, 0 remaining
      qty, 0 remaining value)
      2. The landed cost value is set on a wrong layer in case of complete
      backorder.
      
      This commit bypass the valuation process on a move if it is validated
      without any quantity.
      
      opw : 2328258
      
      closes odoo/odoo#58770
      
      X-original-commit: 01e21735dbf3ac2fe975323cee2f4bb93e4ca747
      Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
      Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
      569d4379
  24. Aug 05, 2020
    • william's avatar
      [IMP] account: soft post entries in the future · 82dc0cb7
      william authored
      Add an easy way to not post the entries in the future when calling
      post() on it, but rather set it to be auto-posted at accounting date.
      This is useful when we are creating a lot of entries in batch and some
      might be in the future, some in the past, and we don't want to separate
      that in two batch every time. (asset, accrual, transfer,... )
      82dc0cb7
  25. Jul 31, 2020
  26. May 26, 2020
  27. May 18, 2020
    • Raphael Collet's avatar
      [IMP] models: use slots for BaseModel · ea3e3950
      Raphael Collet authored
      
      This restricts the attributes of a BaseModel instance to `env`, `_ids`
      and `_prefetch_ids`.  This way, one can only assign fields on a record;
      other assignments are programming errors.
      
      This also reduces the memory footprint of records from 168 to 64 bytes
      (-62%), and makes their instanciation faster.
      
      closes odoo/odoo#51075
      
      Related: odoo/enterprise#10529
      Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
      ea3e3950
  28. Mar 04, 2020
    • Rémy Voet (ryv)'s avatar
      [IMP] stock_account: add button to create manual stock valuation layers · 7c55c20f
      Rémy Voet (ryv) authored
      Add a way to create a munual stock valuation layer, create
      a stock valuation layers implies :
      - Change the stardard price with the new valuation by product unit in case of AVCO.
      - Create a manual stock valuation layer with the added value.
      - Update the remaining value of current valuation layer.
      - If the Inventory Valuation of the product category is automated, create
      related account move.
      
      task-2123752
      7c55c20f
    • Rémy Voet (ryv)'s avatar
      [REM] stock_account: clean import/condition/dead-code · c4d71d7d
      Rémy Voet (ryv) authored
      For the stock_account module:
      - Remove unused import
      - Remove deadcode, unused _anglo_saxon_sale_move_lines method
      and useless 'continue' keyword
      - Fix duplicate name test (test_average_perpetual_8 defines twice)
      - Make comments flake8 compliant
      
      task-2123752
      c4d71d7d
  29. Feb 19, 2020
  30. Feb 05, 2020
    • wan's avatar
      [IMP] account: rework name sequences · dfd01b8c
      wan authored
      
      Task 2146469
      
      Rework the name computation:
      * It doesn't use ir.sequence anymore
      * It is an editable computed field
      * Add a renaming tool
      
      This allows the user to tweak the sequences more easily than having to
      get through the ir.sequence settings.
      
      The sequence depends on a parameter of the journal: continuous, montly
      and yearly restart of the sequence. Everytime a new period is started,
      try to make a pattern form another period.
      
      The incrementing is done by taking the previous name, ordered
      lexicographically, splitting it by taking the digits at the end, adding
      1 and re contstruct with the prefix.
      
      ** This means there could be cases where the prefix has a big importance
      on the next number. For instance, if you have
      INVOICE/2019/0001
      INVOICE/2019/0002
      and then rename the last one to INV/2019/0002, don't expect the next
      number to be INV/2019/0003. It will be INVOICE/2019/0002 (again) because
      the highest number was INVOICE/2019/0001.
      You will then end up with
      INVOICE/2019/0001
      INV/2019/0002
      INVOICE/2019/0002
      
      closes odoo/odoo#41485
      
      Related: odoo/enterprise#7189
      Signed-off-by: default avatarQuentin De Paoli (qdp) <qdp@openerp.com>
      dfd01b8c
  31. Jan 22, 2020
    • Ujas Dubal's avatar
      [FIX] stock_account: Added default type for 'account.move' line. · a5c4855a
      Ujas Dubal authored
      
      This commit will fixed the error when product has some stock quants
      and product category with 'Automated' valuation method, is set to that product.
      
      ==============================
      
      Steps to product the above mentioned error:
      1. Create product with any category which has 'Manual' valuation method.
      2. Update 'On Hand' quantity for the same product.
      3. Create product category with valuation method set to 'Automated'.
      4. Now set the above product category to the same product which you created in step 1.
      5. And Click on the save button.
      
      ==============================
      
      Also edit the test case.
      
      closes odoo/odoo#43755
      
      Task: 2155804
      X-original-commit: c62dea6a
      Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
      a5c4855a
  32. Dec 30, 2019
    • Simon Lejeune's avatar
      [FIX] stock_account: negative stock and vacuum · b08585e0
      Simon Lejeune authored
      Running the vacuum in avco indeed fixed the estimated value on the
      delivery but it did not update the standard price afterwards, making it
      possible to have an inconsistent standard price with the actual value in
      stock, as described in [0] and in the task [1].
      
      A test was added (and validated) in the layers test file and an two old
      one were fixed. test_average_perpetual_2 displayed also a different
      missing bit: the vacuum should run when the user unlock and increments a
      receipt.
      
      [0] https://github.com/odoo/odoo/pull/41669
      
      
      [1] 2154638
      
      closes odoo/odoo#42292
      
      X-original-commit: 6e4c9b8219db0c94c29f5ee145998e6f1597bb55
      Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
      b08585e0
  33. Dec 10, 2019
    • Debauche Stéphane's avatar
      [IMP] stock_account: change the standard price calculation for FIFO products · 39872c93
      Debauche Stéphane authored
      Before
      ======
      If a product is FIFO, the standard price is the unit cost of the last released.
      ```
      + 1 product @ 10€
      + 1 product @ 15€
      - 1 product
      -> Actual standard price is 10€
      
      ```
      
      After
      =====
      If a product is FIFO, the standard price of the ``product.product`` is the
      unit cost of the next product which will  be released
      ```
      + 1 product @ 10€
      + 1 product @ 15€
      - 1 product
      -> Actual standard price is 15€
      
      ```
      
      Task #2038418
      39872c93
  34. Dec 09, 2019
  35. Dec 06, 2019
  36. Nov 22, 2019
    • Pierre Masereel's avatar
      [IMP] base: add unique constraint on ir.property · e85faf39
      Pierre Masereel authored
      
      There is no unique constraint on the properties to avoid having two
      properties for the same field, company and res_id.
      
      Having two properties for the same field, company and res_id, leads to
      inconsistencies through the code, as reading a company-dependent field
      nondeterministically returns one of the available property value.
      
      So now, before creating a property, we have to check that there is not
      already a value for the field, company and res_id and write or create
      depending on if it is already exists.
      
      The properties of specific records already satisfy the constraint thanks
      to the implementation of company-dependent fields that use the method
      `set_multi`.  We added a method `set_default` to set generic properties,
      and its implementation does the right thing.  It also simplifies the
      code to set such properties, by the way.
      
      closes odoo/odoo#40473
      
      Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
      Co-authored-by: default avatarRaphael Collet <rco@odoo.com>
      e85faf39
  37. Nov 12, 2019
  38. Nov 05, 2019
Loading