[REF] stock_dropshipping: adapt tests to new stock implementation

lifo_price.yml:
    - change the cost method to fifo, as real price does not exist
      anymore
    - do not check the standard price, as it is not update on the
      product in fifo
    - correct calls to picking
    - end the test by checking the value of the out move
    - note: testing the lifo removal strategy has not effect here (we
      could adapt the test to set lot on receipt and check that the
      right lot was taken, but we didn't to that here)
This commit is contained in:
Simon Lejeune
2017-07-14 17:08:22 +02:00
parent 6337ddd496
commit 106c34b8d5
3 changed files with 25 additions and 32 deletions
@@ -88,19 +88,19 @@
# Check the two purchase order lines
purchase_line = purchases[0].order_line[0]
assert purchase_line.product_qty == 29.0, 'The product quantity of the first order line should be 5 and not %s' % (purchase_line.product_qty,)
assert purchase_line.product_qty == 29.0, 'The product quantity of the first order line should be 29 and not %s' % (purchase_line.product_qty,)
assert purchase_line.product_uom.id == ref("product.product_uom_unit"), 'The product UoM ID of the first order line should be %s and not %s' % (ref("product.product_uom_unit"), purchase_line.product_uom.id,)
# Cancel the Sales Order 2
so2.order_line[0].procurement_ids[0].cancel()
assert so2.order_line[0].procurement_ids[0].state == u'cancel', 'Procurement 2 should be cancelled !'
assert purchase_line.product_qty == 5.0, 'The product quantity of the first order line should be 5 and not %s' % (purchase_line.product_qty,)
assert so2.order_line[0].procurement_ids[0].state == u'cancel', 'Procurement 2 should not be cancelled !'
assert purchase_line.product_qty == 29.0, 'The product quantity of the first order line should be 29 and not %s' % (purchase_line.product_qty,)
# Cancel the Sales Order 1
so1.order_line[0].procurement_ids[0].cancel()
assert so1.order_line[0].procurement_ids[0].state == u'cancel', 'Procurement 1 should be cancelled !'
assert len(purchases.order_line) == 0, 'The PO line should have been unlinked!'
assert so1.order_line[0].procurement_ids[0].state == u'cancel', 'Procurement 1 should not be cancelled !'
assert len(purchases.order_line) == 1, 'The PO line should not have been unlinked since the pick does not cancel the delivery nor the purchase!'
# Check that all procurements related are cancelled
for procu in procus:
assert procu.state == u'cancel', 'Procurement %d should be cancelled but is with a state : %s!' %(procu.id, procu.state)
assert procu.state in (u'running', u'cancel'), 'Procurement %d should not be in an exception state : %s!' %(procu.id, procu.state)
+7 -7
View File
@@ -67,12 +67,12 @@
po = self.env['purchase.order'].search([('partner_id', '=', ref('supplier_dropship'))])
assert po.ids and len(po.ids) == 1, 'Problem with the Purchase Order detected'
pickings = po[0].picking_ids
pickings.do_transfer()
pickings.move_lines.quantity_done = pickings.move_lines.product_qty
pickings.button_validate()
-
Check one quant was created in Customers location with 200 pieces and one move in the history_ids
Check one move line was created in Customers location with 200 pieces
-
!python {model: stock.quant, id: False}: |
quants = self.search([('location_id', '=', ref('stock.stock_location_customers')), ('product_id', '=', ref("drop_shop_product"))])
assert quants, 'No Quant found'
assert len(quants.ids) == 1, 'There should be exactly one quant'
assert len(quants[0].history_ids) == 1, 'The quant should have exactly 1 move in its history'
!python {model: stock.pack.operation, id: False}: |
move_line = self.search([('location_dest_id', '=', ref('stock.stock_location_customers')), ('product_id', '=', ref("drop_shop_product"))])
assert move_line, 'No move line found'
assert len(move_line.ids) == 1, 'There should be exactly one move line'
+12 -19
View File
@@ -23,7 +23,7 @@
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
valuation: real_time
cost_method: real
cost_method: fifo
property_stock_account_input: o_expense
property_stock_account_output: o_income
description: LIFO Ice Cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
@@ -65,13 +65,9 @@
Process the receipt of purchase order 1
-
!python {model: purchase.order, id: purchase_order_lifo1}: |
self.picking_ids[0].do_transfer()
-
Check the standard price of the product (lifo icecream)
-
!python {model: product.product, id: product_lifo_icecream}: |
assert self.standard_price == 70.0, 'Standard price should not have changed!'
-
self.picking_ids[0].move_lines.quantity_done = self.picking_ids[0].move_lines.product_qty
self.picking_ids[0].button_validate()
-
I confirm the second purchase order
-
!python {model: purchase.order, id: purchase_order_lifo2}: |
@@ -80,13 +76,9 @@
Process the receipt of purchase order 2
-
!python {model: purchase.order, id: purchase_order_lifo2}: |
self.picking_ids[0].do_transfer()
-
Check the standard price should not have changed
-
!python {model: product.product, id: product_lifo_icecream}: |
assert self.standard_price == 70.0, 'Standard price as lifo price of second receipt incorrect!'
-
self.picking_ids[0].move_lines.quantity_done = self.picking_ids[0].move_lines.product_qty
self.picking_ids[0].button_validate()
-
Let us send some goods
-
!record {model: stock.picking, id: outgoing_lifo_shipment}:
@@ -107,13 +99,14 @@
-
!python {model: stock.picking, id: outgoing_lifo_shipment}: |
self.action_assign()
self.move_lines.quantity_done = self.move_lines.product_qty
-
Process the delivery of the outgoing shipment
-
!python {model: stock.picking, id: outgoing_lifo_shipment}: |
self.do_transfer()
self.button_validate()
-
Check standard price became 80 euro
Check if the move value correctly reflects the fifo costing method
-
!python {model: product.product, id: product_lifo_icecream}: |
assert self.standard_price == 80.0, 'Price should have been 80 euro'
!python {model: stock.picking, id: outgoing_lifo_shipment}: |
assert self.move_lines.value == -1400.0, 'Stock move value should have been 1400 euro'