From 30d0861f0a9c9079c3c2222ca6d1b2a2e33469c2 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Tue, 5 Dec 2017 09:35:42 +0100 Subject: [PATCH 1/2] [FIX] base: ir.sequence better fallback Zero is an non-acceptable value for sequences, so the fallback should be one instead. Fixes #21267 --- openerp/addons/base/ir/ir_sequence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_sequence.py b/openerp/addons/base/ir/ir_sequence.py index 25728399b19..61997e23348 100644 --- a/openerp/addons/base/ir/ir_sequence.py +++ b/openerp/addons/base/ir/ir_sequence.py @@ -105,7 +105,7 @@ class ir_sequence(models.Model): def _set_number_next_actual(self): for record in self: - record.write({'number_next': record.number_next_actual or 0}) + record.write({'number_next': record.number_next_actual or 1}) name = fields.Char(required=True) code = fields.Char('Sequence Code') From 22f8660e2211fd84f84f530cfed29a594a228a02 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 11 Dec 2017 16:47:53 +0100 Subject: [PATCH 2/2] [FIX] stock: don't propagate cancel when chained move is done When you have e.g. an SO with a product MTO generating a manufacturing order, and you put the delivery order to done, before the MO is done, you can not cancel the MO anymore, because the cancel method checks if the move is not done (and raises an error). As the user stays blocked in this case, it is better to just not try to cancel the destination move by not propagating the cancel when the destination move is done. opw-786571 --- addons/stock/stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d95e34eca3b..45fe1e380d9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2532,7 +2532,8 @@ class stock_move(osv.osv): else: if move.move_dest_id: if move.propagate: - self.action_cancel(cr, uid, [move.move_dest_id.id], context=context) + if move.move_dest_id.state not in ('done', 'cancel'): + self.action_cancel(cr, uid, [move.move_dest_id.id], context=context) elif move.move_dest_id.state == 'waiting': #If waiting, the chain will be broken and we are not sure if we can still wait for it (=> could take from stock instead) self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)