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
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class StockPicking(models.Model):
    _inherit = 'stock.picking'
    purchase_id = fields.Many2one('purchase.order', related='move_lines.purchase_line_id.order_id',
        string="Purchase Orders", readonly=True)
    @api.model
    def _create_backorder(self, backorder_moves=[]):
        res = super(StockPicking, self)._create_backorder(backorder_moves)
        for picking in self:
            if picking.picking_type_id.code == 'incoming':
                for backorder in self.search([('backorder_id', '=', picking.id)]):
                    backorder.message_post_with_view('mail.message_origin_link',
                        values={'self': backorder, 'origin': backorder.purchase_id},
                        subtype_id=self.env.ref('mail.mt_note').id)
        return res
class StockMove(models.Model):
    _inherit = 'stock.move'
    purchase_line_id = fields.Many2one('purchase.order.line',
        'Purchase Order Line', ondelete='set null', index=True, readonly=True, copy=False)
    created_purchase_line_id = fields.Many2one('purchase.order.line',
        'Created Purchase Order Line', ondelete='set null', readonly=True, copy=False)
    @api.model
    def _prepare_merge_moves_distinct_fields(self):