[FIX] edi: correct yml and remove stuff to change model into sale and puchase EDI
bzr revid: hmo@tinyerp.com-20110916064319-63zc227t9g8cxao2
This commit is contained in:
@@ -151,9 +151,6 @@
|
||||
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.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"
|
||||
|
||||
@@ -124,9 +124,6 @@ class purchase_order(osv.osv, ir_edi.edi):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
model = edi_document['__model']
|
||||
assert model == 'sale.order', _('Could not import purchase order')
|
||||
edi_document['__model'] = self._name
|
||||
#import company as a new partner
|
||||
partner_id = self.edi_import_company(cr, uid, edi_document, context=context)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
"name": "medium pc",
|
||||
"product_uom": ["724f93ec-ddd0-11e0-88ec-701a04e25543:product.product_uom_unit", "PCE"],
|
||||
"sequence": 11,
|
||||
"price_unit": 200.0,
|
||||
"price_unit": 20.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"]
|
||||
@@ -88,13 +88,13 @@
|
||||
"date_order": "2011-09-13",
|
||||
"partner_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:sale.res_partner_test22", "Junjun wala"],
|
||||
"__attachments": [],
|
||||
"__module": "sale",
|
||||
"__module": "purchase",
|
||||
"amount_total": 350.0,
|
||||
"amount_untaxed": 350.0,
|
||||
"name": "SO008",
|
||||
"__model": "sale.order",
|
||||
"__model": "purchase.order",
|
||||
"__last_update": False,
|
||||
"company_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:base.main_company", "OpenERP S.A."],
|
||||
"company_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:base.main_company", "Supplier S.A."],
|
||||
"__version": [6, 1],
|
||||
"pricelist_id": ["724f93ec-ddd0-11e0-88ec-701a04e25543:product.list0", "Public Pricelist (EUR)"]
|
||||
}
|
||||
@@ -104,15 +104,15 @@
|
||||
-
|
||||
I Checking the sale order become purchase order or not after import
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
!python {model: purchase.order}: |
|
||||
|
||||
ids = self.search(cr, uid, [('partner_id','=','OpenERP S.A.')])
|
||||
ids = self.search(cr, uid, [('partner_id','=','Supplier S.A.'), ('partner_ref', '=', 'SO008')])
|
||||
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"
|
||||
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_order == '2011-09-13' , "date of order is not same"
|
||||
|
||||
@@ -122,9 +122,6 @@ class sale_order(osv.osv, ir_edi.edi):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
model = edi_document['__model']
|
||||
assert model == 'purchase.order', _('Could not import sale order')
|
||||
edi_document['__model'] = self._name
|
||||
#import company as a new partner
|
||||
partner_id = self.edi_import_company(cr, uid, edi_document, context=context)
|
||||
|
||||
@@ -135,9 +132,11 @@ class sale_order(osv.osv, ir_edi.edi):
|
||||
order_lines = edi_document['order_line']
|
||||
for order_line in order_lines:
|
||||
order_line['product_uom_qty'] = order_line['product_qty']
|
||||
date_order = datetime.strptime(date_order, "%Y-%m-%d")
|
||||
date_planned = datetime.strptime(order_line['date_planned'], "%Y-%m-%d")
|
||||
order_line['delay'] = (date_planned - date_order).days
|
||||
date_planned = order_line['date_planned']
|
||||
delay = 0
|
||||
if date_order and date_planned:
|
||||
delay = (datetime.strptime(date_planned, "%Y-%m-%d") - datetime.strptime(date_order, "%Y-%m-%d")).days
|
||||
order_line['delay'] = delay
|
||||
return super(sale_order,self).edi_import(cr, uid, edi_document, context=context)
|
||||
|
||||
sale_order()
|
||||
|
||||
@@ -56,19 +56,29 @@
|
||||
"order_line": [{
|
||||
"name": "basic pc",
|
||||
"product_uom": ["5af1272e-dd26-11e0-b65e-701a04e25543:product.product_uom_unit", "PCE"],
|
||||
"date_planned": "2011-08-31",
|
||||
"date_planned": "2011-09-30",
|
||||
"price_unit": 150.0,
|
||||
"__last_update": False,
|
||||
"__id": "5af1272e-dd26-11e0-b65e-701a04e25543:purchase.purchase_order_line-AlhsVDZGoKvJ",
|
||||
"product_qty": 1.0,
|
||||
"product_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:product.product_product_pc1", "[PC1] Basic PC"]
|
||||
},
|
||||
{
|
||||
"name": "medium pc",
|
||||
"product_uom": ["5af1272e-dd26-11e0-b65e-701a04e25543:product.product_uom_unit", "PCE"],
|
||||
"date_planned": "2011-09-15",
|
||||
"price_unit": 100.0,
|
||||
"__last_update": False,
|
||||
"__id": "5af1272e-dd26-11e0-b65e-701a04e25543:purchase.purchase_order_line-AlhsVDZGoKvJ",
|
||||
"product_qty": 2.0,
|
||||
"product_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:product.product_product_pc3", "[PC3] Medium PC"]
|
||||
}],
|
||||
"partner_address_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:base.res_partner_address_11", "Sebastien LANGE, France, Alencon, 1 place de l'\u00c9glise"],
|
||||
"__id": "5af1272e-dd26-11e0-b65e-701a04e25543:purchase.purchase_order_test",
|
||||
"date_order": "2011-09-12",
|
||||
"partner_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:purchase.res_partner_test20", "jones white"],
|
||||
"__attachments": [],
|
||||
"__module": "purchase",
|
||||
"__module": "sale",
|
||||
"amount_total": 350.0,
|
||||
"company_address": {
|
||||
"phone": "(+32).81.81.37.00",
|
||||
@@ -81,9 +91,9 @@
|
||||
},
|
||||
"amount_untaxed": 350.0,
|
||||
"name": "PO00011",
|
||||
"__model": "purchase.order",
|
||||
"__model": "sale.order",
|
||||
"__last_update": False,
|
||||
"company_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:base.main_company", "OpenERP S.A."],
|
||||
"company_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:base.main_company", "Client S.A."],
|
||||
"__version": [6, 1],
|
||||
"pricelist_id": ["5af1272e-dd26-11e0-b65e-701a04e25543:product.list0", "Public Pricelist (EUR)"]
|
||||
}
|
||||
@@ -93,15 +103,25 @@
|
||||
-
|
||||
I Checking the sale order become purchase order or not after import
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
!python {model: sale.order}: |
|
||||
|
||||
ids = self.search(cr, uid, [('partner_id','=','OpenERP S.A.')])
|
||||
ids = self.search(cr, uid, [('partner_id','=','Client S.A.'), ('client_order_ref', '=', 'PO00011')])
|
||||
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"
|
||||
assert len(order_new.order_line) == 2, "sale lines are not same"
|
||||
for sale_line in order_new.order_line:
|
||||
if sale_line.name == 'basic pc':
|
||||
assert sale_line.delay == 18 , "delay is not same"
|
||||
assert sale_line.product_uom.name == "PCE" , "uom is not same"
|
||||
assert sale_line.price_unit == 150 , "price unit is not same"
|
||||
assert sale_line.product_uom_qty == 1 , "product qty is not same"
|
||||
elif sale_line.name == 'medium pc':
|
||||
assert sale_line.delay == 3 , "delay is not same"
|
||||
assert sale_line.product_uom.name == "PCE" , "uom is not same"
|
||||
assert sale_line.price_unit == 100 , "price unit is not same"
|
||||
assert sale_line.product_uom_qty == 2 , "product qty is not same"
|
||||
else:
|
||||
assert 'wrong product imported in sale lines'
|
||||
|
||||
Reference in New Issue
Block a user