odoo/odoo#180998
Created by Bugfix, Vincent Ethan
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:16.0-opw-4090620-allow-quantity-zero-aml-etvi
- head
- 7376c1ea1c19ff3b762723f68dfbda4eff857072
- merged
- 7 months ago by Logistics, William Henrotin (whe)
odoo/odoo | |
---|---|
16.0 | #180998 |
17.0 | #186304 |
saas-17.2 | #186495 |
saas-17.4 | #186514 |
18.0 | #186791 |
saas-18.1 | |
saas-18.2 | |
saas-18.3 | |
master | #186933 |
[FIX] purchase_stock,stock_account: aml zero quantity case
Current behavior:
Manually adjusting a FIFO/AVCO product's cost creates a journal
items with non-zero quantity, despite there not being a logical
quantity associated with this entry.
Expected behavior:
AMLs generated for this move have 0 quantity.
Steps to reproduce:
Having accounting, purchase_stock
1. Create a storable product with average
costing
-
Create a purchase order for some of the product with some
arbitrary price unit, receive the product -
In the product form, change the cost to a smaller value
-
In the journal items pivot view, select the
quantity
field
from the 'Measures' dropdown in the top left, expand the
stock valuation journal on the left axis, observe that the
change in cost has created 2 balancing AMLs, each with
quantity == 1
Cause of the issue:
This case was not handled and quantity is always set to 1 if
falsy.
Fix:
Create the AMLs created in the cost change handle with
quantity=0. While it does risk being overwritten to 1 if the
display_type
of the line changes, the diff is minimal and
use-case is non-critical- which makes it the best solution here.