@@ -233,3 +233,51 @@ def test_13(self):
233233 rma .reception_move_id .picking_id ._action_done ()
234234 self .assertEqual (rma .state , "received" )
235235 self .assertFalse (rma .delivery_move_ids )
236+
237+ def test_14 (self ):
238+ """if the refund action is not ment to update quantity, return picking line
239+ to_refund field should be False"""
240+ self .operation .action_create_refund = "manual_after_receipt"
241+ origin_delivery = self ._create_delivery ()
242+ stock_return_picking_form = Form (
243+ self .env ["stock.return.picking" ].with_context (
244+ active_ids = origin_delivery .ids ,
245+ active_id = origin_delivery .id ,
246+ active_model = "stock.picking" ,
247+ )
248+ )
249+ stock_return_picking_form .create_rma = True
250+ stock_return_picking_form .rma_operation_id = self .operation
251+ return_wizard = stock_return_picking_form .save ()
252+ return_line = return_wizard .product_return_moves .filtered (
253+ lambda m , p = self .product : m .product_id == p
254+ )
255+ self .assertEqual (return_line .rma_operation_id , self .operation )
256+ picking_action = return_wizard .create_returns ()
257+ reception = self .env ["stock.picking" ].browse (picking_action ["res_id" ])
258+ move = reception .move_ids .filtered (lambda m , p = self .product : m .product_id == p )
259+ self .assertFalse (move .to_refund )
260+
261+ def test_15 (self ):
262+ """if the refund action is ment to update quantity, return picking line
263+ to_refund field should be True"""
264+ self .operation .action_create_refund = "update_quantity"
265+ origin_delivery = self ._create_delivery ()
266+ stock_return_picking_form = Form (
267+ self .env ["stock.return.picking" ].with_context (
268+ active_ids = origin_delivery .ids ,
269+ active_id = origin_delivery .id ,
270+ active_model = "stock.picking" ,
271+ )
272+ )
273+ stock_return_picking_form .create_rma = True
274+ stock_return_picking_form .rma_operation_id = self .operation
275+ return_wizard = stock_return_picking_form .save ()
276+ return_line = return_wizard .product_return_moves .filtered (
277+ lambda m , p = self .product : m .product_id == p
278+ )
279+ self .assertEqual (return_line .rma_operation_id , self .operation )
280+ picking_action = return_wizard .create_returns ()
281+ reception = self .env ["stock.picking" ].browse (picking_action ["res_id" ])
282+ move = reception .move_ids .filtered (lambda m , p = self .product : m .product_id == p )
283+ self .assertTrue (move .to_refund )
0 commit comments