Skip to content

Commit

Permalink
Merge PR #403 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by lreficent
  • Loading branch information
OCA-git-bot committed Sep 17, 2019
2 parents a273363 + b6f0eca commit ecfde94
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions repair_refurbish/models/stock_move.py
Expand Up @@ -14,3 +14,16 @@ def create(self, vals_list):
vals['location_dest_id'] = self.env.context[
'force_refurbish_location_dest_id']
return super().create(vals_list)


class StockMoveLine(models.Model):

_inherit = 'stock.move.line'

@api.model_create_multi
def create(self, vals_list):
if 'force_refurbish_location_dest_id' in self.env.context:
for vals in vals_list:
vals['location_dest_id'] = self.env.context[
'force_refurbish_location_dest_id']
return super().create(vals_list)
8 changes: 8 additions & 0 deletions repair_refurbish/tests/test_repair_refurbish.py
Expand Up @@ -84,8 +84,16 @@ def test_01_repair_refurbish(self):
if m.product_id == self.product:
self.assertEqual(m.location_id, self.stock_location_stock)
self.assertEqual(m.location_dest_id, self.refurbish_loc)
self.assertEqual(m.mapped('move_line_ids.location_id'),
self.stock_location_stock)
self.assertEqual(m.mapped('move_line_ids.location_dest_id'),
self.refurbish_loc)
elif m.product_id == self.refurbish_product:
self.assertEqual(m.location_id, self.refurbish_loc)
self.assertEqual(m.location_dest_id, self.customer_location)
self.assertEqual(m.mapped('move_line_ids.location_id'),
self.refurbish_loc)
self.assertEqual(m.mapped('move_line_ids.location_dest_id'),
self.customer_location)
else:
self.assertTrue(False, "Unexpected move.")

0 comments on commit ecfde94

Please sign in to comment.