[IMP] improved yml for edi sale,purchase and account invoice
authorHardik Ansodariy (OpenERP) <han@tinyerp.com>
Thu, 15 Sep 2011 13:32:13 +0000 (19:02 +0530)
committerHardik Ansodariy (OpenERP) <han@tinyerp.com>
Thu, 15 Sep 2011 13:32:13 +0000 (19:02 +0530)
bzr revid: han@tinyerp.com-20110915133213-i67qac35o1q1rtyv

addons/account/test/test_edi_invoice.yml
addons/purchase/test/edi_purchase_order.yml
addons/sale/test/edi_sale_order.yml

index 29c7c62..843892a 100644 (file)
     assert invoice_new.reference_type == 'none', "reference type is not set to 'None'"
     assert invoice_new.internal_number == False, "internal number is not reset"
     assert invoice_new.journal_id.id, "journal id is not selected"
-    assert invoice_new.type == 'in_invoice', 'Imported in voice is not supplier invoice'
+    assert invoice_new.type == 'in_invoice', "Imported in voice is not supplier invoice"
+    assert invoice_new.amount_total == 1010.0, "Amount total is not same"
+    assert invoice_new.amount_tax == 1000.0, "Amount tax is not same"
+    assert invoice_new.amount_untaxes == 10.0, "Amount untaxed is not same"
     product = ['Medium PC','Basic PC']
     for inv_line in invoice_new.invoice_line:
         assert inv_line.account_id.id, "account_id is not taken from product's default"
-        assert inv_line.product_id.name in product, "product  is not in Invoice line"
+        assert inv_line.product_id.name in ['Medium PC','Basic PC'], "product  is not in Invoice line"
     for inv_tax in invoice_new.tax_line:
         assert inv_tax.manual, "for tax line manual is not set to True"
         assert inv_tax.account_id, "for tax_line default accounts is not picked based on the tax config of the DB where it is imported."
index ef3bbb4..a6dc45e 100644 (file)
         price_unit: 150.0
         name: 'basic pc'
         date_planned: '2011-08-31'
+    order_line:
+      - product_id: product.product_product_pc3
+        product_qty: 10.0
+        product_uom: 1
+        price_unit: 200.0
+        name: 'medium pc'
+        date_planned: '2011-08-31'
 -
-  I Open the sale order
+  I Open the Purchase order
 -
   !python {model: purchase.order}: |
     
             "__last_update": False, 
             "__id": "724f93ec-ddd0-11e0-88ec-701a04e25543:724f93ec-ddd0-11e0-88ec-701a04e25543:sale.sale_order_line-LXEqeuI-SSP0", 
             "product_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:product.product_product_pc1", "[PC1] Basic PC"]
+        },
+        {
+            "product_uom_qty": 10.0, 
+            "name": "medium pc", 
+            "product_uom": ["724f93ec-ddd0-11e0-88ec-701a04e25543:product.product_uom_unit", "PCE"], 
+            "sequence": 11, 
+            "price_unit": 200.0, 
+            "__last_update": False, 
+            "__id": "724f93ec-ddd0-11e0-88ec-701a04e25543:724f93ec-ddd0-11e0-88ec-701a04e25543:sale.sale_order_line-LXEqeuI-SSP0", 
+            "product_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:product.product_product_pc3", "[PC3] Medim PC"]
         }], 
         "order_policy": "manual", 
         "company_address": {
@@ -72,8 +89,8 @@
         "partner_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:sale.res_partner_test22", "Junjun wala"], 
         "__attachments": [], 
         "__module": "sale", 
-        "amount_total": 150.0, 
-        "amount_untaxed": 150.0, 
+        "amount_total": 350.0, 
+        "amount_untaxed": 350.0, 
         "name": "SO008", 
         "__model": "sale.order", 
         "__last_update": False, 
     }
     new_purchase_order_id = purchase_order_pool.edi_import(cr, uid, edi_document, context=context)
     assert new_purchase_order_id,  'Purchase order is not imported'
