odoo-addon-account-credit-control 17.0.1.0.0.6__py3-none-any.whl → 17.0.1.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.
@@ -7,7 +7,7 @@ Account Credit Control
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:84b63f80f165080cb9565e2d87f1d264c86eb79efc17329fec67fa1c76b52975
10
+ !! source digest: sha256:9e3b9bac3655ebbdaccaf60a56920e5ff2be88560cadc2348ec8b8a467e0740f
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -5,7 +5,7 @@
5
5
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
6
6
  {
7
7
  "name": "Account Credit Control",
8
- "version": "17.0.1.0.0",
8
+ "version": "17.0.1.0.2",
9
9
  "author": "Camptocamp,"
10
10
  "Odoo Community Association (OCA),"
11
11
  "Okia,"
@@ -128,6 +128,9 @@ class CreditControlCommunication(models.Model):
128
128
  """Aggregate credit control line by partner, level, and currency"""
129
129
  if not lines:
130
130
  return []
131
+ # Needed for related stored fields
132
+ # are recomputed before executing the SQL
133
+ lines.flush_recordset()
131
134
  sql = (
132
135
  "SELECT distinct partner_id, policy_level_id, "
133
136
  " credit_control_line.currency_id, "
@@ -273,7 +273,7 @@ class CreditControlPolicyLevel(models.Model):
273
273
  delay_days = fields.Integer(string="Delay (in days)", required=True)
274
274
  email_template_id = fields.Many2one(
275
275
  comodel_name="mail.template",
276
- domain=[("model_id.model", "=", "credit.control.communication")],
276
+ domain=[("model", "=", "credit.control.communication")],
277
277
  required=True,
278
278
  )
279
279
  channel = fields.Selection(selection=CHANNEL_LIST, required=True)
@@ -367,7 +367,7 @@ 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:84b63f80f165080cb9565e2d87f1d264c86eb79efc17329fec67fa1c76b52975
370
+ !! source digest: sha256:9e3b9bac3655ebbdaccaf60a56920e5ff2be88560cadc2348ec8b8a467e0740f
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
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/17.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-17-0/credit-control-17-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&amp;target_branch=17.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
@@ -9,7 +9,7 @@ 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 tagged
12
+ from odoo.tests import RecordCapturer, tagged
13
13
  from odoo.tests.common import Form
14
14
 
15
15
  from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -216,6 +216,55 @@ class TestCreditControlRun(AccountTestInvoicingCommon):
216
216
  ).create({})
217
217
  wiz_printer.print_lines()
218
218
 
219
+ def test_sent_email_invoice_detail(self):
220
+ """
221
+ Verify that the email is sent and includes the invoice details
222
+ """
223
+ policy_level_expected = self.env.ref("account_credit_control.3_time_1")
224
+ # assign a email to ensure does not fallback to letter
225
+ self.invoice.partner_id.email = "test@test.com"
226
+ control_run = self.env["credit.control.run"].create(
227
+ {"date": fields.Date.today(), "policy_ids": [(6, 0, [self.policy.id])]}
228
+ )
229
+ control_run.with_context(lang="en_US").generate_credit_lines()
230
+ self.assertTrue(len(self.invoice.credit_control_line_ids), 1)
231
+ control_lines = self.invoice.credit_control_line_ids
232
+ self.assertEqual(control_lines.policy_level_id, policy_level_expected)
233
+ # CASE 1: set the policy level to show invoice details = True
234
+ control_lines.policy_level_id.mail_show_invoice_detail = True
235
+ marker = self.env["credit.control.marker"].create(
236
+ {"name": "to_be_sent", "line_ids": [(6, 0, control_lines.ids)]}
237
+ )
238
+ marker.mark_lines()
239
+ emailer_obj = self.env["credit.control.emailer"]
240
+ wiz_emailer = emailer_obj.create({})
241
+ wiz_emailer.line_ids = control_lines
242
+ with RecordCapturer(self.env["credit.control.communication"], []) as capture:
243
+ wiz_emailer.email_lines()
244
+ new_communication = capture.records
245
+ self.assertEqual(len(new_communication), 1)
246
+ self.assertEqual(len(new_communication.message_ids), 1)
247
+ # Verify that the email include the invoice details.
248
+ self.assertIn("Invoices summary", new_communication.message_ids.body)
249
+ self.assertIn(self.invoice.name, new_communication.message_ids.body)
250
+ # CASE 2: set the policy level to show invoice details = False
251
+ control_lines.policy_level_id.mail_show_invoice_detail = False
252
+ marker = self.env["credit.control.marker"].create(
253
+ {"name": "to_be_sent", "line_ids": [(6, 0, control_lines.ids)]}
254
+ )
255
+ marker.mark_lines()
256
+ emailer_obj = self.env["credit.control.emailer"]
257
+ wiz_emailer = emailer_obj.create({})
258
+ wiz_emailer.line_ids = control_lines
259
+ with RecordCapturer(self.env["credit.control.communication"], []) as capture:
260
+ wiz_emailer.email_lines()
261
+ new_communication = capture.records
262
+ self.assertEqual(len(new_communication), 1)
263
+ self.assertEqual(len(new_communication.message_ids), 1)
264
+ # Verify that the email does not include the invoice details.
265
+ self.assertNotIn("Invoices summary", new_communication.message_ids.body)
266
+ self.assertNotIn(self.invoice.name, new_communication.message_ids.body)
267
+
219
268
  def test_open_credit_lines(self):
220
269
  """
221
270
  Test access rights when invoking method open_credit_lines
@@ -45,6 +45,7 @@
45
45
  <group colspan="2">
46
46
  <field
47
47
  name="email_template_id"
48
+ context="{'default_model': 'credit.control.communication'}"
48
49
  colspan="2"
49
50
  />
50
51
  <field name="custom_text" colspan="2" />
@@ -3,22 +3,25 @@
3
3
 
4
4
  from markupsafe import Markup
5
5
 
6
- from odoo import models
6
+ from odoo import api, models
7
7
 
8
8
 
9
9
  class MailComposer(models.TransientModel):
10
10
  _inherit = "mail.compose.message"
11
11
 
12
- def _onchange_template_id(self, template_id, composition_mode, model, res_id):
13
- res = super()._onchange_template_id(
14
- template_id=template_id,
15
- composition_mode=composition_mode,
16
- model=model,
17
- res_id=res_id,
18
- )
12
+ @api.depends_context("inject_credit_control_communication_table")
13
+ def _compute_body(self):
14
+ res = super()._compute_body()
19
15
  if self.env.context.get("inject_credit_control_communication_table"):
20
- record = self.env[model].browse(res_id)
21
- res["value"]["body"] += Markup(
22
- record._get_credit_control_communication_table()
23
- )
16
+ for composer in self:
17
+ res_ids = composer._evaluate_res_ids()
18
+ if composer.model and len(res_ids) == 1:
19
+ record = self.env[composer.model].browse(res_ids)
20
+ credit_control_communication = Markup(
21
+ record._get_credit_control_communication_table()
22
+ )
23
+ if composer.body:
24
+ composer.body += credit_control_communication
25
+ else:
26
+ composer.body = credit_control_communication
24
27
  return res
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-account_credit_control
3
- Version: 17.0.1.0.0.6
3
+ Version: 17.0.1.0.2
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: odoo>=17.0a,<17.1dev
6
6
  Summary: Account Credit Control
@@ -22,7 +22,7 @@ Account Credit Control
22
22
  !! This file is generated by oca-gen-addon-readme !!
23
23
  !! changes will be overwritten. !!
24
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25
- !! source digest: sha256:84b63f80f165080cb9565e2d87f1d264c86eb79efc17329fec67fa1c76b52975
25
+ !! source digest: sha256:9e3b9bac3655ebbdaccaf60a56920e5ff2be88560cadc2348ec8b8a467e0740f
26
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
27
 
28
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -1,6 +1,6 @@
1
- odoo/addons/account_credit_control/README.rst,sha256=95GyRhIkMpMIcF39WXi-gk3XcZO7UOpi1uPiu9LT8NI,5273
1
+ odoo/addons/account_credit_control/README.rst,sha256=j17Q0lWWkPUxJ0fpO_t2mG0H2KMCxprLnnNaM6LdHqk,5273
2
2
  odoo/addons/account_credit_control/__init__.py,sha256=8MjrwJNjAjKy6j77I1529EUbQMh7TZ867lnz-KzifyI,127
3
- odoo/addons/account_credit_control/__manifest__.py,sha256=HhKK7KHvLzTVXmp4hJoG2IRIvJzZ1eLNe1f-axdPPsk,1598
3
+ odoo/addons/account_credit_control/__manifest__.py,sha256=HvFka9e1ZTSdwJ7jNwveGVEmIMDxkqJ7QEDv4cWweqE,1598
4
4
  odoo/addons/account_credit_control/data/data.xml,sha256=_0InXFCkHK5nkZbacV-qXpg4LqMGIpk3A7pWFhAyw08,10648
5
5
  odoo/addons/account_credit_control/demo/res_users.xml,sha256=KWDhrbbE4VTCHpkvFMu49yeLkGdwIson7hOkboR-0dE,372
6
6
  odoo/addons/account_credit_control/i18n/account_credit_control.pot,sha256=49h0-kRMIgrbZwR7tfMijZ1rYjGGfq7G2xyjI-z_Hbk,75866
@@ -83,9 +83,9 @@ odoo/addons/account_credit_control/i18n/zh_TW.po,sha256=ePDAMPDhkdbiV_envAj2fmgn
83
83
  odoo/addons/account_credit_control/models/__init__.py,sha256=sb3eOYTLCrhAigyAPEqvfhhTc5oSQoUOqCju7LhgeNI,404
84
84
  odoo/addons/account_credit_control/models/account_account.py,sha256=k7A1hrH2xi-em9uvuBsYuAj-UviL1s_X7wK0GprbZI4,503
85
85
  odoo/addons/account_credit_control/models/account_move.py,sha256=MzN_JSc7GcuDq3YsXOWs7pgk3e8Wt2QtFRlxifoUe24,2128
86
- odoo/addons/account_credit_control/models/credit_control_communication.py,sha256=dQl5FRTp1KU4y2fqw-xbH2vpMpfl42VKD9G7LjPwP1c,9275
86
+ odoo/addons/account_credit_control/models/credit_control_communication.py,sha256=jL2NPGwyh_ZuR_x2Pg6Iu748xuURrvUyRspYUaK7fbM,9400
87
87
  odoo/addons/account_credit_control/models/credit_control_line.py,sha256=2IewoX1ZIXHNpXZT0lwICheWJSf0aSC5LYumMz_n_Pg,10381
88
- odoo/addons/account_credit_control/models/credit_control_policy.py,sha256=W74qKxwxTCGRMQIOCCpN_MCuTsTiYS7k7H29Iw0XnOk,16461
88
+ odoo/addons/account_credit_control/models/credit_control_policy.py,sha256=0EuDk4sq0aFdSWgOL-5aLuS-D1NM-FiHjLke2m0LXJk,16452
89
89
  odoo/addons/account_credit_control/models/credit_control_run.py,sha256=6kCfWhfD3PiXjRIVmEko_wpArisbTFPTABhfCtdxb3s,7433
90
90
  odoo/addons/account_credit_control/models/mail_mail.py,sha256=Dj9BtaMn-Bda7LJ75CWbtO2nmq4qBcWyB8NBeH7Kkfg,1173
91
91
  odoo/addons/account_credit_control/models/mail_message.py,sha256=ZogeU-PTBLTNaW19w49cEYzKgEDcTO9FvCJTQ2Mwm7Q,818
@@ -104,16 +104,16 @@ odoo/addons/account_credit_control/report/report_credit_control_summary.xml,sha2
104
104
  odoo/addons/account_credit_control/security/account_security.xml,sha256=72GmbiYqrJBdjAap88o3k-g8Y76jM5CCIZbZc6_TGuY,4071
105
105
  odoo/addons/account_credit_control/security/ir.model.access.csv,sha256=FgKzKdftXknPsreudq4NdvaGqxuUaVWWxGgmrfjHqRA,5531
106
106
  odoo/addons/account_credit_control/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
107
- odoo/addons/account_credit_control/static/description/index.html,sha256=GaPdaqVUKICZR6cFVpq30WJkvgVGa15m4fyj_CJPHS8,15881
107
+ odoo/addons/account_credit_control/static/description/index.html,sha256=SFPW_zueq-AiK91_0Kjh81DR58OwLIAaAb2_OMXUu-M,15881
108
108
  odoo/addons/account_credit_control/tests/__init__.py,sha256=ytdwXdWp6qfFDhN08R3rfI-w_AriEuONj3VSBV3Ztb0,206
109
109
  odoo/addons/account_credit_control/tests/test_account_move.py,sha256=H62QDrGocrqHKK1ayf5DaUnerCo0_MHrFjgo__fdK68,11178
110
110
  odoo/addons/account_credit_control/tests/test_credit_control_policy.py,sha256=IzBsyIf7iJXUP3jG3_T2yW6bKLJ4HbcvAuyfmC2Wui8,3210
111
- odoo/addons/account_credit_control/tests/test_credit_control_run.py,sha256=ZogJGYVk3A_gvN6bqelcNywRFF4HqN3RMfizR2dhicw,10988
111
+ odoo/addons/account_credit_control/tests/test_credit_control_run.py,sha256=CNYR9NVbIuqHJJcrdH0e_6oc94N8MfMuOkKalJtPAzE,13718
112
112
  odoo/addons/account_credit_control/tests/test_res_partner.py,sha256=GnQsu6T2suBp_44nJlUjTIYs3UNhrNpQWvuYgnWSz1U,1696
113
113
  odoo/addons/account_credit_control/views/account_move.xml,sha256=gSoz9Zd0YAEQdfkIh8g1yqqw0XQWXy5kxa6tMVbj7G0,2145
114
114
  odoo/addons/account_credit_control/views/credit_control_communication.xml,sha256=r9NzBXkV7qQia3698EjDc--F7Ay3LFY3nEmFwiFliGM,6821
115
115
  odoo/addons/account_credit_control/views/credit_control_line.xml,sha256=_u_aG3D3odFrnX3YNvyWu7jUc6G0oWTh9NWGXmthrXQ,12142
116
- odoo/addons/account_credit_control/views/credit_control_policy.xml,sha256=3UBeeqS_25jFcU6_eqPEl8yWwxBrT8W_ArpJ0O1HnXk,6834
116
+ odoo/addons/account_credit_control/views/credit_control_policy.xml,sha256=hYBr4RcjGiPmc3jYwNWroYoKJzJVoWX9lrFf6EnJGwY,6942
117
117
  odoo/addons/account_credit_control/views/credit_control_run.xml,sha256=95xgtEzNqR06jOOfyR8Rw3mkqvtxNiynTnt6L3znlJ8,5637
118
118
  odoo/addons/account_credit_control/views/res_company.xml,sha256=aTBE7IoPHIRjPKG3A-CYaTcq-1x5BHPw3Lcotepnso8,954
119
119
  odoo/addons/account_credit_control/views/res_config_settings_view.xml,sha256=iypH5uqdrPIRxxeFW35qY33uvetBW6LMUeMu0tWGYM0,2237
@@ -127,8 +127,8 @@ odoo/addons/account_credit_control/wizard/credit_control_policy_changer.py,sha25
127
127
  odoo/addons/account_credit_control/wizard/credit_control_policy_changer_view.xml,sha256=1uT9-S_TGL16zhrELjq7pxnCJTYT20GfcesUP8t6v7A,2916
128
128
  odoo/addons/account_credit_control/wizard/credit_control_printer.py,sha256=1UhTbmiZW6Do2x-2D-K-Lrv003P3P9VlhstVjfJBzZo,1816
129
129
  odoo/addons/account_credit_control/wizard/credit_control_printer_view.xml,sha256=PbziKrepf9o5ocwZlWdhPwWCkaa2_6AhuoKMp6rEzWI,2101
130
- odoo/addons/account_credit_control/wizard/mail_compose_message.py,sha256=g-VEcrShJZmAzGd81aIZ4KjanbHc9gwCX5G7zISODrg,797
131
- odoo_addon_account_credit_control-17.0.1.0.0.6.dist-info/METADATA,sha256=s2y6QR3GmdW2VjvRup13GGjacMAEAAcWls2pvwRI5HY,5839
132
- odoo_addon_account_credit_control-17.0.1.0.0.6.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
133
- odoo_addon_account_credit_control-17.0.1.0.0.6.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
134
- odoo_addon_account_credit_control-17.0.1.0.0.6.dist-info/RECORD,,
130
+ odoo/addons/account_credit_control/wizard/mail_compose_message.py,sha256=JCnfhE338Z9ebZliiGKlJaCpZOjit5AQwRPKqwUAB_8,1063
131
+ odoo_addon_account_credit_control-17.0.1.0.2.dist-info/METADATA,sha256=H8uM1Dz1tIGIDKWbsk6H3WW1o1HnE_l_OhLkWOR02eE,5837
132
+ odoo_addon_account_credit_control-17.0.1.0.2.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
133
+ odoo_addon_account_credit_control-17.0.1.0.2.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
134
+ odoo_addon_account_credit_control-17.0.1.0.2.dist-info/RECORD,,