Skip to content
Permalink
Browse files

[IMP] purchase_stock: Add test case for create different picking when…

… different location on purchase order line

Task ID : #1915336
  • Loading branch information...
dpa-odoo authored and kic-odoo committed Dec 14, 2018
1 parent 5336976 commit 3b7dc991a4826ddf9775b269094851a80b1bf7dd
Showing with 37 additions and 0 deletions.
  1. +37 −0 addons/purchase_stock/tests/test_create_picking.py
@@ -313,3 +313,40 @@ def test_04_mto_multiple_po(self):
purchase_order_2.picking_ids.button_validate()

self.assertEqual(sum(customer_picking.move_lines.mapped('reserved_availability')), 100.0, 'The total quantity for the customer move should be available and reserved.')

def test_05_create_picking_diff_location(self):
stock_location = self.env['ir.model.data'].xmlid_to_object('stock.stock_location_stock')
input_location = self.env['ir.model.data'].xmlid_to_object('stock.stock_location_company')

self.po_vals = {
'partner_id': self.partner_id.id,
'order_line': [
(0, 0, {
'name': self.product_id_1.name,
'product_id': self.product_id_1.id,
'product_qty': 5.0,
'product_uom': self.product_id_1.uom_po_id.id,
'price_unit': 500.0,
'location_dest_id': stock_location.id,
'date_planned': datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT),
}),
(0, 0, {
'name': self.product_id_2.name,
'product_id': self.product_id_2.id,
'product_qty': 5.0,
'product_uom': self.product_id_2.uom_po_id.id,
'price_unit': 250.0,
'location_dest_id': input_location.id,
'date_planned': datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT),
})],
}

# Draft purchase order created
self.po = self.env['purchase.order'].create(self.po_vals)
self.assertTrue(self.po, 'Purchase: no purchase order created')

# Purchase order confirm
self.po.button_confirm()

self.assertEqual(self.po.state, 'purchase', 'Purchase: PO state should be "Purchase')
self.assertEqual(self.po.picking_count, 2, 'Purchase: Two picking should be created')

0 comments on commit 3b7dc99

Please sign in to comment.
You can’t perform that action at this time.