Skip to content

Commit db50d2f

Browse files
committed
[MIG] sale_order_invoice_amount: Migration to 18.0
1 parent 913fb62 commit db50d2f

File tree

8 files changed

+25
-42
lines changed

8 files changed

+25
-42
lines changed

sale_order_invoice_amount/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Sale Order Invoice Amount
3030

3131
The purpose of this module is to add two fields in the sale order model:
3232

33-
- invoiced_amount: total invoiced amount.
34-
- uninvoiced_amount: total uninvoiced amount.
33+
- amount_invoiced: total invoiced amount.
34+
- amount_to_invoice: total uninvoiced amount.
3535

3636
**Table of contents**
3737

sale_order_invoice_amount/__manifest__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@
33

44
{
55
"name": "Sale Order Invoice Amount",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"author": "ForgeFlow, Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/sale-workflow",
99
"category": "Sales",
1010
"license": "LGPL-3",
1111
"summary": "Display the invoiced and uninvoiced total in the sale order",
12-
"depends": [
13-
"sale",
14-
"account",
15-
],
16-
"data": [
17-
"views/sale_order_view.xml",
18-
"views/sale_order_config_settings.xml",
19-
],
12+
"depends": ["sale", "account"],
13+
"data": ["views/sale_order_view.xml", "views/sale_order_config_settings.xml"],
2014
"installable": True,
2115
"pre_init_hook": "pre_init_hook",
2216
"assets": {

sale_order_invoice_amount/hooks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ def _add_new_columns(cr):
44
ALTER TABLE
55
sale_order
66
ADD COLUMN IF NOT EXISTS
7-
invoiced_amount numeric,
7+
amount_invoiced numeric,
88
ADD 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):
1717
UPDATE
1818
sale_order
1919
SET
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
2222
WHERE
2323
sale_order.state = 'cancel'
2424
"""
@@ -31,7 +31,7 @@ def _update_amounts_for_non_cancel_invoices(cr):
3131
WITH 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
)
7373
UPDATE 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
7676
FROM amt
7777
WHERE sale_order.id = amt.sale_order_id
7878
"""

sale_order_invoice_amount/migrations/17.0.1.0.0/post-migration.py renamed to sale_order_invoice_amount/migrations/18.0.1.0.0/post-migration.py

File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
The purpose of this module is to add two fields in the sale order model:
22

3-
- invoiced_amount: total invoiced amount.
4-
- uninvoiced_amount: total uninvoiced amount.
3+
- amount_invoiced: total invoiced amount.
4+
- amount_to_invoice: total uninvoiced amount.

sale_order_invoice_amount/static/description/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ <h1 class="title">Sale Order Invoice Amount</h1>
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_order_invoice_amount"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_invoice_amount"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>The purpose of this module is to add two fields in the sale order model:</p>
374374
<ul class="simple">
375-
<li>invoiced_amount: total invoiced amount.</li>
376-
<li>uninvoiced_amount: total uninvoiced amount.</li>
375+
<li>amount_invoiced: total invoiced amount.</li>
376+
<li>amount_to_invoice: total uninvoiced amount.</li>
377377
</ul>
378378
<p><strong>Table of contents</strong></p>
379379
<div class="contents local topic" id="contents">

sale_order_invoice_amount/static/src/xml/tax_totals.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
t-inherit-mode="extension"
77
>
88
<xpath expr="//table/tbody/tr[last()]" position="after">
9-
<tr t-if="totals.formatted_invoiced_amount">
9+
<tr t-if="totals.formatted_amount_invoiced">
1010
<td class="o_td_label">
1111
<label
1212
class="o_form_label o_tax_total_label"
@@ -15,11 +15,11 @@
1515
<td>
1616
<span
1717
style="white-space: nowrap;"
18-
t-esc="totals.formatted_invoiced_amount"
18+
t-esc="totals.formatted_amount_invoiced"
1919
/>
2020
</td>
2121
</tr>
22-
<tr t-if="totals.formatted_uninvoiced_amount">
22+
<tr t-if="totals.formatted_amount_to_invoice">
2323
<td class="o_td_label">
2424
<label
2525
class="o_form_label o_tax_total_label"
@@ -28,7 +28,7 @@
2828
<td>
2929
<span
3030
style="white-space: nowrap; "
31-
t-esc="totals.formatted_uninvoiced_amount"
31+
t-esc="totals.formatted_amount_to_invoice"
3232
/>
3333
</td>
3434
</tr>

sale_order_invoice_amount/views/sale_order_view.xml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<odoo>
3-
<record id="view_order_form_invoiced_amount" model="ir.ui.view">
4-
<field name="name">sale.order.form.invoiced.amount</field>
5-
<field name="model">sale.order</field>
6-
<field name="inherit_id" ref="sale.view_order_form" />
7-
<field name="arch" type="xml">
8-
<group name="sale_total" position="inside">
9-
<field name="amount_invoiced" />
10-
<field name="amount_to_invoice" />
11-
</group>
12-
</field>
13-
</record>
14-
<record id="view_order_tree_invoiced_amount" model="ir.ui.view">
15-
<field name="name">sale.order.tree.amount_invoiced</field>
3+
<record id="view_order_list_invoiced_amount" model="ir.ui.view">
4+
<field name="name">sale.order.list.amount_invoiced</field>
165
<field name="model">sale.order</field>
176
<field name="inherit_id" ref="sale.view_order_tree" />
187
<field name="arch" type="xml">
@@ -21,8 +10,8 @@
2110
</xpath>
2211
</field>
2312
</record>
24-
<record id="view_quotation_tree_with_onboarding_invoiced_amount" model="ir.ui.view">
25-
<field name="name">quotation.tree.with.onboarding.invoiced_amount</field>
13+
<record id="view_quotation_list_with_onboarding_invoiced_amount" model="ir.ui.view">
14+
<field name="name">quotation.list.with.onboarding.invoiced_amount</field>
2615
<field name="model">sale.order</field>
2716
<field name="inherit_id" ref="sale.view_quotation_tree_with_onboarding" />
2817
<field name="arch" type="xml">

0 commit comments

Comments
 (0)