odoo/addons/stock_dropshipping/test/procurementexception.yml

65 lines
2.5 KiB
YAML
Raw Permalink Normal View History

-
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 dropship.
-
!record {model: sale.order, id: sale_order_route_dropship01}:
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_id: account.account_payment_term
order_line:
- product_id: product_with_no_seller
product_uom_qty: 1
route_id: route_drop_shipping
-
I confirm the sales order.
-
!python {model: sale.order, id: sale_order_route_dropship01}: |
self.action_confirm()
-
I check there is a procurement in exception that has the procurement group of the sales order created before.
-
!python {model: procurement.order, id: False}: |
self.run_scheduler()
sale_order = self.env['sale.order'].browse(ref("sale_order_route_dropship01"))
procs = self.search([('group_id.name', '=', sale_order.name), ('state', '=', 'exception')])
assert procs, 'No Procurement!'
-
I set the at least one supplier on the product.
-
!record {model: product.product, id: product_with_no_seller, view: False}:
seller_ids:
- delay: 1
name: base.res_partner_2
min_qty: 2.0
-
I run the Procurement.
-
!python {model: procurement.order, id: False}: |
sale_order = self.env['sale.order'].browse(ref("sale_order_route_dropship01"))
procs = self.search([('group_id.name', '=', sale_order.name), ('state', '=', 'exception')])
procs.run()
-
I check the status changed there is no procurement order in exception any more from that procurement group
-
!python {model: procurement.order, id: False}: |
sale_order = self.env['sale.order'].browse(ref("sale_order_route_dropship01"))
procs = self.search([('group_id.name', '=', sale_order.name), ('state', '=', 'exception')])
assert not procs, 'Procurement should be in running state'
-
I check a purchase quotation was created.
-
!python {model: procurement.order, id: False}: |
sale_order = self.env['sale.order'].browse(ref("sale_order_route_dropship01"))
procs = self.search([('group_id.name', '=', sale_order.name)])
purchase_id = [proc.purchase_line_id.order_id for proc in procs if proc.purchase_line_id]
assert purchase_id, 'No Purchase Quotation is created'