Skip to content

Commit 1c7e895

Browse files
committed
[MIG] sale_invoice_plan: Migration to 17.0
1 parent fb45af7 commit 1c7e895

4 files changed

Lines changed: 27 additions & 25 deletions

File tree

sale_invoice_plan/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Sales Invoice Plan",
66
"summary": "Add to sales order, ability to manage future invoice plan",
7-
"version": "16.0.1.0.0",
7+
"version": "17.0.1.0.0",
88
"author": "Ecosoft,Odoo Community Association (OCA)",
99
"license": "AGPL-3",
1010
"website": "https://github.com/OCA/sale-workflow",

sale_invoice_plan/models/sale_invoice_plan.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class SaleInvoicePlan(models.Model):
1212
comodel_name="sale.order",
1313
string="Sales Order",
1414
index=True,
15-
readonly=True,
1615
ondelete="cascade",
1716
)
1817
analytic_account_id = fields.Many2one(related="sale_id.analytic_account_id")
@@ -58,7 +57,6 @@ class SaleInvoicePlan(models.Model):
5857
column1="plan_id",
5958
column2="move_id",
6059
string="Invoices",
61-
readonly=True,
6260
)
6361
amount_invoiced = fields.Float(compute="_compute_invoiced", store=True)
6462
to_invoice = fields.Boolean(

sale_invoice_plan/tests/test_sale_invoice_plan.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def setUpClass(cls):
5959
"code": "SJT0",
6060
}
6161
)
62+
cls.default_pricelist = cls.env['product.pricelist'].create({
63+
'name': 'Default Pricelist',
64+
})
6265

6366
cls.setUpClassicProducts()
6467

@@ -85,7 +88,7 @@ def setUpClass(cls):
8588
},
8689
)
8790
],
88-
"pricelist_id": cls.env.ref("product.list0").id,
91+
"pricelist_id": cls.default_pricelist.id,
8992
}
9093
)
9194

@@ -265,7 +268,7 @@ def test_02_invoice_plan_with_advance(self):
265268
self.assertEqual(quantity, 1, "Wrong number of total invoice quantity")
266269

267270
def test_03_unlink_invoice_plan(self):
268-
ctx = {"active_id": self.so_service.id, "active_ids": [self.so_service.id]}
271+
ctx = {"active_id": self.so_service.id}
269272
f = Form(self.env["sale.create.invoice.plan"])
270273
# Create Invoice Plan 3 installment
271274
num_installment = 3

