diff --git a/addons/account/test/test_edi_invoice.yml b/addons/account/test/test_edi_invoice.yml index d29fe96fc89..843892a4573 100644 --- a/addons/account/test/test_edi_invoice.yml +++ b/addons/account/test/test_edi_invoice.yml @@ -38,6 +38,14 @@ price_unit: 10.0 name: 'basic pc' account_id: account.a_pay + invoice_line: + - product_id: product.product_product_pc3 + partner_id: res_partner_test20 + uos_id: 1 + quantity: 5.0 + price_unit: 100.0 + name: 'Medium PC' + account_id: account.a_pay tax_line: - name: sale tax @@ -112,6 +120,16 @@ "__id": "b22acf7a-ddcd-11e0-a4db-701a04e25543:b22acf7a-ddcd-11e0-a4db-701a04e25543:account.account_invoice_line-1RP3so-u2vV4", "product_id": ["b22acf7a-ddcd-11e0-a4db-701a04e25543:product.product_product_pc1", "[PC1] Basic PC"], "quantity": 1.0 + }, + { + "uos_id": ["b22acf7a-ddcd-11e0-a4db-701a04e25543:product.product_uom_unit", "PCE"], + "name": "Medim PC", + "__last_update": False, + "price_unit": 100.0, + "price_subtotal": 100.0, + "__id": "b22acf7a-ddcd-11e0-a4db-701a04e25543:b22acf7a-ddcd-11e0-a4db-701a04e25543:account.account_invoice_line-1RP3so-u2vV4", + "product_id": ["b22acf7a-ddcd-11e0-a4db-701a04e25543:product.product_product_pc3", "[PC3] Medium PC"], + "quantity": 5.0 }] } @@ -119,7 +137,7 @@ invoice_new = invoice_pool.browse(cr, uid, invoice_id, context=context) assert invoice_id, 'Invoice is not imported' - - I Checking the out invoice become in invoice or not after import + I Checking the out invoice become in invoice or not after import - !python {model: account.invoice}: | @@ -131,9 +149,15 @@ 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.journal_id.id, "journal id is not selected" + 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 ['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." diff --git a/addons/purchase/test/edi_purchase_order.yml b/addons/purchase/test/edi_purchase_order.yml index ef3bbb4338b..a6dc45ee997 100644 --- a/addons/purchase/test/edi_purchase_order.yml +++ b/addons/purchase/test/edi_purchase_order.yml @@ -21,8 +21,15 @@ 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}: | @@ -55,6 +62,16 @@ "__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, @@ -83,3 +100,19 @@ } 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" diff --git a/addons/sale/test/edi_sale_order.yml b/addons/sale/test/edi_sale_order.yml index 9eb6fc42ce0..af1b32a6f01 100644 --- a/addons/sale/test/edi_sale_order.yml +++ b/addons/sale/test/edi_sale_order.yml @@ -21,6 +21,12 @@ 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, @@ -83,4 +89,19 @@ } new_sale_order_id = sale_order_pool.edi_import(cr, uid, edi_document, context=context) assert new_sale_order_id, 'Sale order is not imported' - + +- + I Checking the sale order become purchase order or not after import +- + !python {model: purchase.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 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"