Skip to content

Commit 2d67449

Browse files
committed
[MIG] account_move_exception: Migration to 18.0
1 parent d2a8e53 commit 2d67449

File tree

9 files changed

+35
-33
lines changed

9 files changed

+35
-33
lines changed

account_move_exception/README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ Contributors
7272

7373
- Miquel Raïch <[email protected]>
7474
- Pimolnat Suntian <[email protected]>
75+
- `Komit <https://komit-consulting.com>`__:
76+
77+
- Cai Hoang Huynh
7578

7679
Maintainers
7780
-----------

account_move_exception/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Account Move Exception",
66
"summary": "Custom exceptions on account move",
7-
"version": "15.0.1.0.0",
7+
"version": "18.0.1.0.0",
88
"category": "Generic Modules/Account",
99
"author": "ForgeFlow, Odoo Community Association (OCA)",
1010
"website": "https://github.com/OCA/account-invoicing",

account_move_exception/data/account_exception_data.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
<field name="user_id" ref="base.user_root" />
1010
<field name="interval_number">20</field>
1111
<field name="interval_type">minutes</field>
12-
<field name="numbercall">-1</field>
13-
<field name="doall" eval="False" />
1412
<field name="active" eval="False" />
1513
</record>
1614
<record id="am_excep_no_email" model="exception.rule">

account_move_exception/init_hook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
logger = logging.getLogger(__name__)
1010

1111

12-
def pre_init_hook(cr):
12+
def pre_init_hook(env):
1313
"""
1414
The objective of this hook is to speed up the installation
1515
of the module on an existing Odoo instance.
1616
"""
17-
store_exception_fields(cr)
17+
store_exception_fields(env.cr)
1818

1919

2020
def store_exception_fields(cr):

account_move_exception/models/account_move.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def account_move_check_exception(self):
3131
if moves:
3232
moves._check_exception()
3333

34-
@api.onchange("line_ids")
34+
@api.onchange("invoice_line_ids")
3535
def onchange_ignore_exception(self):
3636
if self.state == "posted":
3737
self.ignore_exception = False
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
- Miquel Raïch \<[email protected]\>
22
- Pimolnat Suntian \<[email protected]\>
3+
- [Komit](https://komit-consulting.com):
4+
- Cai Hoang Huynh

account_move_exception/static/description/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
414414
<ul class="simple">
415415
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;forgeflow.com">miquel.raich&#64;forgeflow.com</a>&gt;</li>
416416
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
417+
<li><a class="reference external" href="https://komit-consulting.com">Komit</a>:<ul>
418+
<li>Cai Hoang Huynh</li>
419+
</ul>
420+
</li>
417421
</ul>
418422
</div>
419423
<div class="section" id="maintainers">

account_move_exception/tests/test_account_exception.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@ def setUp(self):
1616
self.product_id_1 = self.env.ref("product.product_product_6")
1717
self.product_id_2 = self.env.ref("product.product_product_7")
1818
self.product_id_3 = self.env.ref("product.product_product_7")
19-
self.account_receivable = self.env["account.account"].search(
20-
[
21-
(
22-
"user_type_id",
23-
"=",
24-
self.env.ref("account.data_account_type_receivable").id,
25-
)
26-
],
27-
limit=1,
28-
)
19+
2920
self.account_exception_confirm = self.env["account.exception.confirm"]
3021
self.exception_noemail = self.env.ref(
3122
"account_move_exception.am_excep_no_email"
@@ -78,20 +69,23 @@ def test_account_move_exception(self):
7869
# Add an account move to test after AM is confirmed
7970
# set ignore_exception = False (Done by onchange of line_ids)
8071
field_onchange = self.AccountMove._onchange_spec()
81-
self.assertEqual(field_onchange.get("line_ids"), "1")
72+
self.assertEqual(field_onchange.get("invoice_line_ids"), "1")
8273
self.env.cache.invalidate()
8374
self.am3New = self.AccountMove.new(self.am_vals.copy())
8475
self.am3New.ignore_exception = True
8576
self.am3New.state = "posted"
8677
self.am3New.onchange_ignore_exception()
8778
self.assertFalse(self.am3New.ignore_exception)
88-
self.am.line_ids.write(
89-
{
90-
"product_id": self.product_id_3.id,
91-
"quantity": 2,
92-
"price_unit": 30,
93-
}
94-
)
79+
self.env.cache.clear()
80+
81+
# this cannot be done on a posted invoice in 17.0
82+
# self.am.line_ids.write(
83+
# {
84+
# "product_id": self.product_id_3.id,
85+
# "quantity": 2,
86+
# "price_unit": 30,
87+
# }
88+
# )
9589

9690
# Set ignore exception True (Done manually by user)
9791
self.am.ignore_exception = True
@@ -102,6 +96,11 @@ def test_account_move_exception(self):
10296
self.am.action_post()
10397
self.assertTrue(self.am.state, "posted")
10498

99+
# avoid balance check:(fails because Record does not exist or has been deleted.)
100+
# for line in self.am.line_ids:
101+
# line.price_unit = 0.0
102+
# line.credit = 0.0
103+
105104
# Simulation the opening of the wizard account_exception_confirm and
106105
# set ignore_exception to True
107106
am_except_confirm = self.account_exception_confirm.with_context(
@@ -112,9 +111,5 @@ def test_account_move_exception(self):
112111
}
113112
).create({"ignore": True})
114113

115-
# avoid balance check:
116-
for line in self.am.line_ids:
117-
line.credit = 0.0
118-
119114
am_except_confirm.action_confirm()
120115
self.assertTrue(self.am.ignore_exception)

account_move_exception/views/account_view.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<record id="action_account_test_tree" model="ir.actions.act_window">
44
<field name="name">Account Exception Rules</field>
55
<field name="res_model">exception.rule</field>
6-
<field name="view_mode">tree,form</field>
7-
<field name="view_id" ref="base_exception.view_exception_rule_tree" />
6+
<field name="view_mode">list,form</field>
7+
<field name="view_id" ref="base_exception.view_exception_rule_list" />
88
<field
99
name="domain"
1010
>[('model', 'in', ['account.move', 'account.move.line'])]</field>
@@ -34,7 +34,7 @@
3434
class="alert alert-danger alert-dismissable"
3535
role="alert"
3636
style="margin-bottom:0px;"
37-
attrs="{'invisible':[('exceptions_summary','=', False)]}"
37+
invisible="not exceptions_summary"
3838
>
3939
<strong>You have an outstanding exception to manage:</strong>
4040
<field name="exceptions_summary" />
@@ -51,14 +51,14 @@
5151
<xpath expr="//group/group[@id='header_right_group']" position="inside">
5252
<field
5353
name="ignore_exception"
54-
states="draft"
54+
invisible="state != 'draft'"
5555
groups="base_exception.group_exception_rule_manager"
5656
/>
5757
<field
5858
name="exception_ids"
5959
widget="many2many_tags"
6060
readonly="True"
61-
attrs="{'invisible': [('exception_ids', '=', [])]}"
61+
invisible="not exception_ids"
6262
/>
6363
</xpath>
6464
</field>

0 commit comments

Comments
 (0)