Impacted versions: 11.0

Steps to reproduce: Inventory --> Reordering Rules --> Purchases

Current behavior: If you create new PO from Reordering Rules It is not linked to that Rule

![](https://image.prntscr.com/image/tOxQoQu6RO6gf2iE-KvEFQ.png)

Expected behavior: It should be linked to Particular Rule or Creation of Po should not be allowed from there.

Video/Screenshot link (optional):


addons/purchase/models/stock.py
try:
            buy_route_id = self.env['ir.model.data'].get_object_reference('purchase', 'route_warehouse0_buy')[1]
        except:
            buy_route_id = self.env['stock.location.route'].search([('name', 'like', _('Buy'))])
            buy_route_id = buy_route_id[0].id if buy_route_id else False
        if not buy_route_id:
            raise UserError(_("Can't find any generic Buy route."))
        return {
            'name': self._format_routename(_(' Buy')),
            'location_id': self.in_type_id.default_location_dest_id.id,
            'route_id': buy_route_id,
            'action': 'buy',
            'picking_type_id': self.in_type_id.id,
            'warehouse_id': self.id,
            'group_propagation_option': 'none',
        }
    @api.multi
    def create_routes(self):