'Compute the total amounts of the SO.'

@api.depends('order_line.price_total')
def _amount_all(self):

    for order in self:
        amount_untaxed = amount_tax = 0.0
        for line in order.order_line:
            amount_untaxed += line.price_subtotal
            if (order.company_id.tax_calculation_rounding_method == 'round_globally'):
                price = (line.price_unit * (1 - ((line.discount or 0.0) / 100.0)))
                taxes = line.tax_id.compute_all(price, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=order.partner_shipping_id)
                amount_tax += sum((t.get('amount', 0.0) for t in taxes.get('taxes', [])))
            else:
                amount_tax += line.price_tax
        order.update({'amount_untaxed': order.pricelist_id.currency_id.round(amount_untaxed), 'amount_tax': order.pricelist_id.currency_id.round(amount_tax), 'amount_total': (amount_untaxed + amount_tax)})