sale_invoice_plan/views/sale_view.xml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@
55
<field name="model">sale.invoice.plan</field>
66
<field name="arch" type="xml">
77
<tree editable="bottom">
8-
<field name="no_edit" invisible="1" />
8+
<field name="no_edit" column_invisible="1" />
99
<field name="analytic_account_id" />
1010
<field
1111
name="installment"
12-
attrs="{'readonly': [('no_edit', '=', True)]}"
12+
readonly="no_edit"
1313
/>
1414
<field
1515
name="plan_date"
16-
attrs="{'readonly': [('no_edit', '=', True)]}"
16+
readonly="no_edit"
1717
/>
1818
<field
1919
name="invoice_type"
20-
attrs="{'readonly': [('no_edit', '=', True)]}"
20+
readonly="no_edit"
2121
/>
2222
<field
2323
name="percent"
2424
optional="show"
25-
attrs="{'readonly': [('no_edit', '=', True)]}"
25+
readonly="no_edit"
2626
/>
2727
<field
2828
name="amount"
2929
optional="show"
30-
attrs="{'readonly': [('no_edit', '=', True)]}"
30+
readonly="no_edit"
3131
/>
3232
<field name="amount_invoiced" optional="hide" sum="Amount" />
3333
<field name="to_invoice" />
@@ -36,8 +36,9 @@
3636
name="invoice_move_ids"
3737
optional="hide"
3838
widget="many2many_tags"
39+
readonly="1"
3940
/>
40-
<field name="last" invisible="1" />
41+
<field name="last" column_invisible="1" />
4142
</tree>
4243
</field>
4344
</record>
@@ -57,14 +58,14 @@
5758
<field name="percent" />
5859
<field name="amount" />
5960
<field name="invoiced" />
60-
<field name="invoice_move_ids" widget="many2many_tags" />
61+
<field name="invoice_move_ids" widget="many2many_tags" readonly="1"/>
6162
</group>
6263
</group>
6364
<separator
6465
string="Related Invoices"
65-
attrs="{'invisible': [('invoice_move_ids', '=', [])]}"
66+
invisible="not invoice_move_ids"
6667
/>
67-
<field name="invoice_move_ids" widget="many2many_tags" />
68+
<field name="invoice_move_ids" widget="many2many_tags" readonly="1"/>
6869
</form>
6970
</field>
7071
</record>
@@ -74,7 +75,7 @@
7475
<field name="inherit_id" ref="sale.view_order_form" />
7576
<field name="arch" type="xml">
7677
<xpath expr='/form/sheet/notebook' position="before">
77-
<div attrs="{'readonly': [('invoice_count', '>', 0)]}">
78+
<div readonly="invoice_count > 0">
7879
<field name="use_invoice_plan" />
7980
<label for="use_invoice_plan" />
8081
</div>
@@ -86,49 +87,49 @@
8687
string="Create Invoice by Plan"
8788
type="action"
8889
class="btn-primary"
89-
attrs="{'invisible': [('invoice_plan_process', '=', False)]}"
90+
invisible="not invoice_plan_process"
9091
/>
9192
</xpath>
9293
<xpath
9394
expr="//button[@name='%(sale.action_view_sale_advance_payment_inv)d'][1]"
9495
position="attributes"
9596
>
9697
<attribute
97-
name="attrs"
98-
>{'invisible': ['|', ('invoice_plan_process', '=', True), ('invoice_status', '!=', 'to invoice')]}</attribute>
98+
name="invisible"
99+
>invoice_plan_process or invoice_status != 'to invoice'</attribute>
99100
</xpath>
100101
<xpath
101102
expr="//button[@name='%(sale.action_view_sale_advance_payment_inv)d'][2]"
102103
position="attributes"
103104
>
104105
<attribute
105-
name="attrs"
106-
>{'invisible': ['|', ('invoice_plan_process', '=', True), '|', ('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}</attribute>
106+
name="invisible"
107+
>invoice_plan_process or invoice_status != 'no' or state != 'sale'</attribute>
107108
</xpath>
108109
<xpath expr="/form/sheet/notebook/page" position="after">
109110
<page
110111
string="Invoice Plan"
111-
attrs="{'invisible': [('use_invoice_plan', '=', False)]}"
112+
invisible="not use_invoice_plan"
112113
>
113114
<button
114115
name="%(action_sale_create_invoice_plan)d"
115116
string="⇒ Create Invoice Plan"
116117
type="action"
117118
class="oe_link"
118-
attrs="{'invisible': ['|', ('invoice_plan_ids', '!=', []), ('invoice_count', '>', 0)]}"
119+
invisible="invoice_plan_ids or invoice_count > 0"
119120
/>
120121
<button
121122
name="remove_invoice_plan"
122123
string="⇒ Remove Invoice Plan"
123124
type="object"
124125
class="oe_link"
125-
attrs="{'invisible': ['|', ('invoice_plan_ids', '=', []), ('invoice_count', '>', 0)]}"
126+
invisible="not invoice_plan_ids or invoice_count > 0"
126127
confirm="Are you sure to remove this invoice plan?"
127128
/>
128129
<field
129130
name="invoice_plan_ids"
130131
context="{'tree_view_ref': 'sale_invoice_plan.view_sale_invoice_plan_tree'}"
131-
attrs="{'invisible': [('invoice_plan_ids', '=', [])]}"
132+
invisible="not invoice_plan_ids"
132133
/>
133134
<group class="oe_subtotal_footer oe_right">
134135
<field name="invoice_plan_total_percent" />

0 commit comments

Comments
 (0)