+
+-
+  I Checking the sale order become purchase order or not after import
+-
+  !python {model: sale.order}: |
+    
+    ids = self.search(cr, uid, [('partner_id','=','OpenERP S.A.')])
+    assert ids, 'Order does not have created of party'
+    order_new = self.browse(cr, uid, ids[0])
+    assert order_new.pricelist_id.name == 'Public Pricelist' , "Public Price list is not imported"
+    assert order_new.amount_total == 350, "Amount total is not same"
+    assert order_new.amount_untaxed == 350, "untaxed amount is not same"
+    for sale_line in order_new.order_line:
+        assert sale_line.name in ['basic pc','medium pc'], "name of product is not in order"
+        assert sale_line.product_id.name in ['Basic PC','Medium PC'], "name of product is not in order"
+        assert sale_line.date_order == '2011-09-13' , "date of order is not same"
index 1756f36..af1b32a 100644 (file)
         product_uom: 1
         price_unit: 150.0
         name: 'basic pc'
+    order_line:
+      - product_id: product.product_product_pc3
+        product_uom_qty: 10.0
+        product_uom: 1
+        price_unit: 200.0
+        name: 'medium pc'
 -
   I Open the sale order
 -
@@ -63,7 +69,7 @@
         "partner_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:purchase.res_partner_test20", "jones white"], 
         "__attachments": [], 
         "__module": "purchase", 
-        "amount_total": 150.0, 
+        "amount_total": 350.0, 
         "company_address": {
                 "phone": "(+32).81.81.37.00", 
                 "street": "Chaussee de Namur 40", 
@@ -73,7 +79,7 @@
                 "country_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:base.be", "Belgium"], 
                 "__id": "5af1272e-dd26-11e0-b65e-701a04e25543:base.main_address", 
         }, 
-        "amount_untaxed": 150.0, 
+        "amount_untaxed": 350.0, 
         "name": "PO00011", 
         "__model": "purchase.order", 
         "__last_update": False, 
     assert new_sale_order_id,  'Sale order is not imported'
 
 -
-  I Checking the out invoice become in invoice or not after import  ========
+  I Checking the sale order become purchase order or not after import
 -
-  !python {model: account.invoice}: |
+  !python {model: purchase.order}: |
     
-    new_partner_id = self.pool.get('res.partner').name_search(cr, uid, "Thomson pvt. ltd.")
-    assert new_partner_id, 'Partner is not created of Supplier'
-    ids = self.search(cr, uid, [('partner_id','=',new_partner_id[0][0]),('reference','=',"SAJ/2011/002")])
-    assert ids, 'Invoice does not have created of party'
-    invoice_new = self.browse(cr, uid, ids[0])
-    assert invoice_new.reference == "SAJ/2011/002", "internal number is not stored in reference"
-    assert invoice_new.reference_type == 'none', "reference type is not set to 'None'"
-    assert invoice_new.internal_number == False, "internal number is not reset"
-    assert invoice_new.journal_id.id, "journal id is not selected"
-    assert invoice_new.type == 'in_invoice', 'Imported in voice is not supplier invoice'
-    product = ['Medium PC','Basic PC']
-    for inv_line in invoice_new.invoice_line:
-        assert inv_line.account_id.id, "account_id is not taken from product's default"
-        assert inv_line.product_id.name in product, "product  is not in Invoice line"
-        #print '-----------------=================',inv_line.product_id.quantity
-        assert inv_line.product_id.price_subtotal == 375, 'subtotal is not matched'
-        #assert inv_line.producr_id.quantity
-    for inv_tax in invoice_new.tax_line:
-        assert inv_tax.manual, "for tax line manual is not set to True"
-        assert inv_tax.account_id, "for tax_line default accounts is not picked based on the tax config of the DB where it is imported."
+    ids = self.search(cr, uid, [('partner_id','=','OpenERP S.A.')])
+    assert ids, 'Order does not have created of party'
+    order_new = self.browse(cr, uid, ids[0])
+    assert order_new.pricelist_id.name == 'Public Pricelist' , "Public Price list is not imported"
+    assert order_new.amount_total == 350, "Amount total is not same"
+    assert order_new.amount_untaxed == 350, "untaxed amount is not same"
+    for purchase_line in order_new.order_line:
+        assert purchase_line.name in ['basic pc','medium pc'], "name of product is not in order"
+        assert purchase_line.product_id.name in ['Basic PC','Medium PC'], "name of product is not in order"
+        assert purchase_line.date_planned == '2011-09-13' , "date of planned order is not same"