[FIX] purchase: confirm only draft/sent PO

Without this fix, it is possible to confirm a PO which is not in state
'draft' and 'sent'. The issue is that it will create a picking at every
call.

The issue was occurring in Purchase Requisition, which was fixed in
previous commit. However, it makes sense to add a check directly in the
`button_confirm` method.

opw-684347
This commit is contained in:
Nicolas Martinelli
2016-08-04 10:08:15 +02:00
parent 2bc65af189
commit efdce58913
+2
View File
@@ -281,6 +281,8 @@ class PurchaseOrder(models.Model):
@api.multi
def button_confirm(self):
for order in self:
if order.state not in ['draft', 'sent']:
continue
order._add_supplier_to_product()
# Deal with double validation process
if order.company_id.po_double_validation == 'one_step'\