mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[FIX] rma: Adjust hook for existing values
If rma_in_type_id or rma_out_type_id are already set, then the hook fails. With this alternative code, we avoid it and clean it for being clearer.
This commit is contained in:
committed by
Nikolaus Weingartmair
parent
f0360134d3
commit
0484db0694
11
rma/hooks.py
11
rma/hooks.py
@@ -56,15 +56,10 @@ def post_init_hook(cr, registry):
|
|||||||
)
|
)
|
||||||
data[picking_type] = stock_picking_type.create(values).id
|
data[picking_type] = stock_picking_type.create(values).id
|
||||||
|
|
||||||
rma_out_type = stock_picking_type.browse(data["rma_out_type_id"])
|
if data:
|
||||||
rma_out_type.write(
|
|
||||||
{"return_picking_type_id": data.get("rma_in_type_id", False)}
|
|
||||||
)
|
|
||||||
rma_in_type = stock_picking_type.browse(data["rma_in_type_id"])
|
|
||||||
rma_in_type.write(
|
|
||||||
{"return_picking_type_id": data.get("rma_out_type_id", False)}
|
|
||||||
)
|
|
||||||
whs.write(data)
|
whs.write(data)
|
||||||
|
whs.rma_in_type_id.return_picking_type_id = whs.rma_out_type_id.id
|
||||||
|
whs.rma_out_type_id.return_picking_type_id = whs.rma_in_type_id.id
|
||||||
|
|
||||||
# Create rma locations and picking types
|
# Create rma locations and picking types
|
||||||
warehouses = env["stock.warehouse"].search([])
|
warehouses = env["stock.warehouse"].search([])
|
||||||
|
|||||||
Reference in New Issue
Block a user