Do not consider purchase as done when invoice or shipment state are none
If there are still line to invoice or to receive, the purchase should not be done. Closes #12594
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user