odoo/addons/project_mrp/test/project_task_procurement.yml

75 lines
2.4 KiB
YAML

-
In order to test project_mrp module with OpenERP I want to create sale orders
with product type 'service' so when procurement runs one task is created.
-
I create record for a service type product.
-
!record {model: product.product, id: product_product_partnerstraining0}:
categ_id: product.product_category_7
cost_method: standard
mes_type: fixed
name: Partners Training
procure_method: make_to_order
supply_method: produce
type: service
uom_id: product.uom_day
uom_po_id: product.uom_day
warranty: 0.0
-
I create a sale order for product Partners Training which has type 'Service'.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-21'
invoice_quantity: order
name: SO006
order_policy: manual
partner_id: base.res_partner_asus
partner_invoice_id: base.res_partner_address_tang
partner_order_id: base.res_partner_address_tang
partner_shipping_id: base.res_partner_address_tang
order_line:
- state: draft
delay: 7.0
name: Partners Training
price_unit: 1.0
product_id: product_product_partnerstraining0
product_uom: product.uom_day
product_uom_qty: 5.0
th_weight: 0.0
type: make_to_order
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
user_id: base.user_demo
-
I confirm this sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I check the procurements.
-
!python {model: procurement.order}: |
from tools.translate import _
orderline_obj = self.pool.get('sale.order.line')
line_ids = orderline_obj.search(cr, uid, [('order_id','=', ref('sale_order_so0'))])
orders = orderline_obj.browse(cr, uid, line_ids)
proc_ids = map(lambda x: x.procurement_id.id, orders)
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
Now I check the tasks.
-
I see that one task is created for my sale order.
-
!python {model: project.task}: |
from tools.translate import _
order_obj = self.pool.get('sale.order')
order = order_obj.browse(cr, uid, ref('sale_order_so0'))
task_id = self.search(cr, uid, [('project_id.name','=', order.name)])
assert task_id, _('No Task is created!')