[IMP]sale :

Improve yml code on the bases of different order_type

bzr revid: dbr@tinyerp.com-20111103100220-bsacub1b6dthcbj7
This commit is contained in:
DBR (OpenERP)
2011-11-03 15:32:20 +05:30
parent 75145a7a3d
commit d9077030a2
2 changed files with 47 additions and 29 deletions
+3 -1
View File
@@ -37,7 +37,7 @@
<field name="type">make_to_stock</field>
</record>
<record id="line13" model="sale.order.line">
<field name="order_id" ref="order4"/>
<field name="order_id" ref="order"/>
<field name="name">[PC3] Medium PC</field>
<field name="product_id" ref="product.product_product_pc3"/>
<field name="product_uom" ref="product.product_uom_unit"/>
@@ -67,6 +67,7 @@
<field name="partner_invoice_id" ref="base.res_partner_address_9"/>
<field name="partner_shipping_id" ref="base.res_partner_address_9"/>
<field name="partner_order_id" ref="base.res_partner_address_9"/>
<field name="order_policy">picking</field>
</record>
<!--Resource: sale.order.line-->
@@ -100,6 +101,7 @@
<field name="partner_invoice_id" ref="base.res_partner_address_8"/>
<field name="partner_shipping_id" ref="base.res_partner_address_8"/>
<field name="partner_order_id" ref="base.res_partner_address_8"/>
<field name="order_policy">prepaid</field>
</record>
<record id="line5" model="sale.order.line">
<field name="order_id" ref="order3"/>
@@ -1,34 +1,51 @@
-
In order to test the Sale order flow, I compute the total of the listed products.
In order to test the Sale order flow, I compute the total of the listed products for Quotation1.
"New server config + material" product price is 123.20 and ordered 1 'PCE'
"Basic PC" product price is 450.50 and ordered 3 'PCE'
"Medium PC" product price is 900 and ordered 5 'PCE'
"Mainboard ASUStek A7N8X" product price is 88 and ordered 5 'PCE'
So, Total should be [(123.20*1)+(450.50*3)+(900*5)+(88*5)] = 6414.70
-
I check the total untaxed amount of the Quotation is correctly computed
I check the total untaxed amount of the Quotation1 is correctly computed
-
!assert {model: sale.order, id: order, string: The amount of the Quotation is not correctly computed}:
- sum([l.price_subtotal for l in order_line]) == amount_untaxed
-
I confirm the Quotation.
I confirm the Quotation1.
-
!workflow {model: sale.order, action: order_confirm, ref: order}
-
I check the "In Progress" status after confirmed Quotation.
I confirm the Quotation2.
-
!assert {model: sale.order, id: order}:
- state == 'progress'
!workflow {model: sale.order, action: order_confirm, ref: order2}
-
I check that Packing details after confirmed Quotation.
I confirm the Quotation3.
-
!workflow {model: sale.order, action: order_confirm, ref: order3}
-
I confirm the Quotation4.
-
!workflow {model: sale.order, action: order_confirm, ref: order4}
-
After confirmed Quotation, I check the Packing as well as Invoice created in related sale orders .
-
!python {model: sale.order}: |
sale_order1 = self.browse(cr, uid, ref("order"))
sale_order2 = self.browse(cr, uid, ref("order2"))
sale_order3 = self.browse(cr, uid, ref("order3"))
sale_order4 = self.browse(cr, uid, ref("order4"))
assert sale_order1.picking_ids, "Picking not created for sale order1"
assert sale_order4.picking_ids, "Picking not created for sale order4"
assert sale_order2.picking_ids, "Picking not created for sale order2"
assert sale_order3.invoice_ids, "Invoice not created for sale order3"
-
I check that Packing details after confirmed Quotation1.
-
!python {model: sale.order}: |
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
sale_order = self.browse(cr, uid, ref("order"))
assert len(sale_order.picking_ids) >= 1, "Packing should be one"
for picking in sale_order.picking_ids:
assert picking.state == "auto" or "confirmed", "Packing state should be in waitting state"
assert picking.origin == sale_order.name,"Packing Name is not correspond with sale order"
@@ -39,22 +56,21 @@
assert picking.note == sale_order.note,"Notes is not correspond with sale order"
assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice state is not correspond with sale order"
assert picking.company_id.id == sale_order.company_id.id,"Company is not correspond with sale order"
for index in range(0,len(picking.move_lines)):
location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
date_planned = datetime.strptime(sale_order.date_order, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=sale_order.order_line[index].delay or 0.0)
date_planned = (date_planned - timedelta(days=sale_order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
assert picking.move_lines[index].name == sale_order.order_line[index].name[:64],"Name is not correspond"
assert picking.move_lines[index].product_id.id == sale_order.order_line[index].product_id.id,"Product is not correspond"
assert picking.move_lines[index].date == date_planned,"Plane date is not correspond"
assert picking.move_lines[index].date_expected == date_planned,"Expected date is not correspond"
assert picking.move_lines[index].product_qty == sale_order.order_line[index].product_uom_qty,"Product Quantity is not correspond"
assert picking.move_lines[index].product_uom.id == sale_order.order_line[index].product_uom.id,"Product UOM is not correspond"
assert picking.move_lines[index].product_uos_qty == sale_order.order_line[index].product_uos_qty,"Product UOS Quantity is not correspond"
assert picking.move_lines[index].product_uos == (sale_order.order_line[index].product_uos and sale_order.order_line[index].product_uos.id) or sale_order.order_line[index].product_uom.id,"Product UOS is not correspond"
assert picking.move_lines[index].product_packaging.id == sale_order.order_line[index].product_packaging.id,"Product packaging is not correspond"
assert picking.move_lines[index].address_id.id == sale_order.order_line[index].address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
assert picking.move_lines[index].location_id.id == location_id,"Source Location is not correspond"
assert picking.move_lines[index].note == sale_order.order_line[index].notes,"Notes is not correspond"
assert picking.move_lines[index].company_id.id == sale_order.company_id.id,"Company is not correspond"
assert picking.move_lines[index].price_unit == sale_order.order_line[index].product_id.standard_price or 0.0,"Price Unit is not correspond"
location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
for move in picking.move_lines:
for order in sale_order.order_line:
if move.name == order.name:
assert move.name == order.name[:64],"Name is not correspond"
assert move.product_id.id == order.product_id.id,"Product is not correspond"
assert move.product_qty == order.product_uom_qty,"Product Quantity is not correspond"
assert move.product_uom.id == order.product_uom.id,"Product UOM is not correspond"
assert move.product_uos_qty == order.product_uos_qty,"Product UOS Quantity is not correspond"
assert move.product_uos == (order.product_uos and order.product_uos.id) or order.product_uom.id,"Product UOS is not correspond"
assert move.product_packaging.id == order.product_packaging.id,"Product packaging is not correspond"
assert move.address_id.id == order.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
assert move.location_id.id == location_id,"Source Location is not correspond"
assert move.note == order.notes,"Notes is not correspond"
assert move.company_id.id == sale_order.company_id.id,"Company is not correspond"
assert move.price_unit == order.product_id.standard_price or 0.0,"Price Unit is not correspond"