**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


readonly=True, states={'draft':[('readonly',False)], 'sent':[('readonly',False)]},
            help="Based on Purchase Order lines: place individual lines in 'Invoice Control / On Purchase Order lines' from where you can selectively create an invoice.\n" \
                "Based on generated invoice: create a draft invoice you can validate later.\n" \
                "Based on incoming shipments: let you create an invoice when receipts are validated."
        ),
        'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, string='Expected Date', type='date', select=True, help="This is computed as the minimum scheduled date of all purchase order lines' products.",
            store = {
                'purchase.order.line': (_get_order, ['date_planned'], 10),
                'purchase.order': (_get_purchase_order, ['order_line'], 10),
            }
        ),
        'amount_untaxed': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Untaxed Amount',
            store={
                'purchase.order.line': (_get_order, None, 10),
            }, multi="sums", help="The amount without tax", track_visibility='always'),
        'amount_tax': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Taxes',
            store={
                'purchase.order.line': (_get_order, None, 10),
            }, multi="sums", help="The tax amount"),
        'amount_total': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Total',
            store={
                'purchase.order.line': (_get_order, None, 10),
            }, multi="sums", help="The total amount"),
        'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
        'payment_term_id': fields.many2one('account.payment.term', 'Payment Term'),
        'incoterm_id': fields.many2one('stock.incoterms', 'Incoterm', help="International Commercial Terms are a series of predefined commercial terms used in international transactions."),
        'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),
        'create_uid': fields.many2one('res.users', 'Responsible'),
        'company_id': fields.many2one('res.company', 'Company', required=True, select=1, states={'confirmed': [('readonly', True)], 'approved': [('readonly', True)]}),
        'journal_id': fields.many2one('account.journal', 'Journal'),