@@ -4,9 +4,9 @@ def _add_new_columns(cr):
44ALTER TABLE
55 sale_order
66ADD COLUMN IF NOT EXISTS
7- invoiced_amount numeric,
7+ amount_invoiced numeric,
88ADD COLUMN IF NOT EXISTS
9- uninvoiced_amount numeric
9+ amount_to_invoice numeric
1010 """
1111 )
1212
@@ -17,8 +17,8 @@ def _update_amounts_for_cancel_invoices(cr):
1717UPDATE
1818 sale_order
1919SET
20- invoiced_amount = 0.0,
21- uninvoiced_amount = sale_order.amount_total
20+ amount_invoiced = 0.0,
21+ amount_to_invoice = sale_order.amount_total
2222WHERE
2323 sale_order.state = 'cancel'
2424 """
@@ -31,7 +31,7 @@ def _update_amounts_for_non_cancel_invoices(cr):
3131WITH amt AS(
3232 SELECT
3333 sale_order_id,
34- COALESCE(SUM(amount_total_in_currency_signed), 0) AS invoiced_amount ,
34+ COALESCE(SUM(amount_total_in_currency_signed), 0) AS amount_invoiced ,
3535 CASE
3636 WHEN SUM(amount_total_in_currency_signed) IS NULL
3737 THEN amount_total
@@ -40,7 +40,7 @@ def _update_amounts_for_non_cancel_invoices(cr):
4040 ) > 0.0 THEN amount_total - SUM(
4141 amount_total_in_currency_signed)
4242 ELSE 0.0
43- END AS uninvoiced_amount
43+ END AS amount_to_invoice
4444 FROM (
4545 SELECT DISTINCT
4646 sale_order.id AS sale_order_id,
@@ -71,8 +71,8 @@ def _update_amounts_for_non_cancel_invoices(cr):
7171 GROUP BY sale_order_id, amount_total
7272)
7373UPDATE sale_order
74- SET invoiced_amount = amt.invoiced_amount ,
75- uninvoiced_amount = amt.uninvoiced_amount
74+ SET amount_invoiced = amt.amount_invoiced ,
75+ amount_to_invoice = amt.amount_to_invoice
7676FROM amt
7777WHERE sale_order.id = amt.sale_order_id
7878 """
0 commit comments