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):


res = super(StockWarehouse, self)._update_name_and_code(name, code)
        warehouse = self[0]
        
        if warehouse.buy_pull_id and name:
            warehouse.buy_pull_id.write({'name': warehouse.buy_pull_id.name.replace(warehouse.name, name, 1)})
        return res
    @api.multi
    def _update_routes(self):
        res = super(StockWarehouse, self)._update_routes()
        for warehouse in self:
            if warehouse.in_type_id.default_location_dest_id != warehouse.buy_pull_id.location_id:
                warehouse.buy_pull_id.write({'location_id': warehouse.in_type_id.default_location_dest_id.id})
        return res
class ReturnPicking(models.TransientModel):
    _inherit = "stock.return.picking"
    def _prepare_move_default_values(self, return_line, new_picking):
        vals = super(ReturnPicking, self)._prepare_move_default_values(return_line, new_picking)
        vals['purchase_line_id'] = return_line.move_id.purchase_line_id.id
        return vals
class Orderpoint(models.Model):
    _inherit = "stock.warehouse.orderpoint"
    def _quantity_in_progress(self):
        res = super(Orderpoint, self)._quantity_in_progress()
        for poline in self.env['purchase.order.line'].search([('state','in',('draft','sent','to approve')),('orderpoint_id','in',self.ids)]):
            res[poline.orderpoint_id.id] += poline.product_uom._compute_quantity(poline.product_qty, poline.orderpoint_id.product_uom, round=False)
        return res