first commit
This commit is contained in:
commit
d3514a24d2
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# OS generated files
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Stock Fix Unpicked Backorder
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This module patches an issue in Odoo 19 where validating a partial stock picking and choosing "No Backorder" causes Odoo to explicitly cancel any stock move lines that have not been manually marked as `picked`. This cancellation results in their quantity being zeroed out, even if the line's quantity perfectly matched its demand.
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
Odoo 19's `stock.picking` validation skips automatically marking lines as `picked = True` if *any* other line in the transfer was manually processed/picked. When `cancel_backorder=True` is provided (via the "No Backorder" wizard), the `_action_done` method of `stock.move` cancels moves that are not picked or have <= 0 quantity.
|
||||||
|
|
||||||
|
This module overrides `_pre_action_done_hook` on `stock.picking` to ensure that any move with a `quantity > 0` is automatically marked as `picked = True` right before the validation logic runs.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Simply install the module. The fix is applied automatically during the backorder validation flow.
|
||||||
1
__init__.py
Normal file
1
__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
11
__manifest__.py
Normal file
11
__manifest__.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
'name': 'Stock Fix Unpicked Backorder',
|
||||||
|
'version': '19.0.1.0.0',
|
||||||
|
'category': 'Inventory/Inventory',
|
||||||
|
'summary': 'Fixes Odoo 19 issue where lines with quantity are zeroed out on No Backorder',
|
||||||
|
'depends': ['stock'],
|
||||||
|
'data': [],
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'license': 'LGPL-3',
|
||||||
|
}
|
||||||
1
models/__init__.py
Normal file
1
models/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import stock_picking
|
||||||
15
models/stock_picking.py
Normal file
15
models/stock_picking.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from odoo import models
|
||||||
|
|
||||||
|
class StockPicking(models.Model):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
def _pre_action_done_hook(self):
|
||||||
|
# Odoo 17 skips auto-setting `picked = True` if _any_ line was manually picked.
|
||||||
|
# This causes unpicked lines with `quantity > 0` to be cancelled
|
||||||
|
# when the user selects "No Backorder", zeroing out their quantity.
|
||||||
|
# We enforce that any line with quantity > 0 is treated as picked.
|
||||||
|
for picking in self:
|
||||||
|
for move in picking.move_ids:
|
||||||
|
if move.quantity > 0 and not move.picked:
|
||||||
|
move.picked = True
|
||||||
|
return super()._pre_action_done_hook()
|
||||||
Loading…
Reference in New Issue
Block a user