When trying to validate the delivery/picking you get an error message.
Usually happens when dealing with products with serial numbers. This will be permanently fixed in the future but in the meantime, here is how to handle it.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
The way i did is in the fallowing video and it worked ..
you will endup having a component not consumed, but you can at least mark as done the MO
https://screencast-o-matic.com/watch/c3jZlDVTONK
Thank you sir, this worked for me and you made my day happier :-)
the link is not working, could you please update it? thanks
When trying to validate the delivery/picking you get an error message.
Usually happens when dealing with products with serial numbers. This will be permanently fixed in the future but in the meantime, here is how to handle it.
ARM created a fix for this. In order to implement it you need to follow these steps:
1. debug mode
2. technical/server actions
3. create
4. action name: e.g. fix unreserved qty
5. model: ir.actions.server
6. action to do: "execute python code"
7. copy/paste the fix underneath the pre-existing code
8. "save"
9. "create contextual action"
10. refresh page
11. action/fix "fix unreserved qty"
12. wait for it to load
13. "remove contextual action"
14. action/delete
______
You can explain this to the client (so that they do it themselves or you do it following the steps mentioned above)
It happens because the reserved quantity in your inventory does not reflect the one on your pickings.It's probably due to a small configuration change while some pickings where open.
An easy way to remove it is to create a server action that executes this code
It should repair all the inconsistencies in your data.
If you need help in order to create the server action. Do not hesitate to ask.
__________________________________________________________________________
quants = env['stock.quant'].search([])
warning = ''
for quant in quants:
move_lines = env["stock.move.line"].search([
('product_id', '=', quant.product_id.id),
('location_id', '=', quant.location_id.id),
('lot_id', '=', quant.lot_id.id),
('package_id', '=', quant.package_id.id),
('owner_id', '=', quant.owner_id.id),
('product_qty', '!=', 0)
])
reserved_on_move_lines = sum(move_lines.mapped('product_qty'))
move_line_str = str.join(', ', [str(move_line_id) for move_line_id in move_lines.ids])
if quant.location_id.should_bypass_reservation():
# If a quant is in a location that should bypass the reservation, its `reserved_quantity` field
# should be 0.
if quant.reserved_quantity != 0:
quant.write({'reserved_quantity': 0})
else:
# If a quant is in a reservable location, its `reserved_quantity` should be exactly the sum
# of the `product_qty` of all the partially_available / assigned move lines with the same
# characteristics.
if quant.reserved_quantity == 0:
if move_lines:
move_lines.with_context(bypass_reservation_update=True).write({'product_uom_qty': 0})
elif quant.reserved_quantity < 0:
quant.write({'reserved_quantity': 0})
if move_lines:
move_lines.with_context(bypass_reservation_update=True).write({'product_uom_qty': 0})
else:
if reserved_on_move_lines != quant.reserved_quantity:
move_lines.with_context(bypass_reservation_update=True).write({'product_uom_qty': 0})
quant.write({'reserved_quantity': 0})
else:
if any(move_line.product_qty < 0 for move_line in move_lines):
move_lines.with_context(bypass_reservation_update=True).write({'product_uom_qty': 0})
quant.write({'reserved_quantity': 0})
product_without_quants = env['product.product'].search([('type', '=', 'product')]) - quants.mapped('product_id')
move_lines_to_unreserve = []
for product in product_without_quants:
move_lines = env['stock.move.line'].search([
('product_qty', '!=', 0),
('product_id', '=', product.id),
])
for move_line in move_lines:
if not move_line.location_id.should_bypass_reservation():
move_lines_to_unreserve.append(move_line.id)
if len(move_lines_to_unreserve) > 1:
env.cr.execute(""" UPDATE stock_move_line SET product_uom_qty = 0, product_qty = 0 WHERE id in %s ;""" % (tuple(move_lines_to_unreserve), ))
elif len(move_lines_to_unreserve) == 1:
env.cr.execute(""" UPDATE stock_move_line SET product_uom_qty = 0, product_qty = 0 WHERE id = %s ;""" % (move_lines_to_unreserve[0]))
Not working odoo13 Enterprise Edition
Hi,
Enable debug mode and navigate to server action menu under settings and see if there is a server action named: Correct inconsistencies for reservation
If found, click on Run button, which will solve the issue, if server action is not found, pull the latest source code of corresponding odoo version and upgrade the stock module.
Thanks
Hello we have tried the above solution, but we still keep getting the above error on an odoo.sh instance. Kindly assist us accordingly.
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrirePublications associées | Réponses | Vues | Activité | |
---|---|---|---|---|
|
2
mars 23
|
3756 | ||
|
2
sept. 24
|
27973 | ||
|
1
févr. 25
|
14811 | ||
|
0
mai 21
|
15 | ||
|
1
avr. 25
|
5550 |