From ef773730725f2e887935fcd4840191aab6a8cb32 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Wed, 26 Nov 2014 15:41:04 +0100 Subject: [PATCH] the reservation should reserve a quant For weird reasons, force-assigning a move does not associate quants. action_assign'ing the picking does, and is the same procedure that you can do via the interface. --- stock_reserve/model/stock_reserve.py | 7 +++---- stock_reserve/test/stock_reserve.yml | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/stock_reserve/model/stock_reserve.py b/stock_reserve/model/stock_reserve.py index 0b61a8b69..aab360675 100644 --- a/stock_reserve/model/stock_reserve.py +++ b/stock_reserve/model/stock_reserve.py @@ -122,10 +122,9 @@ class StockReservation(models.Model): The reservation is done using the default UOM of the product. A date until which the product is reserved can be specified. """ - move_recs = self.move_id - move_recs.date_expected = fields.Datetime.now() - move_recs.action_confirm() - move_recs.force_assign() + self.date_expected = fields.Datetime.now() + self.move_id.action_confirm() + self.move_id.picking_id.action_assign() return True @api.multi diff --git a/stock_reserve/test/stock_reserve.yml b/stock_reserve/test/stock_reserve.yml index e23ac9465..66b6f412e 100644 --- a/stock_reserve/test/stock_reserve.yml +++ b/stock_reserve/test/stock_reserve.yml @@ -62,6 +62,14 @@ - !python {model: stock.reservation}: | self.reserve(cr, uid, [ref('reserv_sorbet2')], context=context) +- + Then the reservation should be assigned and have reserved a quant +- + !python {model: stock.reservation, id: reserv_sorbet2}: | + from nose.tools import * + + assert_equal('assigned', self.state) + assert_equal(1, len(self.reserved_quant_ids)) - I check Virtual stock of Sorbet after update reservation -