[REF] Indentation + var name

bzr revid: jke@openerp.com-20131025143551-lb86077kl5yaaujn
This commit is contained in:
jke-openerp 2013-10-25 16:35:51 +02:00
parent 63d193c210
commit 0cac453e16
2 changed files with 27 additions and 30 deletions

View File

@ -35,7 +35,7 @@
!python {model: product.product}: |
route_warehouse0_manufacture = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).manufacture_pull_id.route_id.id
route_warehouse0_mto = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).mto_pull_id.route_id.id
self.write(cr, uid, ref('product_manu'),{ 'route_ids': [(6,0,[route_warehouse0_mto,route_warehouse0_manufacture])]}, context=context)
self.write(cr, uid, ref('product_manu'), { 'route_ids': [(6, 0, [route_warehouse0_mto,route_warehouse0_manufacture])]}, context=context)
-
Create a sales order with route_id manufacture.
-
@ -66,27 +66,27 @@
!python {model: procurement.order}: |
# Retrieve related procu
so = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_manu'))
procu_ids = self.search(cr,uid,[('group_id.name','=',so.name)])
assert len(procu_ids)>0, 'None procu found for so %s (%d)' %(so.name,so.id)
procu_ids = self.search(cr, uid, [('group_id.name', '=', so.name)])
assert len(procu_ids)>0, 'None procu found for so %s (%d)' %(so.name, so.id)
# Check that all procurement are running
for procu in self.browse(cr,uid,procu_ids,context=context):
assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id,procu.state)
for procu in self.browse(cr, uid, procu_ids, context=context):
assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id, procu.state)
# Check that one or more Production Order
procor_ids = [proc.production_id for proc in self.browse(cr, uid, procu_ids) if proc.production_id]
assert len(procor_ids) > 0, 'No production Order found !'
prodor_ids = [proc.production_id for proc in self.browse(cr, uid, procu_ids) if proc.production_id]
assert len(prodor_ids) > 0, 'No production Order found !'
# Cancel the main procurement
main_procu_id = self.search(cr,uid,[('origin','=',so.name)])
main_procu_id = self.search(cr, uid, [('origin', '=', so.name)])
assert len(main_procu_id) == 1, 'Main procurement not identified !'
self.cancel(cr,uid,main_procu_id,context=context)
assert self.browse(cr,uid,main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!'
self.cancel(cr, uid, main_procu_id,context=context)
assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!'
# Check that all procurements related is cancelled
for procu in self.browse(cr,uid,procu_ids,context=context):
assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id,procu.state)
for procu in self.browse(cr, uid, procu_ids, context=context):
assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id, procu.state)
# Check that the production order is cancelled
for po in self.pool.get('mrp.production').browse(cr,uid,[prodor.id for prodor in procor_ids],context=context):
assert po.state == u'cancel', 'Production Order %d should be cancelled and is in state : %s!' %(prodor.id, procor.state)
for prodor in self.pool.get('mrp.production').browse(cr, uid, [prodor.id for prodor in prodor_ids], context=context):
assert prodor.state == u'cancel', 'Production Order %d should be cancelled and is in state : %s!' %(prodor.id, prodor.state)

View File

@ -14,7 +14,7 @@
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
seller_ids: ##### define a bom
seller_ids:
- delay: 1
name: base.res_partner_2
min_qty: 2.0
@ -25,7 +25,7 @@
!python {model: product.product}: |
route_warehouse0_buy = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).buy_pull_id.route_id.id
route_warehouse0_mto = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0')).mto_pull_id.route_id.id
self.write(cr, uid, ref('product_mto'),{ 'route_ids': [(6,0,[route_warehouse0_mto,route_warehouse0_buy])]}, context=context ) ##### manufact au lieu de buy
self.write(cr, uid, ref('product_mto'), { 'route_ids': [(6, 0, [route_warehouse0_mto,route_warehouse0_buy])]}, context=context )
-
Create a sales order with a line of 5 "My MTO Product", with route_id Buy.
-
@ -56,30 +56,27 @@
!python {model: procurement.order}: |
# Retrieve related procu
so = self.pool.get('sale.order').browse(cr, uid, ref('sale_order_product_mto'))
procu_ids = self.search(cr,uid,[('group_id.name','=',so.name)])
procu_ids = self.search(cr, uid, [('group_id.name', '=', so.name)])
assert len(procu_ids)>0, 'None procu found for so %s (%d)' %(so.name,so.id)
# Check that all procurement are running
for procu in self.browse(cr,uid,procu_ids,context=context):
assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id,procu.state)
assert procu.state == u'running', 'Procu %d should be running and is in state : %s!' %(procu.id, procu.state)
# Check that one or more PO ##### a mrp.prod
# Check that one or more PO
purchase_ids = [proc.purchase_line_id.order_id for proc in self.browse(cr, uid, procu_ids) if proc.purchase_line_id]
assert len(purchase_ids) > 0, 'No purchase order find !'
# Cancel the main procurement
main_procu_id = self.search(cr,uid,[('origin','=',so.name)])
main_procu_id = self.search(cr, uid, [('origin', '=', so.name)])
assert len(main_procu_id) == 1, 'Main procurement not identified !'
self.cancel(cr,uid,main_procu_id,context=context)
assert self.browse(cr,uid,main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!'
self.cancel(cr, uid, main_procu_id, context=context)
assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement is not cancelled !!!'
# Check that all procurements related is cancelled
for procu in self.browse(cr,uid,procu_ids,context=context):
assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id,procu.state)
# Check that the purchase order is cancelled ##### a mrp.prod
for po in self.pool.get('purchase.order').browse(cr,uid,[po.id for po in purchase_ids],context=context):
assert po.state == u'cancel', 'Purchase %d should be cancelled and is in state : %s!' %(po.id, po.state)
for procu in self.browse(cr, uid, procu_ids, context=context):
assert procu.state == u'cancel', 'Procu %d should be cancelled and is in state : %s!' %(procu.id, procu.state)
# Check that the purchase order is cancelled
for po in self.pool.get('purchase.order').browse(cr, uid, [po.id for po in purchase_ids], context=context):
assert po.state == u'cancel', 'Purchase %d should be cancelled and is in state : %s!' %(po.id, po.state)