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


distinct_fields = super(StockMove, self)._prepare_merge_moves_distinct_fields()
        distinct_fields.append('purchase_line_id')
        return distinct_fields
    @api.model
    def _prepare_merge_move_sort_method(self, move):
        move.ensure_one()
        keys_sorted = super(StockMove, self)._prepare_merge_move_sort_method(move)
        keys_sorted.append(move.purchase_line_id.id)
        return keys_sorted
    @api.multi
    def _get_price_unit(self):
        """ Returns the unit price for the move"""
        self.ensure_one()
        if self.purchase_line_id and self.product_id.id == self.purchase_line_id.product_id.id:
            line = self.purchase_line_id
            order = line.order_id
            price_unit = line.price_unit
            if line.taxes_id:
                price_unit = line.taxes_id.with_context(round=False).compute_all(price_unit, currency=line.order_id.currency_id, quantity=1.0)['total_excluded']
            if line.product_uom.id != line.product_id.uom_id.id:
                price_unit *= line.product_uom.factor / line.product_id.uom_id.factor
            if order.currency_id != order.company_id.currency_id:
                price_unit = order.currency_id.compute(price_unit, order.company_id.currency_id, round=False)
            return price_unit
        return super(StockMove, self)._get_price_unit()
    def _prepare_extra_move_vals(self, qty):