diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index c00b5ab8b5..602f58d951 100644 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -827,11 +827,13 @@ class Purchase( def is_done(self): return ((self.invoice_state == 'paid' - or self.invoice_state == 'none') + or (self.invoice_state == 'none' + and all(not l.quantity + for l in self.lines if l.type == 'line'))) and (self.shipment_state == 'received' - or self.shipment_state == 'none' - or all(l.product.type == 'service' - for l in self.lines if l.product))) + or (self.shipment_state == 'none' + and all(l.product.type == 'service' + for l in self.lines if l.product)))) @classmethod def delete(cls, purchases): diff --git a/modules/purchase/tests/scenario_purchase_manual_invoice.rst b/modules/purchase/tests/scenario_purchase_manual_invoice.rst index 168840b693..de1b1be9b9 100644 --- a/modules/purchase/tests/scenario_purchase_manual_invoice.rst +++ b/modules/purchase/tests/scenario_purchase_manual_invoice.rst @@ -68,7 +68,7 @@ Purchase with manual invoice method:: >>> purchase.click('quote') >>> purchase.click('confirm') >>> purchase.state - 'done' + 'processing' >>> purchase.invoice_state 'none' >>> len(purchase.invoices)