Skip to content

Commit f7a71f9

Browse files
committed
[FIX]stock_secondary_unit: compute secondary qty for return pickings
1 parent bbdc55e commit f7a71f9

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

stock_secondary_unit/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from . import product_product
55
from . import product_template
66
from . import stock_move
7+
from . import stock_return_picking
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
##############################################################################
2+
# For copyright and license notices, see __manifest__.py file in module root
3+
# directory
4+
##############################################################################
5+
from odoo import models, fields
6+
7+
8+
class StockReturnPicking(models.TransientModel):
9+
_inherit = 'stock.return.picking'
10+
11+
def _create_returns(self):
12+
# Computes the second quantity for the return picking
13+
new_picking, pick_type_id = super()._create_returns()
14+
picking = self.env['stock.picking'].browse(new_picking)
15+
for move in picking.move_ids:
16+
if move.product_uom_qty and move.secondary_uom_id:
17+
factor = move.secondary_uom_id.factor or 1.0
18+
move.secondary_uom_qty = move.product_uom_qty / factor
19+
return new_picking, pick_type_id

0 commit comments

Comments
 (0)