Add test for invoice based on shipment with partial delivery
issue4003 review5581002
This commit is contained in:
1 parent
854086236a
commit
c71a451026
1 file changed
+71
@@ -605,3 +605,74 @@ Check service purchase states::
|
||||
u'none'
|
||||
>>> service_purchase.state
|
||||
u'done'
|
||||
|
||||
Create a purchase to be invoiced on shipment partialy and check correctly
|
||||
linked to invoices::
|
||||
|
||||
>>> purchase = Purchase()
|
||||
>>> purchase.party = supplier
|
||||
>>> purchase.payment_term = payment_term
|
||||
>>> purchase.invoice_method = 'shipment'
|
||||
>>> line = purchase.lines.new()
|
||||
>>> line.product = product
|
||||
>>> line.quantity = 10.0
|
||||
>>> purchase.click('quote')
|
||||
>>> purchase.click('confirm')
|
||||
>>> purchase.click('process')
|
||||
>>> config.user = stock_user.id
|
||||
>>> shipment = ShipmentIn()
|
||||
>>> shipment.supplier = supplier
|
||||
>>> for move in purchase.moves:
|
||||
... incoming_move = Move(id=move.id)
|
||||
... incoming_move.quantity = 5.0
|
||||
... shipment.incoming_moves.append(incoming_move)
|
||||
>>> shipment.save()
|
||||
>>> for move in shipment.inventory_moves:
|
||||
... move.quantity = 5.0
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.click('done')
|
||||
>>> config.user = purchase_user.id
|
||||
>>> purchase.reload()
|
||||
>>> invoice, = purchase.invoices
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.quantity
|
||||
5.0
|
||||
>>> stock_move, = invoice_line.stock_moves
|
||||
>>> stock_move.quantity
|
||||
5.0
|
||||
>>> stock_move.state
|
||||
u'done'
|
||||
|
||||
Create a sale to be sent on invoice partialy and check correctly linked to
|
||||
invoices::
|
||||
|
||||
>>> sale = Sale()
|
||||
>>> sale.party = customer
|
||||
>>> sale.payment_term = payment_term
|
||||
>>> sale.shipment_method = 'invoice'
|
||||
>>> line = sale.lines.new()
|
||||
>>> line.product = product
|
||||
>>> line.quantity = 10.0
|
||||
>>> sale.click('quote')
|
||||
>>> sale.click('confirm')
|
||||
>>> sale.click('process')
|
||||
>>> invoice, = sale.invoices
|
||||
>>> config.user = account_user.id
|
||||
>>> invoice_line, = invoice.lines
|
||||
>>> invoice_line.stock_moves == []
|
||||
True
|
||||
>>> invoice_line.quantity = 5.0
|
||||
>>> invoice.click('post')
|
||||
>>> pay = Wizard('account.invoice.pay', [invoice])
|
||||
>>> pay.form.journal = cash_journal
|
||||
>>> pay.execute('choice')
|
||||
>>> invoice.reload()
|
||||
>>> invoice.state
|
||||
u'paid'
|
||||
>>> config.user = sale_user.id
|
||||
>>> invoice_line.reload()
|
||||
>>> stock_move, = invoice_line.stock_moves
|
||||
>>> stock_move.quantity
|
||||
5.0
|
||||
>>> stock_move.state
|
||||
u'draft'
|
||||
Reference in new issue
Block a user