The rational is:
Currently we have 2 columns. One for reservation, the other
for quantity picked.
However in real time, either you follow the reservation and everything
goes well. Otherwise you pick something else. In the case where you
pick somewhere else than reserved, you would like to modify the
reservation to have something similar and free the quantity you
didn't pick and expect the system to not suggest the ones you took.
In other hand, we always want to have the reserve quantity similar to
the done.
On top, having two columns could be confusing for the end user.
The cons:
-The qty_done column could be use during the picking, to
remember if something has been pick or still to pick.
- For some flow (put in pack), it's easier to write a part of the quantity to pack
and still want to reserve the full amount of product.
We goes back and choose a ligther interface over complex feature.
Changes:
Qty done and reserved qty are merged into a single column.
A new checkbox on the move exists to mark it as picked or not
Since the reservation always follow the quantity, it's now possible
to have more reserved quantity than stock. However the system will
never propose it and the inventory showing reserved > quantity should
be a warning.
The system should never modify a move that has been picked. We don't
want to overide the user action.
Regression:
Not able to pick a single stock.move.line
closesodoo/odoo#137864
Related: odoo/enterprise#48709
Related: odoo/upgrade#5310
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
When a product is purchased and received, valuation layers are created.
if we created a bill for the PO and change the product price, when the
account move is posted, `_apply_price_difference` creates new SVLs to
correct the product value.
Before this commit, the above scenario did not work with subcontracted
products, mainly because the valuation layer is linked to the finished
product move of the MO and not the incoming move of the PO.
This is fixed in `_get_valued_in_moves` where if the move is_subcontract
the orig move is the one linked to the valuation layer.
Now that we have the valuation layer, another issue arises, in the aml
`_generate_price_difference_vals` when the difference is calculated.
the `unit_valuation_difference` is not properly calculated because the
value in the layer includes the components value, so its incorrect to compare
it to the AML price, so we use `_get_layer_price_unit` to get the layer_price_unit
relevant to the AML, which in this case is the price of subcontracting (price on the PO)
Also for automated inventory valuation, when the inventory correction entry is
created it must credit the stock input account since the value of the
subcontracted product is corrected.
closesodoo/odoo#131565
Taskid: 3449931
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Company can have multiple warehouses,
when user open replenishment and company has multiple warehouses.
this will lead to below traceback.
Steps to reproduce the error:
- Go to 'Manufacturing' > Configuration > Settings > Enable Subcontracting
- Go to 'Contacts' > Create a Contact > Sales & Purchase >
Open Subcontractor Location > Enable Replenish Location
- Go to 'Inventory' > Configuration > Warehouses > Create multiple warehouses
- Create a storable product > Create BoM > Set Subcontracting in BoM Type >
Set already created contact in Subcontractors > Save
- Go to 'Purchase' > Set Subcontractor in Vendor > Add Product > Confirm Order
- Go to 'Inventory' > Operations > Replenishment
Error: A traceback appears:
'ValueError: Expected singleton: stock.warehouse(1, 2, 3, 4)'
https://github.com/odoo/odoo/blob/3864542914efcb9d4e3cabd3cfdeecb842e4f380/addons/stock/models/stock_orderpoint.py#L414
here, we can get multiple warehouses for a company.
So it will lead to above traceback.
sentry-4358838167
closesodoo/odoo#133178
X-original-commit: fd0e104c13fae2c2b34443502b88017ef98e5523
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
entry wrong when resupply subcontractor
In case product is using standard price and automated inventory valuation.
We post account entries in price difference account when the price on
purchase order is different from the cost of product. However, when we
do subcontracting and resupply our subcontractor, the cost is not just
the price on purchase order, but also the cost of the components we sent
to the subcontractor. Currently, we didn't take the components cost in
to account when post price difference entries. Fix it in this commit.
Task-3223451
closesodoo/odoo#132282
X-original-commit: e771535b487e76f4e5a23b767d220d7f640292a6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Yuchen Huang (yhu) <yhu@odoo.com>
Steps to reproduce:
- Install purchase, inventory and manufacturing.
- Now create a subcontractor, with it's corresponding location, it's set
by default.
- Go to this new location and set it as replenishment location.
- Now create a Request for Quotation using this subcontractor.
- We will receive a traceback whent trying to access replenishment.
Issue:
We got a traceback caused by the fact that we are trying to set
as replenishment location, a location that doesn't have a warehouse.
Solution:
We need to add the handling of this case, so we won't always need
a warehouse for the orderpoint.
opw-3164276
closesodoo/odoo#121065
X-original-commit: 874e42463c2077980b9b4ce3903030c980285d51
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Before this commit, updating a purchase quantity of subcontracting
product will try to not merge the new and old move to keep the two chain
separated as much is possible and avoid side effects (receipt move,
subcontracting moves, resupply moves). Some were merged, some cancelled,
...
This had two issues:
First, not merging the quantity was not guarantied
as you can specify you don't want to merge them with others but it's not
possible for a stock move to say to any other move do not merge with me.
Second, by not merging the receipt moves, we duplicate every other
object on the chain. This pollute the database uselessly.
opw-3147446
closesodoo/odoo#114739
X-original-commit: 0b1bcfacb13c7de480f30015b91db11ed03f2dfe
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Steps to reproduce:
- create a subcontracted product (i.e. create subcontract BoM)
- create and confirm PO for subcontracted product (qty > 1)
- try to decrease PO qty for subcontracted product
Expected Result:
Since receipt is not yet validated, the qty in the receipt should
decrease (it will in the subcontract MO as well, but this doesn't matter
since no one should work directly with the MO)
Actual Result:
A validation error occurs saying the qty to produce must be non-negative
We allow neg demand qtys to be proprogated from SOs and POs since
https://github.com/odoo/odoo/pull/76752 . While we added in a check to
make sure MOs are not created when a neg qty change is proprogated, we
forgot to add a check for subcontracted created MOs, hence the
validation error (i.e. the neg qty change is trying to create a
subcontracted MO of a neg amount.)
Task: 2777571 (issue 2 of additional issues)
X-original-commit: 251f146b6ecb0e2d428089669199a6deb3a6c060
Part-of: odoo/odoo#97383
Add a new module to add smart buttons between a subcontracting purchase
order and the ressuply component delivery.
task-2486811
Part-of: odoo/odoo#75041