**Impacted versions:**
10, 11, master, tested on runbot today
**Steps to reproduce:**
Customer and Vendor Credit Note  on invoice analysis are not rest, total is incorrect on analysis. [This commit](https://github.com/odoo/odoo/commit/ecc75092776ca11089772a970fba9638071322d9) is wrong. Field price_subtotal_signed is correct signed with invoice type(in_refund, out_refund signed negative, other signed positive. **It is correct**. BUT ail.price_subtotal_signed * invoice_type.sign is wrong multiplicate with signed again)
Note: invoice_type.sign must be only for multiplicate by quantity, no by amount_total. Read [comment](https://github.com/odoo/odoo/blob/11.0/addons/account/report/account_invoice_report.py#L136).

**Current behavior:**
Customer and vendor Credit Note amount total is sum in analysis
**Expected behavior:**
Credit Note must be rest amount, not sum.
**Solution, revert [this commit](https://github.com/odoo/odoo/commit/ecc75092776ca11089772a970fba9638071322d9)**
Video/Screenshot link (optional):

**Some Printscreen.** tested on runbot from [this branch](http://269594-10-0-19eb19.runbot9.odoo.com)
**Customer invoices**
Customer Agrolait Invoice INV/2017/0004 is Credit Note(refund) signed on negative(amount -650.00), total for this customer is **525** rest credit Note(525 + 650 - 650), but on analysis total for this customer is **1825**, this value is wrong(525 + 650 -(*- signed are convert to +) 650).
**Customer Invoice**
![image](https://user-images.githubusercontent.com/7775116/31320314-329dc74a-ac38-11e7-8a44-389ac9dbdf2a.png)
**Invoice Analysis**
![image](https://user-images.githubusercontent.com/7775116/31320320-422351c6-ac38-11e7-8b1b-a7fda4b86a3d.png)

**Vendor Invoices**
Vendor Camptocamp Invoice BILL/2017/0004 is Credit Note(refund) signed on negative(amount -10,000.00), total for this customer is **14** rest credit Note(14 + 10,000.00 - 10,000.00), but on analysis total for this Vendor is **-20,014.00**, this value is wrong(14 + 10,000.00 -(*- signed are convert to +) 10,000.00).
**Vendor Invoice**
![image](https://user-images.githubusercontent.com/7775116/31320348-ceaf21ba-ac38-11e7-841f-4dad74f8a9d7.png)
**Invoice Analysis**
![image](https://user-images.githubusercontent.com/7775116/31320400-8e587b74-ac39-11e7-94a1-424e0d1caae4.png)




select_str = """
                SELECT ail.id AS id,
                    ai.date_invoice AS date,
                    ail.product_id, ai.partner_id, ai.payment_term_id, ail.account_analytic_id,
                    u2.name AS uom_name,
                    ai.currency_id, ai.journal_id, ai.fiscal_position_id, ai.user_id, ai.company_id,
                    1 AS nbr,
                    ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id,
                    ai.partner_bank_id,
                    SUM ((invoice_type.sign * ail.quantity) / u.factor * u2.factor) AS product_qty,
                    SUM(ail.price_subtotal_signed * invoice_type.sign) AS price_total,
                    SUM(ABS(ail.price_subtotal_signed)) / CASE
                            WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric
                               THEN SUM(ail.quantity / u.factor * u2.factor)
                               ELSE 1::numeric
                            END AS price_average,
                    ai.residual_company_signed / (SELECT count(*) FROM account_invoice_line l where invoice_id = ai.id) *
                    count(*) * invoice_type.sign AS residual,
                    ai.commercial_partner_id as commercial_partner_id,
                    partner.country_id,
                    SUM(pr.weight * (invoice_type.sign*ail.quantity) / u.factor * u2.factor) AS weight,
                    SUM(pr.volume * (invoice_type.sign*ail.quantity) / u.factor * u2.factor) AS volume
        """
        return select_str
    def _from(self):