[IMP] Maifest for Github README.md on main apps
[odoo/odoo.git] / addons / stock_dropshipping / test / procurementexception.yml
1 -
2   I create a product with no supplier define for it.
3 -
4   !record {model: product.product, id: product_with_no_seller}:
5     name: 'product with no seller'
6     list_price: 20.00
7     standard_price: 15.00
8     categ_id: product.product_category_1
9 -
10   I create a sales order with this product with route dropship.
11 -
12   !record {model: sale.order, id: sale_order_route_dropship01}:
13     partner_id: base.res_partner_2
14     partner_invoice_id: base.res_partner_address_3
15     partner_shipping_id: base.res_partner_address_3
16     note: crossdock route
17     payment_term: account.account_payment_term
18     order_line:
19       - product_id: product_with_no_seller
20         product_uom_qty: 1
21         route_id: route_drop_shipping
22 -
23   I confirm the sales order.
24 -
25   !workflow {model: sale.order, ref: sale_order_route_dropship01, action: order_confirm}
26 -
27   I check there is a procurement in exception that has the procurement group of the sales order created before.
28 -
29   !python {model: procurement.order}: |
30     self.run_scheduler(cr, uid)
31     sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_dropship01"))
32     proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
33     assert proc_id, 'No Procurement!'
34 -
35   I set the at least one supplier on the product.
36 -
37   !record {model: product.product, id: product_with_no_seller}:
38     seller_ids:
39       - delay: 1
40         name: base.res_partner_2
41         min_qty: 2.0
42 -
43   I run the Procurement.
44 -
45   !python {model: procurement.order}: |
46     sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_dropship01"))
47     proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
48     self.run(cr, uid, proc_id)
49 -
50   I check the status changed there is no procurement order in exception any more from that procurement group
51 -
52   !python {model: procurement.order}: |
53     sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_dropship01"))
54     proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
55     assert not proc_id, 'Procurement should be in running state'
56 -
57   I check a purchase quotation was created.
58 -
59   !python {model: procurement.order}: |
60     sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_dropship01"))
61     proc_ids = self.search(cr, uid, [('group_id.name', '=', sale_id.name)])
62     purchase_id = [proc.purchase_line_id.order_id for proc in self.browse(cr, uid, proc_ids) if proc.purchase_line_id]
63     assert purchase_id, 'No Purchase Quotation is created'