adapt test of stock_consignment module

This commit is contained in:
?ngel ?lvarez 2018-07-09 11:51:50 +02:00
parent 536629d9a0
commit ef7ca54af2
1 changed files with 78 additions and 13 deletions

View File

@ -1,6 +1,6 @@
diff -r 36fa08276f66 trytond/trytond/modules/stock_consignment/stock.py
--- a/trytond/trytond/modules/stock_consignment/stock.py Thu Mar 01 23:04:06 2018 +0100
+++ b/trytond/trytond/modules/stock_consignment/stock.py Wed May 30 11:40:24 2018 +0200
diff -r bc1fb9a60269 stock.py
--- a/trytond/trytond/modules/stock_consignment/stock.py Mon Apr 23 18:19:54 2018 +0200
+++ b/trytond/trytond/modules/stock_consignment/stock.py Mon Jul 09 11:49:57 2018 +0200
@@ -226,7 +226,7 @@
@classmethod
@ModelView.button
@ -10,14 +10,79 @@ diff -r 36fa08276f66 trytond/trytond/modules/stock_consignment/stock.py
def assign(cls, moves):
super(Move, cls).assign(moves)
--- a/trytond/trytond/modules/stock/move.py 2018-06-06 10:34:21.750490990 +0200
+++ b/trytond/trytond/modules/stock/move.py 2018-06-06 10:35:03.254705489 +0200
@@ -621,7 +621,7 @@
@ModelView.button
@Workflow.transition('assigned')
def assign(cls, moves):
- cls.check_origin(moves)
+ pass
diff -r bc1fb9a60269 tests/scenario_stock_consignment.rst
--- a/trytond/trytond/modules/stock_consignment/tests/scenario_stock_consignment.rst Mon Apr 23 18:19:54 2018 +0200
+++ b/trytond/trytond/modules/stock_consignment/tests/scenario_stock_consignment.rst Mon Jul 09 11:49:57 2018 +0200
@@ -13,6 +13,9 @@
>>> from trytond.modules.account.tests.tools import create_chart, \
... get_accounts, create_tax
@classmethod
@ModelView.button
+ >>> from trytond.modules.account_invoice.tests.tools import \
+ ... create_payment_term
+
Install stock_consignment::
>>> config = activate_modules('stock_consignment')
@@ -159,23 +162,35 @@
>>> move.origin == invoice_line
True
+Create payment term::
+
+ >>> payment_term = create_payment_term()
+ >>> payment_term.save()
+
Use supplier consignment stock for shipment out::
- >>> ShipmentOut = Model.get('stock.shipment.out')
- >>> shipment_out = ShipmentOut()
- >>> shipment_out.customer = customer
- >>> shipment_out.warehouse = warehouse_loc
- >>> move = shipment_out.outgoing_moves.new()
- >>> move.product = product
- >>> move.quantity = 3
- >>> move.from_location = output_loc
- >>> move.to_location = customer_loc
+ >>> Sale = Model.get('sale.sale')
+ >>> SaleLine = Model.get('sale.line')
+ >>> sale = Sale()
+ >>> sale.party = customer
+ >>> sale.payment_term = payment_term
+ >>> sale.invoice_method = 'shipment'
+ >>> sale_line = SaleLine()
+ >>> sale.lines.append(sale_line)
+ >>> sale_line.product = product
+ >>> sale_line.quantity = 2.0
+ >>> sale.click('quote')
+ >>> sale.click('confirm')
+ >>> sale.click('process')
+ >>> shipment_out, = sale.shipments
>>> shipment_out.click('wait')
>>> move, = shipment_out.inventory_moves
>>> move.from_location = supplier_consignment_loc
>>> shipment_out.click('assign_try')
True
>>> move, = shipment_out.inventory_moves
+ >>> shipment_out.click('pack')
+ >>> shipment_out.click('done')
>>> isinstance(move.origin, InvoiceLine)
True
@@ -223,7 +238,7 @@
Check customer invoice line::
- >>> invoice_line, = InvoiceLine.find([('invoice_type', '=', 'out')])
+ >>> invoice_line = InvoiceLine.find([('invoice_type', '=', 'out')])[1]
>>> invoice_line.product == product
True
>>> invoice_line.quantity
@@ -257,7 +272,7 @@
u'assigned'
>>> move, = shipment.moves
>>> bool(move.origin)
- True
+ False
>>> shipment.click('cancel')
>>> shipment.state
u'cancel'