[IMP]purchase: Improve the test conditions at the time of confirming RFQ

bzr revid: dbr@tinyerp.com-20111014062738-sughj2gebjjyocdn
This commit is contained in:
DBR (OpenERP) 2011-10-14 11:57:38 +05:30
parent 2263b61d4a
commit ac9f6ef2ba
1 changed files with 37 additions and 7 deletions

View File

@ -14,7 +14,7 @@
-
!workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase1}
-
I check that the order which was initially in the draft state has transit to confirm state.
I check the created Purchase order.
-
!assert {model: purchase.order, id: order_purchase1}:
- state == 'approved'
@ -22,19 +22,49 @@
I check that the purchase order has now a corresponding invoice
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase has now a corresponding invoice, severity: fatal}:
- bool(invoice_ids)
- len(invoice_ids) == 1
-
Test purchase's invoice has the same amount and is currently a draft
I check that the purchase's invoice is currently in draft state.
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase's invoice has the same amount and is currently a draft}:
- invoice_ids[0].state == 'draft'
-
I check that the purchase order has now a corresponding picking
I check that the purchase order has now a corresponding invoice details
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase has now a corresponding picking, severity: fatal}:
!python {model: purchase.order}: |
purchase_data = self.browse(cr, uid, ref("order_purchase1"))
for line in self.pool.get('account.invoice').browse(cr, uid, [purchase_data.invoice_ids[0].id]):
assert line.name == purchase_data.name, "Invoice name is not correspond with purchase order"
assert line.amount_untaxed == purchase_data.amount_untaxed, "Invoice untaxed amount is not correspond with purchase order"
assert line.amount_tax == purchase_data.amount_tax, "Invoice tax amount is not correspond with purchase order"
assert line.amount_total == purchase_data.amount_total, "Invoice total amount is not correspond with purchase order"
assert line.partner_id == purchase_data.partner_id, "Invoice supplier is not correspond with purchase order"
assert line.invoice_line[0].product_id == purchase_data.order_line[0].product_id, "Invoice product is not correspond with purchase order"
assert line.invoice_line[1].product_id == purchase_data.order_line[1].product_id, "Invoice product is not correspond with purchase order"
assert line.invoice_line[0].price_unit == purchase_data.order_line[0].price_unit, "Invoice unit price is not correspond with purchase order"
assert line.invoice_line[1].price_unit == purchase_data.order_line[1].price_unit, "Invoice unit price is not correspond with purchase order"
-
I check that the purchase order has now a corresponding Reception.
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase has now a corresponding Reception, severity: fatal}:
- len(picking_ids) == 1
-
I check that the purchase's picking will be sent to the good address
I check that the purchase order has now a corresponding Reception details
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase's picking will be sent to the good address, severity: error}:
!python {model: purchase.order}: |
purchase_data = self.browse(cr, uid, ref("order_purchase1"))
for line in self.pool.get('stock.picking').browse(cr, uid, [purchase_data.picking_ids[0].id]):
assert line.origin == purchase_data.name, "Reception origin is not correspond with purchase order"
assert line.move_lines[0].product_id == purchase_data.order_line[0].product_id, "Reception product is not correspond with purchase order"
assert line.move_lines[1].product_id == purchase_data.order_line[1].product_id, "Reception product is not correspond with purchase order"
assert line.move_lines[0].location_dest_id == purchase_data.location_id, "Reception location is not correspond with purchase order"
assert line.move_lines[0].product_uom == purchase_data.order_line[0].product_uom, "Reception uom is not correspond with purchase order"
assert line.move_lines[1].product_uom == purchase_data.order_line[1].product_uom, "Reception uom is not correspond with purchase order"
assert line.move_lines[0].product_qty == purchase_data.order_line[0].product_qty, "Reception qty is not correspond with purchase order"
assert line.move_lines[1].product_qty == purchase_data.order_line[1].product_qty, "Reception qty is not correspond with purchase order"
-
I check that the purchase's reception will be sent to the good address
-
!assert {model: purchase.order, id: order_purchase1, string: Test purchase's reception will be sent to the good address, severity: error}:
- picking_ids[0].address_id == partner_address_id