Launchpad automatic translations update.
[odoo/odoo.git] / addons / sale_mrp / test / sale_mrp.yml
1 -
2   In order to test the sale_mrp module in OpenERP,I start by creating a new product 'Slider Mobile'
3 -
4   I define product category Mobile Products Sellable.
5 -
6   !record {model: product.category, id: product_category_allproductssellable0}:
7     name: Mobile Products Sellable
8 -
9   I define product category Mobile Services.
10 -
11   !record {model: product.category, id: product_category_services0}:
12     name: Mobile Services
13 -
14   I define product template for Slider Mobile.
15 -
16   !record {model: product.template, id: product_template_slidermobile0}:
17     categ_id: product_category_allproductssellable0
18     cost_method: standard
19     list_price: 200.0
20     mes_type: fixed
21     name: Slider Mobile
22     procure_method: make_to_order
23     standard_price: 189.0
24     supply_method: produce
25     type: product
26     uom_id: product.product_uom_unit
27     uom_po_id: product.product_uom_unit
28 -
29   I define a product Slider Mobile
30 -
31   !record {model: product.product, id:  product_product_slidermobile0}:
32     categ_id: product_category_allproductssellable0
33     cost_method: standard
34     list_price: 200.0
35     mes_type: fixed
36     name: Slider Mobile
37     procure_method: make_to_order
38     seller_delay: '1'
39     seller_ids:
40       - delay: 1
41         name: base.res_partner_agrolait
42         min_qty: 2.0
43         qty: 5.0
44     standard_price: 189.0
45     supply_method: produce
46     type: product
47     uom_id: product.product_uom_unit
48     uom_po_id: product.product_uom_unit
49 -
50   I create a Bill of Material record for Slider Mobile
51 -
52   !record {model: mrp.bom, id: mrp_bom_slidermobile0}:
53     company_id: base.main_company
54     name: Slider Mobile
55     product_efficiency: 1.0
56     product_id: product_product_slidermobile0
57     product_qty: 1.0
58     product_uom: product.product_uom_unit
59     product_uos_qty: 0.0
60     sequence: 0.0
61     type: normal
62 -
63   I create a sale order for product Slider mobile
64 -
65   !record {model: sale.order, id: sale_order_so0}:
66     client_order_ref: ref1
67     date_order: !eval time.strftime('%Y-%m-%d')
68     invoice_quantity: order
69     name: Test_SO001
70     order_line:
71       - name: Slider Mobile
72         price_unit: 200
73         product_uom: product.product_uom_unit
74         product_uom_qty: 500.0
75         state: draft
76         delay: 7.0
77         product_id: product_product_slidermobile0
78         product_uos_qty: 500.0
79         type: make_to_order
80     order_policy: manual
81     partner_id: base.res_partner_4
82     partner_invoice_id: base.res_partner_address_7
83     partner_order_id: base.res_partner_address_7
84     partner_shipping_id: base.res_partner_address_7
85     picking_policy: direct
86     pricelist_id: product.list0
87     shop_id: sale.shop
88 -
89   I confirm the sale order
90 -
91   !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
92 -
93   I verify that a procurement has been generated for sale order
94 -
95   !python {model: procurement.order}: |
96     from tools.translate import _
97     sale_order_obj = self.pool.get('sale.order')
98     so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
99     proc_ids = self.search(cr, uid, [('origin','=',so.name)])
100     assert proc_ids, _('No Procurements!')
101 -
102   Then I click on the "Run Procurement" button
103 -
104   !python {model: procurement.order}: |
105     sale_order_obj = self.pool.get('sale.order')
106     so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
107     import netsvc
108     wf_service = netsvc.LocalService("workflow")
109     proc_ids = self.search(cr, uid, [('origin','=',so.name)])
110     for proc in proc_ids:
111       wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
112 -
113   I verify that a procurement state is "running"
114 -
115   !python {model: procurement.order}: |
116     sale_order_obj = self.pool.get('sale.order')
117     so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
118     proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
119     assert proc_ids, _('Procurement is not in the running state!')
120 -
121   I verify that a manufacturing order has been generated
122 -
123   !python {model: sale.order}: |
124     so = self.browse(cr, uid, ref("sale_order_so0"))
125     mnf_obj=self.pool.get('mrp.production')
126     mnf_id=mnf_obj.search(cr, uid, [('origin','=',so.name)])
127     assert mnf_id, _('Manufacturing order has not been generated')
128 -
129   I verify that a 'Sale Name' field of Manufacturing order gets bind with the value
130 -
131   !python {model: sale.order}: |
132     so = self.browse(cr, uid, ref("sale_order_so0"))
133     mnf_obj=self.pool.get('mrp.production')
134     mnf_id=mnf_obj.search(cr, uid, [('sale_name','=',so.name)])
135     assert mnf_id, _('Sale Name is not bind with the value')
136 -
137   I verify that a 'Sale Reference' field of Manufacturing order gets bind with the value
138 -
139   !python {model: sale.order}: |
140     so = self.browse(cr, uid, ref("sale_order_so0"))
141     mnf_obj=self.pool.get('mrp.production')
142     mnf_id=mnf_obj.search(cr, uid, [('sale_ref','=',so.client_order_ref)])
143     assert mnf_id, _('Sale Reference is not bind with the value')