diff --git a/addons/stock_complex_routes/__openerp__.py b/addons/stock_complex_routes/__openerp__.py index 5426e2c7aca..476066a78ed 100644 --- a/addons/stock_complex_routes/__openerp__.py +++ b/addons/stock_complex_routes/__openerp__.py @@ -38,7 +38,7 @@ This adds a route on the sales order and sales order line (mini module) 'init_xml': [], 'update_xml': ['stock_complex_routes.xml'], 'demo_xml': [], - 'test': [], + 'test': ['test/procurementexception.yml'], 'installable': True, 'auto_install': True, } diff --git a/addons/stock_complex_routes/test/procurementexception.yml b/addons/stock_complex_routes/test/procurementexception.yml index 67afc101089..f94bed726f0 100644 --- a/addons/stock_complex_routes/test/procurementexception.yml +++ b/addons/stock_complex_routes/test/procurementexception.yml @@ -1,37 +1,63 @@ -- - Create product with no seller_ids - - -- - Create a sales order with 1 piece for that product and route crossdock -- - !record{sale.order} -- - Confirm sales order -- - !python { -- - Check there is a procurement in exception that has the procurement group of the sales order -- - !python { - assert -- - Adjust the product that it has at least one seller_id -- - !record{id: model: product.product) or in !python -- - Run the Scheduler -- - !python -- - Check the status changed there is no procurement order in exception any more from that procurement group -- - !python{model: procurement.order} - search procurement from -- - Check a purchase quotation was created -- - - - - + I create a product with no supplier define for it. +- + !record {model: product.product, id: product_with_no_seller}: + name: 'product with no seller' + list_price: 20.00 + standard_price: 15.00 + categ_id: product.product_category_1 +- + I create a sales order with this product with route crossdock. +- + !record {model: sale.order, id: sale_order_route_crossdock}: + partner_id: base.res_partner_2 + partner_invoice_id: base.res_partner_address_3 + partner_shipping_id: base.res_partner_address_3 + note: crossdock route + payment_term: account.account_payment_term + order_line: + - product_id: product_with_no_seller + product_uom_qty: 1 + route_id: stock_location.route_warehouse0_crossdock +- + I confirm the sales order. +- + !workflow {model: sale.order, ref: sale_order_route_crossdock, action: order_confirm} +- + I check there is a procurement in exception that has the procurement group of the sales order created before. +- + !python {model: procurement.order}: | + self.run_scheduler(cr, uid) + sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock")) + proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')]) + assert proc_id, 'No Procurement!' +- + I set the at least one supplier on the product. +- + !record {model: product.product, id: product_with_no_seller}: + seller_ids: + - delay: 1 + name: base.res_partner_2 + min_qty: 2.0 +- + I run the Scheduler. +- + !python {model: procurement.order}: | + sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock")) + proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')]) + self.run(cr, uid, proc_id) +- + I check the status changed there is no procurement order in exception any more from that procurement group +- + !python {model: procurement.order}: | + sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock")) + proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')]) + assert not proc_id, 'Procurement should be in running state' +- + I check a purchase quotation was created. +- + !python {model: procurement.order}: | + sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock")) + proc_ids = self.search(cr, uid, [('group_id.name', '=', sale_id.name)]) + purchase_id = self.browse(cr, uid, proc_ids)[1].purchase_id + assert purchase_id, 'No Purchase Quotation is created'