Skip to content

Commit 15ac103

Browse files
matiasperalta1lef-adhoc
authored andcommitted
[17.0][MIG] sale_order_type: Migration to 17.0
1 parent 873e7d6 commit 15ac103

File tree

10 files changed

+23
-29
lines changed

10 files changed

+23
-29
lines changed

sale_order_type/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{
1010
"name": "Sale Order Type",
11-
"version": "16.0.1.1.0",
11+
"version": "17.0.1.0.0",
1212
"category": "Sales Management",
1313
"author": "Grupo Vermon,"
1414
"AvanzOSC,"

sale_order_type/models/account_move.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class AccountMove(models.Model):
1212
string="Sale Type",
1313
compute="_compute_sale_type_id",
1414
store=True,
15-
readonly=True,
16-
states={"draft": [("readonly", False)]},
15+
readonly=False,
1716
ondelete="restrict",
1817
copy=True,
1918
precompute=True,

sale_order_type/models/sale.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ class SaleOrder(models.Model):
1616
compute="_compute_sale_type_id",
1717
precompute=True,
1818
store=True,
19-
readonly=False,
20-
states={
21-
"sale": [("readonly", True)],
22-
"done": [("readonly", True)],
23-
"cancel": [("readonly", True)],
24-
},
2519
ondelete="restrict",
2620
copy=True,
2721
check_company=True,
@@ -182,14 +176,14 @@ def write(self, vals):
182176
new_vals["name"] = sale_type.sequence_id.next_by_id(
183177
sequence_date=vals.get("date_order")
184178
)
185-
super(SaleOrder, record).write(new_vals)
179+
super().write(new_vals)
186180
else:
187-
super(SaleOrder, record).write(vals)
181+
super().write(vals)
188182
return True
189183
return super().write(vals)
190184

191185
def _prepare_invoice(self):
192-
res = super(SaleOrder, self)._prepare_invoice()
186+
res = super()._prepare_invoice()
193187
if self.type_id.journal_id:
194188
res["journal_id"] = self.type_id.journal_id.id
195189
if self.type_id:

sale_order_type/reports/account_invoice_report_view.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
21
<odoo>
32

43
<record id="view_account_invoice_report_search" model="ir.ui.view">

sale_order_type/reports/sale_report_view.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
21
<odoo>
32

43
<record id="view_order_product_search" model="ir.ui.view">

sale_order_type/tests/test_sale_order_type.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class TestSaleOrderType(common.TransactionCase):
1313
def setUp(self):
14-
super(TestSaleOrderType, self).setUp()
14+
super().setUp()
1515
self.sale_type_model = self.env["sale.order.type"]
1616
self.sale_order_model = self.env["sale.order"]
1717
self.invoice_model = self.env["account.move"].with_context(
@@ -53,7 +53,9 @@ def setUp(self):
5353
{"type": "service", "invoice_policy": "order", "name": "Test product"}
5454
)
5555
self.immediate_payment = self.env.ref("account.account_payment_term_immediate")
56-
self.sale_pricelist = self.env.ref("product.list0")
56+
self.sale_pricelist = self.env["product.pricelist"].create(
57+
{"name": "Public Pricelist", "sequence": 1}
58+
)
5759
self.free_carrier = self.env.ref("account.incoterm_FCA")
5860
self.sale_type = self.sale_type_model.create(
5961
{

sale_order_type/views/account_move_views.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
<label for="journal_id" position="before">
88
<field
99
name="sale_type_id"
10-
attrs="{'invisible': [('move_type', 'not in', ['out_invoice', 'out_refund'])]}"
10+
invisible="move_type not in ['out_invoice', 'out_refund']"
11+
readonly="state != 'draft'"
1112
/>
1213
</label>
1314
<xpath expr="//notebook//tree//field[@name='sequence']" position="before">
14-
<field name="account_id" invisible="1" />
15+
<field name="account_id" column_invisible="True" />
1516
</xpath>
1617
</field>
1718
</record>

sale_order_type/views/sale_order_type_view.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
name="web_ribbon"
1212
title="Archived"
1313
bg_color="bg-danger"
14-
attrs="{'invisible': [('active', '=', True)]}"
14+
invisible="active"
1515
/>
1616
<div class="oe_title">
1717
<label for="name" class="oe_edit_only" />
@@ -34,7 +34,7 @@
3434
/>
3535
<field
3636
name="route_id"
37-
attrs="{'invisible': [('warehouse_id', '=', False)]}"
37+
invisible="not warehouse_id"
3838
groups="stock.group_adv_location"
3939
/>
4040
<field name="sequence_id" />
@@ -52,10 +52,7 @@
5252
name="pricelist_id"
5353
groups="product.group_product_pricelist"
5454
/>
55-
<field
56-
name="incoterm_id"
57-
groups="sale_stock.group_display_incoterm"
58-
/>
55+
<field name="incoterm_id" />
5956
</group>
6057
</group>
6158
<group>
@@ -81,7 +78,7 @@
8178
<field name="picking_policy" />
8279
<field name="payment_term_id" />
8380
<field name="pricelist_id" groups="product.group_product_pricelist" />
84-
<field name="incoterm_id" groups="sale_stock.group_display_incoterm" />
81+
<field name="incoterm_id" />
8582
<field name="company_id" groups="base.group_multi_company" />
8683
<field name="description" />
8784
</tree>
@@ -103,7 +100,7 @@
103100
<field name="picking_policy" />
104101
<field name="payment_term_id" />
105102
<field name="pricelist_id" groups="product.group_product_pricelist" />
106-
<field name="incoterm_id" groups="sale_stock.group_display_incoterm" />
103+
<field name="incoterm_id" />
107104
<field name="company_id" groups="base.group_multi_company" />
108105
<group expand="0" string="Group By">
109106
<filter
@@ -149,7 +146,6 @@
149146
string="Incoterm"
150147
domain="[]"
151148
context="{'group_by':'incoterm_id'}"
152-
groups="sale_stock.group_display_incoterm"
153149
/>
154150
</group>
155151
</search>

sale_order_type/views/sale_order_view.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<field name="inherit_id" ref="sale.view_order_form" />
66
<field name="arch" type="xml">
77
<field name="currency_id" position="after">
8-
<field name="type_id" required="1" />
8+
<field
9+
name="type_id"
10+
required="1"
11+
readonly="state in ['sale', 'cancel'] or locked"
12+
/>
913
</field>
1014
</field>
1115
</record>

sale_order_type/wizards/sale_make_invoice_advance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
88
_inherit = "sale.advance.payment.inv"
99

1010
def _prepare_invoice_values(self, order, so_line):
11-
res = super(SaleAdvancePaymentInv, self)._prepare_invoice_values(order, so_line)
11+
res = super()._prepare_invoice_values(order, so_line)
1212
if order.type_id.journal_id:
1313
res["journal_id"] = order.type_id.journal_id.id
1414
if order.type_id:

0 commit comments

Comments
 (0)