**Impacted versions:**
8.0

**Steps to reproduce:**

* The product is created with its respective configuration (it must be stokable, have a supplier and procurement by buy),  in the accouting tab the "inventory valuation" section should be "Real time".
* Proceed to create its reordering rule, it is assigned a value min = 100 and max = 160.                                                      
* Run Scheduler, Which generates a purchase order to supply the product created.                                                              
* The Reordering Rule is modified so that min = 120 and max = 170.                                                                            
* Run Scheduler, Which doubles the procurement for the product in question.                                                                   
* We locate the generated purchase order and change quantity = 170 to quantity = 160 in the product line, then it is confirmed and change Invoicing control to "Based on Incoming shipments". Update the Total.                                                                                             
* Confirm Order. Approve Order. "Go to Shipments". If we review the related picking we will see that for product line duplicate the input creating a second with quantity = 0 value.                                                                                                                        
* Transfer. Apply. Create Invoice. At this point we appreciate the invoice with a duplicate product line and with quantity value equal to zero.
* Validate. (traceback error)

**Current behaivor:**                                                                                                                                         
                                                                                                                                                              
Currently the process described above generates a duplicate product line and with quantity equal to zero for the picking and that is transferred to the invoice when we do the latter from the picking. As shown in the following video in an example from runbot.odoo.com  [ Here.](https://youtu.be/CziZuFZvGHo)                                                
                                                                                                                                                              
catch traceback error:
![traceback](https://cloud.githubusercontent.com/assets/11073475/25353055/090eb32c-28fc-11e7-975c-d35afe179bf8.png)


**Expected behaivor:**                                                                                                                                        
                                                                                                                                                              
Do not generate duplicate product line with quantity zero and thus avoid being transferred to the invoice generating a traceback error at the time of validating the invoice as shown:

Video/Screenshot link (optional):

https://youtu.be/CziZuFZvGHo


addons/purchase/purchase.py
"""Creates appropriate stock moves for given order lines, whose can optionally create a
        picking if none is given or no suitable is found, then confirms the moves, makes them
        available, and confirms the pickings.
        If ``picking_id`` is provided, the stock moves will be added to it, otherwise a standard
        incoming picking will be created to wrap the stock moves (default behavior of the stock.move)
        Modules that wish to customize the procurements or partition the stock moves over
        multiple stock pickings may override this method and call ``super()`` with
        different subsets of ``order_lines`` and/or preset ``picking_id`` values.
        :param browse_record order: purchase order to which the order lines belong
        :param list(browse_record) order_lines: purchase order line records for which picking
                                                and moves should be created.
        :param int picking_id: optional ID of a stock picking to which the created stock moves
                               will be added. A new picking will be created if omitted.
        :return: None
        """
        stock_move = self.pool.get('stock.move')
        todo_moves = []
        new_group = self.pool.get("procurement.group").create(cr, uid, {'name': order.name, 'partner_id': order.partner_id.id}, context=context)
        for order_line in order_lines:
            if order_line.state == 'cancel':
                continue
            if not order_line.product_id:
                continue
            if order_line.product_id.type in ('product', 'consu'):
                for vals in self._prepare_order_line_move(cr, uid, order, order_line, picking_id, new_group, context=context):
                    move = stock_move.create(cr, uid, vals, context=context)
                    todo_moves.append(move)
        todo_moves = stock_move.action_confirm(cr, uid, todo_moves)
        stock_move.force_assign(cr, uid, todo_moves)
    def test_moves_done(self, cr, uid, ids, context=None):