odoo-addon-account-credit-control 17.0.2.2.2__py3-none-any.whl → 18.0.1.0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/account_credit_control/README.rst +8 -6
- odoo/addons/account_credit_control/__manifest__.py +1 -1
- odoo/addons/account_credit_control/data/data.xml +50 -45
- odoo/addons/account_credit_control/i18n/account_credit_control.pot +15 -60
- odoo/addons/account_credit_control/migrations/18.0.1.0.0/noupdate_changes.xml +21 -0
- odoo/addons/account_credit_control/migrations/18.0.1.0.0/post-migration.py +11 -0
- odoo/addons/account_credit_control/models/__init__.py +0 -1
- odoo/addons/account_credit_control/models/credit_control_line.py +1 -1
- odoo/addons/account_credit_control/models/credit_control_policy.py +7 -9
- odoo/addons/account_credit_control/models/mail_mail.py +4 -27
- odoo/addons/account_credit_control/readme/CONTRIBUTORS.md +2 -0
- odoo/addons/account_credit_control/report/account_credit_control_analysis.xml +3 -3
- odoo/addons/account_credit_control/report/report.xml +8 -9
- odoo/addons/account_credit_control/security/account_security.xml +6 -8
- odoo/addons/account_credit_control/static/description/index.html +6 -4
- odoo/addons/account_credit_control/tests/test_account_move.py +3 -6
- odoo/addons/account_credit_control/tests/test_credit_control_policy.py +2 -8
- odoo/addons/account_credit_control/tests/test_credit_control_run.py +12 -14
- odoo/addons/account_credit_control/tests/test_res_partner.py +37 -19
- odoo/addons/account_credit_control/views/account_move.xml +2 -2
- odoo/addons/account_credit_control/views/credit_control_communication.xml +9 -18
- odoo/addons/account_credit_control/views/credit_control_line.xml +7 -28
- odoo/addons/account_credit_control/views/credit_control_policy.xml +14 -14
- odoo/addons/account_credit_control/views/credit_control_run.xml +5 -5
- odoo/addons/account_credit_control/views/res_partner.xml +11 -12
- odoo/addons/account_credit_control/wizard/credit_control_emailer_view.xml +0 -1
- odoo/addons/account_credit_control/wizard/credit_control_marker.py +1 -1
- odoo/addons/account_credit_control/wizard/credit_control_policy_changer_view.xml +0 -1
- odoo/addons/account_credit_control/wizard/credit_control_printer_view.xml +0 -1
- {odoo_addon_account_credit_control-17.0.2.2.2.dist-info → odoo_addon_account_credit_control-18.0.1.0.0.2.dist-info}/METADATA +11 -9
- {odoo_addon_account_credit_control-17.0.2.2.2.dist-info → odoo_addon_account_credit_control-18.0.1.0.0.2.dist-info}/RECORD +33 -32
- odoo/addons/account_credit_control/models/mail_message.py +0 -25
- {odoo_addon_account_credit_control-17.0.2.2.2.dist-info → odoo_addon_account_credit_control-18.0.1.0.0.2.dist-info}/WHEEL +0 -0
- {odoo_addon_account_credit_control-17.0.2.2.2.dist-info → odoo_addon_account_credit_control-18.0.1.0.0.2.dist-info}/top_level.txt +0 -0
|
@@ -8,7 +8,10 @@ from odoo import models
|
|
|
8
8
|
class Mail(models.Model):
|
|
9
9
|
_inherit = "mail.mail"
|
|
10
10
|
|
|
11
|
-
def
|
|
11
|
+
def _postprocess_sent_message(
|
|
12
|
+
self, success_pids, failure_reason=False, failure_type=None
|
|
13
|
+
):
|
|
14
|
+
"""Mark credit control lines states."""
|
|
12
15
|
for mail in self:
|
|
13
16
|
msg = mail.mail_message_id
|
|
14
17
|
if msg.model != "credit.control.communication":
|
|
@@ -20,34 +23,8 @@ class Mail(models.Model):
|
|
|
20
23
|
)
|
|
21
24
|
new_state = "sent" if mail.state == "sent" else "email_error"
|
|
22
25
|
lines.write({"state": new_state})
|
|
23
|
-
|
|
24
|
-
def _postprocess_sent_message(
|
|
25
|
-
self, success_pids, failure_reason=False, failure_type=None
|
|
26
|
-
):
|
|
27
|
-
"""Mark credit control lines states."""
|
|
28
|
-
self._update_control_line_status()
|
|
29
26
|
return super()._postprocess_sent_message(
|
|
30
27
|
success_pids=success_pids,
|
|
31
28
|
failure_reason=failure_reason,
|
|
32
29
|
failure_type=failure_type,
|
|
33
30
|
)
|
|
34
|
-
|
|
35
|
-
def _send(
|
|
36
|
-
self,
|
|
37
|
-
auto_commit=False,
|
|
38
|
-
raise_exception=False,
|
|
39
|
-
smtp_session=None,
|
|
40
|
-
alias_domain_id=False,
|
|
41
|
-
):
|
|
42
|
-
# because of
|
|
43
|
-
# https://github.com/odoo/odoo/blob/bcba6c0dda4818e67a9023beb26593a7d74ff6a6/
|
|
44
|
-
# addons/mail/models/mail_mail.py#L606-L607
|
|
45
|
-
# we don't go through _postprocess_sent_message if the address is blacklisted
|
|
46
|
-
no_postprocess = self.filtered(lambda m: m.state != "outgoing")
|
|
47
|
-
no_postprocess._update_control_line_status()
|
|
48
|
-
return super()._send(
|
|
49
|
-
auto_commit=auto_commit,
|
|
50
|
-
raise_exception=raise_exception,
|
|
51
|
-
smtp_session=smtp_session,
|
|
52
|
-
alias_domain_id=alias_domain_id,
|
|
53
|
-
)
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
- João Marques
|
|
15
15
|
- César A. Sánchez
|
|
16
16
|
- Víctor Martínez
|
|
17
|
+
- Carlos Lopez
|
|
17
18
|
- Enric Tobella \<<etobella@creublanca.es>\>
|
|
18
19
|
- Naglis Jonaitis (Versada UAB) \<<naglis@versada.eu>\>
|
|
19
20
|
- [360ERP](https://www.360erp.com):
|
|
20
21
|
- Andrea Stirpe
|
|
22
|
+
- Kevin Khao
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
>credit.control.analysis.tree (in account_credit_control_analysis)</field>
|
|
9
9
|
<field name="model">credit.control.analysis</field>
|
|
10
10
|
<field name="arch" type="xml">
|
|
11
|
-
<
|
|
11
|
+
<list>
|
|
12
12
|
<field name="partner_id" />
|
|
13
13
|
<field name="partner_ref" />
|
|
14
14
|
<field name="policy_id" />
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<field name="level" />
|
|
17
17
|
<field name="open_balance" widget="monetary" />
|
|
18
18
|
<field name="currency_id" invisible="1" />
|
|
19
|
-
</
|
|
19
|
+
</list>
|
|
20
20
|
</field>
|
|
21
21
|
</record>
|
|
22
22
|
<record id="credit_control_analysis_pivot_view" model="ir.ui.view">
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<record model="ir.actions.act_window" id="credit_control_analysis_act_window">
|
|
38
38
|
<field name="name">Credit Control Analysis</field>
|
|
39
39
|
<field name="res_model">credit.control.analysis</field>
|
|
40
|
-
<field name="view_mode">
|
|
40
|
+
<field name="view_mode">list,pivot</field>
|
|
41
41
|
<field name="domain">[]</field>
|
|
42
42
|
<field name="context">{}</field>
|
|
43
43
|
</record>
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
2
|
<odoo>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<record id="credit_control_summary" model="ir.actions.report">
|
|
4
|
+
<field name="name">Credit Control Summary</field>
|
|
5
|
+
<field name="model">credit.control.communication</field>
|
|
6
|
+
<field name="report_type">qweb-pdf</field>
|
|
7
|
+
<field
|
|
8
8
|
name="report_name"
|
|
9
9
|
>account_credit_control.report_credit_control_summary</field>
|
|
10
|
-
|
|
10
|
+
<field
|
|
11
11
|
name="report_file"
|
|
12
12
|
>account_credit_control.report_credit_control_summary</field>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
<field name="binding_type">report</field>
|
|
14
|
+
</record>
|
|
16
15
|
</odoo>
|
|
@@ -41,15 +41,13 @@
|
|
|
41
41
|
<field name="global" eval="True" />
|
|
42
42
|
<field
|
|
43
43
|
name="domain_force"
|
|
44
|
-
>[
|
|
44
|
+
>[('company_id','in',company_ids + [False])]</field>
|
|
45
45
|
</record>
|
|
46
46
|
<record id="credit_control_communication_rule" model="ir.rule">
|
|
47
47
|
<field name="name">Credit Control Communication</field>
|
|
48
48
|
<field name="model_id" ref="model_credit_control_communication" />
|
|
49
49
|
<field name="global" eval="True" />
|
|
50
|
-
<field
|
|
51
|
-
name="domain_force"
|
|
52
|
-
>['|',('company_id','=',False),('company_id','in',company_ids)]</field>
|
|
50
|
+
<field name="domain_force">[('company_id','in',company_ids)]</field>
|
|
53
51
|
</record>
|
|
54
52
|
<record id="credit_control_line_rule" model="ir.rule">
|
|
55
53
|
<field name="name">Credit Control Line</field>
|
|
@@ -57,7 +55,7 @@
|
|
|
57
55
|
<field name="global" eval="True" />
|
|
58
56
|
<field
|
|
59
57
|
name="domain_force"
|
|
60
|
-
>[
|
|
58
|
+
>[('company_id','in',company_ids + [False])]</field>
|
|
61
59
|
</record>
|
|
62
60
|
<record id="credit_control_policy_rule" model="ir.rule">
|
|
63
61
|
<field name="name">Credit Control Policy</field>
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
<field name="global" eval="True" />
|
|
66
64
|
<field
|
|
67
65
|
name="domain_force"
|
|
68
|
-
>[
|
|
66
|
+
>[('company_id','in',company_ids + [False])]</field>
|
|
69
67
|
</record>
|
|
70
68
|
<record id="credit_control_analysis_rule" model="ir.rule">
|
|
71
69
|
<field name="name">Credit Control Analysis</field>
|
|
@@ -73,7 +71,7 @@
|
|
|
73
71
|
<field name="global" eval="True" />
|
|
74
72
|
<field
|
|
75
73
|
name="domain_force"
|
|
76
|
-
>[
|
|
74
|
+
>[('company_id','in',company_ids + [False])]</field>
|
|
77
75
|
</record>
|
|
78
76
|
<record id="credit_control_partner_payment_action_type_rule" model="ir.rule">
|
|
79
77
|
<field name="name">Credit Control Partner Payment Action Type</field>
|
|
@@ -81,7 +79,7 @@
|
|
|
81
79
|
<field name="global" eval="True" />
|
|
82
80
|
<field
|
|
83
81
|
name="domain_force"
|
|
84
|
-
>[
|
|
82
|
+
>[('company_id','in',company_ids + [False])]</field>
|
|
85
83
|
</record>
|
|
86
84
|
<record id="base.user_admin" model="res.users">
|
|
87
85
|
<field
|
|
@@ -367,9 +367,9 @@ ul.auto-toc {
|
|
|
367
367
|
!! This file is generated by oca-gen-addon-readme !!
|
|
368
368
|
!! changes will be overwritten. !!
|
|
369
369
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
370
|
-
!! source digest: sha256:
|
|
370
|
+
!! source digest: sha256:62f3291d80cd43c777aa84d4777818c614789496f49c051ac34aaafd73a9bd83
|
|
371
371
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
372
|
-
<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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/credit-control/tree/
|
|
372
|
+
<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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/credit-control/tree/18.0/account_credit_control"><img alt="OCA/credit-control" src="https://img.shields.io/badge/github-OCA%2Fcredit--control-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/credit-control-18-0/credit-control-18-0-account_credit_control"><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/credit-control&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
373
373
|
<p>Account Credit Control module is a part of Financial Tools used in
|
|
374
374
|
business to ensure that once sales are made they are realised as cash.
|
|
375
375
|
This module helps to identify outstanding debt beyond tolerance level
|
|
@@ -430,7 +430,7 @@ automatically added as followers to the credit control lines.</p>
|
|
|
430
430
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/credit-control/issues">GitHub Issues</a>.
|
|
431
431
|
In case of trouble, please check there if your issue has already been reported.
|
|
432
432
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
433
|
-
<a class="reference external" href="https://github.com/OCA/credit-control/issues/new?body=module:%20account_credit_control%0Aversion:%
|
|
433
|
+
<a class="reference external" href="https://github.com/OCA/credit-control/issues/new?body=module:%20account_credit_control%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
|
434
434
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
|
435
435
|
</div>
|
|
436
436
|
<div class="section" id="credits">
|
|
@@ -464,12 +464,14 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|
|
464
464
|
<li>João Marques</li>
|
|
465
465
|
<li>César A. Sánchez</li>
|
|
466
466
|
<li>Víctor Martínez</li>
|
|
467
|
+
<li>Carlos Lopez</li>
|
|
467
468
|
</ul>
|
|
468
469
|
</li>
|
|
469
470
|
<li>Enric Tobella <<a class="reference external" href="mailto:etobella@creublanca.es">etobella@creublanca.es</a>></li>
|
|
470
471
|
<li>Naglis Jonaitis (Versada UAB) <<a class="reference external" href="mailto:naglis@versada.eu">naglis@versada.eu</a>></li>
|
|
471
472
|
<li><a class="reference external" href="https://www.360erp.com">360ERP</a>:<ul>
|
|
472
473
|
<li>Andrea Stirpe</li>
|
|
474
|
+
<li>Kevin Khao</li>
|
|
473
475
|
</ul>
|
|
474
476
|
</li>
|
|
475
477
|
</ul>
|
|
@@ -483,7 +485,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|
|
483
485
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
484
486
|
mission is to support the collaborative development of Odoo features and
|
|
485
487
|
promote its widespread use.</p>
|
|
486
|
-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/credit-control/tree/
|
|
488
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/credit-control/tree/18.0/account_credit_control">OCA/credit-control</a> project on GitHub.</p>
|
|
487
489
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
|
488
490
|
</div>
|
|
489
491
|
</div>
|
|
@@ -7,19 +7,16 @@ from dateutil import relativedelta
|
|
|
7
7
|
|
|
8
8
|
from odoo import fields
|
|
9
9
|
from odoo.exceptions import UserError
|
|
10
|
-
from odoo.tests import tagged
|
|
11
|
-
from odoo.tests.common import Form
|
|
10
|
+
from odoo.tests import Form, tagged
|
|
12
11
|
|
|
13
12
|
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
|
14
|
-
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
@tagged("post_install", "-at_install")
|
|
18
16
|
class TestAccountInvoice(AccountTestInvoicingCommon):
|
|
19
17
|
@classmethod
|
|
20
|
-
def setUpClass(cls
|
|
21
|
-
super().setUpClass(
|
|
22
|
-
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
|
|
18
|
+
def setUpClass(cls):
|
|
19
|
+
super().setUpClass()
|
|
23
20
|
cls.env.user.groups_id |= cls.env.ref(
|
|
24
21
|
"account_credit_control.group_account_credit_control_manager"
|
|
25
22
|
)
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
3
3
|
from odoo.exceptions import UserError, ValidationError
|
|
4
4
|
from odoo.tests import tagged
|
|
5
|
-
from odoo.tests.common import TransactionCase
|
|
6
5
|
|
|
7
|
-
from odoo.addons.base.tests.common import
|
|
6
|
+
from odoo.addons.base.tests.common import BaseCommon
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
@tagged("post_install", "-at_install")
|
|
11
|
-
class TestCreditControlPolicy(
|
|
12
|
-
@classmethod
|
|
13
|
-
def setUpClass(cls):
|
|
14
|
-
super().setUpClass()
|
|
15
|
-
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
|
|
16
|
-
|
|
10
|
+
class TestCreditControlPolicy(BaseCommon):
|
|
17
11
|
def test_check_policy_against_account(self):
|
|
18
12
|
"""
|
|
19
13
|
Test the model check_policy_against_account with several case
|
|
@@ -9,19 +9,16 @@ from dateutil import relativedelta
|
|
|
9
9
|
|
|
10
10
|
from odoo import fields
|
|
11
11
|
from odoo.exceptions import AccessError, UserError
|
|
12
|
-
from odoo.tests import RecordCapturer, tagged
|
|
13
|
-
from odoo.tests.common import Form
|
|
12
|
+
from odoo.tests import Form, RecordCapturer, tagged
|
|
14
13
|
|
|
15
14
|
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
|
16
|
-
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
@tagged("post_install", "-at_install")
|
|
20
18
|
class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
21
19
|
@classmethod
|
|
22
|
-
def setUpClass(cls
|
|
23
|
-
super().setUpClass(
|
|
24
|
-
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
|
|
20
|
+
def setUpClass(cls):
|
|
21
|
+
super().setUpClass()
|
|
25
22
|
cls.env.user.groups_id |= cls.env.ref(
|
|
26
23
|
"account_credit_control.group_account_credit_control_manager"
|
|
27
24
|
)
|
|
@@ -130,8 +127,8 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
|
130
127
|
)
|
|
131
128
|
|
|
132
129
|
report_regex = (
|
|
133
|
-
|
|
134
|
-
r"\d+ Credit Control Lines.</b><br></p>"
|
|
130
|
+
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
|
|
131
|
+
r"\d+ Credit Control Lines.</b><br></p>"
|
|
135
132
|
)
|
|
136
133
|
regex_result = re.match(report_regex, control_run.report)
|
|
137
134
|
self.assertIsNotNone(regex_result)
|
|
@@ -216,8 +213,8 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
|
216
213
|
self.assertEqual(control_run.state, "done")
|
|
217
214
|
|
|
218
215
|
report_regex = (
|
|
219
|
-
|
|
220
|
-
r"\d+ Credit Control Lines.</b><br></p>"
|
|
216
|
+
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
|
|
217
|
+
r"\d+ Credit Control Lines.</b><br></p>"
|
|
221
218
|
)
|
|
222
219
|
regex_result = re.match(report_regex, control_run.report)
|
|
223
220
|
self.assertIsNotNone(regex_result)
|
|
@@ -251,8 +248,8 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
|
251
248
|
self.assertEqual(control_run.state, "done")
|
|
252
249
|
|
|
253
250
|
report_regex = (
|
|
254
|
-
|
|
255
|
-
r"\d+ Credit Control Lines.</b><br></p>"
|
|
251
|
+
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
|
|
252
|
+
r"\d+ Credit Control Lines.</b><br></p>"
|
|
256
253
|
)
|
|
257
254
|
regex_result = re.match(report_regex, control_run.report)
|
|
258
255
|
self.assertIsNotNone(regex_result)
|
|
@@ -291,7 +288,9 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
|
291
288
|
{"name": "to_be_sent", "line_ids": [(6, 0, control_lines.ids)]}
|
|
292
289
|
)
|
|
293
290
|
marker.mark_lines()
|
|
294
|
-
emailer_obj = self.env["credit.control.emailer"]
|
|
291
|
+
emailer_obj = self.env["credit.control.emailer"].with_context(
|
|
292
|
+
domain_notifications_email="test@example.com"
|
|
293
|
+
)
|
|
295
294
|
wiz_emailer = emailer_obj.create({})
|
|
296
295
|
wiz_emailer.line_ids = control_lines
|
|
297
296
|
with RecordCapturer(self.env["credit.control.communication"], []) as capture:
|
|
@@ -309,7 +308,6 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
|
|
|
309
308
|
{"name": "to_be_sent", "line_ids": [(6, 0, control_lines.ids)]}
|
|
310
309
|
)
|
|
311
310
|
marker.mark_lines()
|
|
312
|
-
emailer_obj = self.env["credit.control.emailer"]
|
|
313
311
|
wiz_emailer = emailer_obj.create({})
|
|
314
312
|
wiz_emailer.line_ids = control_lines
|
|
315
313
|
with RecordCapturer(self.env["credit.control.communication"], []) as capture:
|
|
@@ -3,17 +3,25 @@
|
|
|
3
3
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
4
4
|
from odoo.exceptions import ValidationError
|
|
5
5
|
from odoo.tests import tagged
|
|
6
|
-
from odoo.tests.common import TransactionCase
|
|
7
6
|
|
|
8
|
-
from odoo.addons.base.tests.common import
|
|
7
|
+
from odoo.addons.base.tests.common import BaseCommon
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
@tagged("post_install", "-at_install")
|
|
12
|
-
class TestCreditControlPolicyLevel(
|
|
11
|
+
class TestCreditControlPolicyLevel(BaseCommon):
|
|
13
12
|
@classmethod
|
|
14
13
|
def setUpClass(cls):
|
|
15
14
|
super().setUpClass()
|
|
16
|
-
cls.
|
|
15
|
+
cls.partner = cls.env["res.partner"].create({"name": "Partner 1"})
|
|
16
|
+
cls.account = cls.env["account.account"].create(
|
|
17
|
+
{
|
|
18
|
+
"code": "400001",
|
|
19
|
+
"name": "Test",
|
|
20
|
+
"account_type": "asset_receivable",
|
|
21
|
+
"reconcile": True,
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
cls.partner.property_account_receivable_id = cls.account
|
|
17
25
|
|
|
18
26
|
def test_check_credit_policy(self):
|
|
19
27
|
"""
|
|
@@ -24,20 +32,30 @@ class TestCreditControlPolicyLevel(TransactionCase):
|
|
|
24
32
|
retry to assign this policy and this account on the partner
|
|
25
33
|
"""
|
|
26
34
|
policy = self.env.ref("account_credit_control.credit_control_3_time")
|
|
27
|
-
partner = self.env["res.partner"].create({"name": "Partner 1"})
|
|
28
|
-
account = self.env["account.account"].create(
|
|
29
|
-
{
|
|
30
|
-
"code": "400001",
|
|
31
|
-
"name": "Test",
|
|
32
|
-
"account_type": "asset_receivable",
|
|
33
|
-
"reconcile": True,
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
partner.property_account_receivable_id = account
|
|
37
|
-
|
|
38
35
|
with self.assertRaises(ValidationError):
|
|
39
|
-
partner.write({"credit_policy_id": policy.id})
|
|
36
|
+
self.partner.write({"credit_policy_id": policy.id})
|
|
40
37
|
|
|
41
|
-
policy.write({"account_ids": [(6, 0, [account.id])]})
|
|
42
|
-
partner.property_account_receivable_id = account.id
|
|
43
|
-
partner.credit_policy_id = policy.id
|
|
38
|
+
policy.write({"account_ids": [(6, 0, [self.account.id])]})
|
|
39
|
+
self.partner.property_account_receivable_id = self.account.id
|
|
40
|
+
self.partner.credit_policy_id = policy.id
|
|
41
|
+
|
|
42
|
+
def test_search_credit_policy(self):
|
|
43
|
+
"""
|
|
44
|
+
Test the search of the credit policy
|
|
45
|
+
First we try to search a policy without account
|
|
46
|
+
After that we add the account in the policy and
|
|
47
|
+
retry to search the policy
|
|
48
|
+
"""
|
|
49
|
+
Policy = self.env["credit.control.policy"].with_context(
|
|
50
|
+
account_receivable_partner_id=self.partner.id
|
|
51
|
+
)
|
|
52
|
+
policy = self.env.ref("account_credit_control.credit_control_3_time")
|
|
53
|
+
self.assertFalse(policy.account_ids)
|
|
54
|
+
domain = [("display_name", "=", "3 time policy")]
|
|
55
|
+
policy_find = Policy.search(domain)
|
|
56
|
+
self.assertFalse(policy_find)
|
|
57
|
+
# Add the account to the policy
|
|
58
|
+
policy.write({"account_ids": [(6, 0, [self.account.id])]})
|
|
59
|
+
policy_find = Policy.search(domain)
|
|
60
|
+
self.assertEqual(len(policy_find), 1)
|
|
61
|
+
self.assertEqual(policy_find, policy)
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</group>
|
|
31
31
|
<separator string="Issued Lines" colspan="4" />
|
|
32
32
|
<field name="credit_control_line_ids" colspan="4" nolabel="1">
|
|
33
|
-
<
|
|
33
|
+
<list>
|
|
34
34
|
<field name="date" />
|
|
35
35
|
<field name="level" />
|
|
36
36
|
<field name="state" />
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<field name="balance_due" />
|
|
39
39
|
<field name="policy_level_id" />
|
|
40
40
|
<field name="policy_id" />
|
|
41
|
-
</
|
|
41
|
+
</list>
|
|
42
42
|
</field>
|
|
43
43
|
</page>
|
|
44
44
|
</notebook>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</group>
|
|
36
36
|
</group>
|
|
37
37
|
<field name="credit_control_line_ids" nolabel="1">
|
|
38
|
-
<
|
|
38
|
+
<list>
|
|
39
39
|
<field name="date" />
|
|
40
40
|
<field name="level" />
|
|
41
41
|
<field name="state" />
|
|
@@ -43,14 +43,10 @@
|
|
|
43
43
|
<field name="balance_due" />
|
|
44
44
|
<field name="policy_level_id" />
|
|
45
45
|
<field name="policy_id" />
|
|
46
|
-
</
|
|
46
|
+
</list>
|
|
47
47
|
</field>
|
|
48
48
|
</sheet>
|
|
49
|
-
<
|
|
50
|
-
<field name="message_follower_ids" />
|
|
51
|
-
<field name="activity_ids" />
|
|
52
|
-
<field name="message_ids" />
|
|
53
|
-
</div>
|
|
49
|
+
<chatter />
|
|
54
50
|
</form>
|
|
55
51
|
</field>
|
|
56
52
|
</record>
|
|
@@ -73,21 +69,18 @@
|
|
|
73
69
|
name="group_by_report_date"
|
|
74
70
|
domain='[]'
|
|
75
71
|
context="{'group_by': 'report_date'}"
|
|
76
|
-
icon="terp-go-month"
|
|
77
72
|
string="Run date"
|
|
78
73
|
/>
|
|
79
74
|
<filter
|
|
80
75
|
name="group_by_partner"
|
|
81
76
|
domain='[]'
|
|
82
77
|
context="{'group_by': 'partner_id'}"
|
|
83
|
-
icon="terp-partner"
|
|
84
78
|
string="Partner"
|
|
85
79
|
/>
|
|
86
80
|
<filter
|
|
87
81
|
name="group_by_company"
|
|
88
82
|
domain='[]'
|
|
89
83
|
context="{'group_by': 'company_id'}"
|
|
90
|
-
icon="terp-company"
|
|
91
84
|
string="Company"
|
|
92
85
|
groups="base.group_multi_company"
|
|
93
86
|
/>
|
|
@@ -95,14 +88,12 @@
|
|
|
95
88
|
name="group_by_policy"
|
|
96
89
|
domain='[]'
|
|
97
90
|
context="{'group_by': 'policy_id'}"
|
|
98
|
-
icon="terp-document-new"
|
|
99
91
|
string="Credit policy"
|
|
100
92
|
/>
|
|
101
93
|
<filter
|
|
102
94
|
name="group_by_policy_level"
|
|
103
95
|
domain='[]'
|
|
104
96
|
context="{'group_by': 'policy_level_id'}"
|
|
105
|
-
icon="terp-document-new"
|
|
106
97
|
string="Credit policy level"
|
|
107
98
|
/>
|
|
108
99
|
<filter
|
|
@@ -115,33 +106,33 @@
|
|
|
115
106
|
</field>
|
|
116
107
|
</record>
|
|
117
108
|
<record id="credit_control_communication_tree_view" model="ir.ui.view">
|
|
118
|
-
<field name="name">credit.control.communication.
|
|
109
|
+
<field name="name">credit.control.communication.list</field>
|
|
119
110
|
<field name="model">credit.control.communication</field>
|
|
120
111
|
<field name="arch" type="xml">
|
|
121
|
-
<
|
|
112
|
+
<list>
|
|
122
113
|
<field name="partner_id" />
|
|
123
114
|
<field name="user_id" />
|
|
124
115
|
<field name="company_id" groups="base.group_multi_company" />
|
|
125
116
|
<field name="policy_level_id" />
|
|
126
117
|
<field name="policy_id" />
|
|
127
118
|
<field name="report_date" />
|
|
128
|
-
</
|
|
119
|
+
</list>
|
|
129
120
|
</field>
|
|
130
121
|
</record>
|
|
131
122
|
<record model="ir.actions.act_window" id="credit_control_communication_action">
|
|
132
123
|
<field name="name">Credit Control Communications</field>
|
|
133
124
|
<field name="type">ir.actions.act_window</field>
|
|
134
125
|
<field name="res_model">credit.control.communication</field>
|
|
135
|
-
<field name="view_mode">
|
|
126
|
+
<field name="view_mode">list,form</field>
|
|
136
127
|
<!-- <field name="view_id" ref="credit_control_communication_tree_view"/> -->
|
|
137
128
|
<field name="help" type="html">
|
|
138
129
|
<p class="oe_view_nocontent_create">
|
|
139
130
|
Go to <i
|
|
140
|
-
|
|
131
|
+
>Invoicing > Credit Control > Credit Control Run</i> to create a new credit control communication process.
|
|
141
132
|
</p>
|
|
142
133
|
<p>
|
|
143
134
|
That's the most common way of creating these records. However, you can do it from here too if you want, by pressing <i
|
|
144
|
-
|
|
135
|
+
>Create</i>.
|
|
145
136
|
</p>
|
|
146
137
|
</field>
|
|
147
138
|
</record>
|