Add pending, awaiting payement and partially paid to invoice state
Closes #12005
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add pending, awaiting payment and partially paid to invoice state
|
||||
* Remove support for Python 3.7
|
||||
* Add support for Python 3.11
|
||||
* Add related stock moves and invoice lines on purchase line
|
||||
|
||||
@@ -171,7 +171,9 @@ class Purchase(
|
||||
], 'Invoice Method', required=True, states=_states)
|
||||
invoice_state = fields.Selection([
|
||||
('none', 'None'),
|
||||
('waiting', 'Waiting'),
|
||||
('pending', "Pending"),
|
||||
('awaiting payment', "Awaiting Payment"),
|
||||
('partially paid', "Partially Paid"),
|
||||
('paid', 'Paid'),
|
||||
('exception', 'Exception'),
|
||||
], 'Invoice State', readonly=True, required=True, sort=False)
|
||||
@@ -377,6 +379,11 @@ class Purchase(
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
# Migration from 6.6: rename invoice state waiting to pending
|
||||
cursor.execute(*sql_table.update(
|
||||
[sql_table.invoice_state], ['pending'],
|
||||
where=sql_table.invoice_state == 'waiting'))
|
||||
|
||||
@classmethod
|
||||
def order_number(cls, tables):
|
||||
table, _ = tables[None]
|
||||
@@ -601,8 +608,12 @@ class Purchase(
|
||||
return 'exception'
|
||||
elif all(i.state == 'paid' for i in invoices):
|
||||
return 'paid'
|
||||
elif any(i.state == 'paid' for i in invoices):
|
||||
return 'partially paid'
|
||||
elif any(i.state == 'posted' for i in invoices):
|
||||
return 'awaiting payment'
|
||||
else:
|
||||
return 'waiting'
|
||||
return 'pending'
|
||||
return 'none'
|
||||
|
||||
get_shipments = get_shipments_returns('stock.shipment.in')
|
||||
|
||||
@@ -182,7 +182,7 @@ Purchase 5 products::
|
||||
>>> purchase.shipment_state
|
||||
'waiting'
|
||||
>>> purchase.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> len(purchase.moves), len(purchase.shipment_returns), len(purchase.invoices)
|
||||
(2, 0, 1)
|
||||
>>> invoice, = purchase.invoices
|
||||
@@ -219,7 +219,7 @@ Post invoice and check no new invoices::
|
||||
>>> purchase.shipment_state
|
||||
'waiting'
|
||||
>>> purchase.invoice_state
|
||||
'waiting'
|
||||
'awaiting payment'
|
||||
>>> len(purchase.moves), len(purchase.shipment_returns), len(purchase.invoices)
|
||||
(2, 0, 1)
|
||||
|
||||
@@ -284,7 +284,7 @@ Validate Shipments::
|
||||
Open supplier invoice::
|
||||
|
||||
>>> purchase.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> invoice.type
|
||||
'in'
|
||||
@@ -367,7 +367,7 @@ Check Return Shipments::
|
||||
>>> return_.shipment_state
|
||||
'received'
|
||||
>>> return_.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
|
||||
Open supplier credit note::
|
||||
|
||||
@@ -406,7 +406,7 @@ Mixing return and purchase::
|
||||
>>> mix.shipment_state
|
||||
'waiting'
|
||||
>>> mix.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> len(mix.moves), len(mix.shipment_returns), len(mix.invoices)
|
||||
(2, 1, 1)
|
||||
|
||||
@@ -518,7 +518,7 @@ Purchase services::
|
||||
>>> service_purchase.shipment_state
|
||||
'none'
|
||||
>>> service_purchase.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> service_invoice, = service_purchase.invoices
|
||||
|
||||
Pay the service invoice::
|
||||
|
||||
@@ -115,7 +115,7 @@ Confirm purchase::
|
||||
>>> purchase.click('quote')
|
||||
>>> purchase.click('confirm')
|
||||
>>> purchase.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> purchase.shipment_state
|
||||
'waiting'
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Add pending, awaiting payment and partially paid to invoice state
|
||||
* Remove support for Python 3.7
|
||||
* Add support for Python 3.11
|
||||
* Add related stock moves and invoice lines on sale line
|
||||
|
||||
+13
-2
@@ -199,7 +199,9 @@ class Sale(
|
||||
invoice_method_string = invoice_method.translated('invoice_method')
|
||||
invoice_state = fields.Selection([
|
||||
('none', 'None'),
|
||||
('waiting', 'Waiting'),
|
||||
('pending', "Pending"),
|
||||
('awaiting payment', "Awaiting Payment"),
|
||||
('partially paid', "Partially Paid"),
|
||||
('paid', 'Paid'),
|
||||
('exception', 'Exception'),
|
||||
], 'Invoice State', readonly=True, required=True, sort=False)
|
||||
@@ -377,6 +379,11 @@ class Sale(
|
||||
[sql_table.state], ['cancelled'],
|
||||
where=sql_table.state == 'cancel'))
|
||||
|
||||
# Migration from 6.6: rename invoice state waiting to pending
|
||||
cursor.execute(*sql_table.update(
|
||||
[sql_table.invoice_state], ['pending'],
|
||||
where=sql_table.invoice_state == 'waiting'))
|
||||
|
||||
@classmethod
|
||||
def order_number(cls, tables):
|
||||
table, _ = tables[None]
|
||||
@@ -611,8 +618,12 @@ class Sale(
|
||||
return 'exception'
|
||||
elif all(i.state == 'paid' for i in invoices):
|
||||
return 'paid'
|
||||
elif any(i.state == 'paid' for i in invoices):
|
||||
return 'partially paid'
|
||||
elif any(i.state == 'posted' for i in invoices):
|
||||
return 'awaiting payment'
|
||||
else:
|
||||
return 'waiting'
|
||||
return 'pending'
|
||||
return 'none'
|
||||
|
||||
get_shipments = get_shipments_returns('stock.shipment.out')
|
||||
|
||||
@@ -172,7 +172,7 @@ Sale 5 products::
|
||||
>>> sale.shipment_state
|
||||
'waiting'
|
||||
>>> sale.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
||||
(1, 0, 1)
|
||||
>>> invoice, = sale.invoices
|
||||
@@ -210,6 +210,8 @@ Post invoice and check no new invoices::
|
||||
>>> sale.reload()
|
||||
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
||||
(1, 0, 1)
|
||||
>>> sale.invoice_state
|
||||
'awaiting payment'
|
||||
|
||||
Testing the report::
|
||||
|
||||
@@ -273,7 +275,7 @@ Open customer invoice::
|
||||
|
||||
>>> sale.reload()
|
||||
>>> sale.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> invoice, = sale.invoices
|
||||
>>> invoice.type
|
||||
'out'
|
||||
@@ -315,7 +317,7 @@ Sale 5 products with shipment method 'on invoice'::
|
||||
>>> sale.shipment_state
|
||||
'none'
|
||||
>>> sale.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices)
|
||||
(0, 0, 1)
|
||||
|
||||
@@ -426,7 +428,7 @@ Check Return::
|
||||
>>> return_.shipment_state
|
||||
'waiting'
|
||||
>>> return_.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> (len(return_.shipments), len(return_.shipment_returns),
|
||||
... len(return_.invoices))
|
||||
(0, 2, 1)
|
||||
@@ -459,7 +461,7 @@ Check Return::
|
||||
>>> return_.shipment_state
|
||||
'sent'
|
||||
>>> return_.invoice_state
|
||||
'waiting'
|
||||
'awaiting payment'
|
||||
>>> (len(return_.shipments), len(return_.shipment_returns),
|
||||
... len(return_.invoices))
|
||||
(0, 2, 2)
|
||||
@@ -489,7 +491,7 @@ Mixing return and sale::
|
||||
>>> mix.shipment_state
|
||||
'waiting'
|
||||
>>> mix.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> len(mix.shipments), len(mix.shipment_returns), len(mix.invoices)
|
||||
(1, 1, 1)
|
||||
|
||||
@@ -589,7 +591,7 @@ Sale services::
|
||||
>>> service_sale.shipment_state
|
||||
'none'
|
||||
>>> service_sale.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> service_invoice, = service_sale.invoices
|
||||
|
||||
Pay the service invoice::
|
||||
@@ -691,6 +693,9 @@ invoices::
|
||||
>>> invoice.reload()
|
||||
>>> invoice.state
|
||||
'paid'
|
||||
>>> sale.reload()
|
||||
>>> sale.invoice_state
|
||||
'partially paid'
|
||||
>>> invoice_line.reload()
|
||||
>>> stock_move, = invoice_line.stock_moves
|
||||
>>> stock_move.quantity
|
||||
|
||||
@@ -102,7 +102,7 @@ Confirm sale::
|
||||
>>> sale.click('quote')
|
||||
>>> sale.click('confirm')
|
||||
>>> sale.invoice_state
|
||||
'waiting'
|
||||
'pending'
|
||||
>>> sale.shipment_state
|
||||
'waiting'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user