From c71a451026ce46bb8fb6d22a650843cb015ad7cd Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Wed, 10 Sep 2014 11:10:02 +0200 Subject: [PATCH] Add test for invoice based on shipment with partial delivery issue4003 review5581002 --- tests/scenario_purchase.rst | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/scenario_purchase.rst b/tests/scenario_purchase.rst index e19a303a3d..81fa1f4771 100644 --- a/tests/scenario_purchase.rst +++ b/tests/scenario_purchase.rst @@ -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'