Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP+FIX] account_credit_control: traceable communications #86

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions account_credit_control/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ You are able to specify a particular policy for one partner or one invoice.
Usage
=====

Menu entries are located in ``Invoicing > Adviser > Credit Control``.
Menu entries are located in *Invoicing > Adviser > Credit Control*.

Create a new "run" in the ``Credit Control Run`` menu with the controlling date.
Then, use the ``Compute Credit Lines`` button. All the credit control lines will
be generated. You can find them in the ``Credit Control Lines`` menu.
Create a new "run" in the *Credit Control Run* menu with the controlling date.
Then, use the *Compute Credit Lines* button. All the credit control lines will
be generated. You can find them in the *Credit Control Lines* menu.

On each generated line, you have many choices:

* Send a email
* Print a letter
* Change the state (so you can ignore or reopen lines)
Expand All @@ -68,6 +69,13 @@ On each generated line, you have many choices:
* Mark one line as Manual followup will also mark all the lines of the
partner. The partner will be visible in "Do Manual Follow-ups".

Once your lines are properly set up, go back to the "run" and click on
*Run channel action* to massively generate and queue communication emails or
letters for all linked lines.

Then, use the *Communications* smart button to see all email communication
processes that have been created and follow them.

Bug Tracker
===========

Expand Down Expand Up @@ -105,6 +113,7 @@ Contributors
* Vicent Cubells
* Ernesto Tejeda
* Pedro M. Baeza
* Jairo Llopis

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions account_credit_control/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# Views
"views/account_invoice.xml",
"views/credit_control_line.xml",
"views/credit_control_communication.xml",
"views/credit_control_policy.xml",
"views/credit_control_run.xml",
"views/res_company.xml",
Expand All @@ -49,6 +50,7 @@
"wizard/credit_control_printer_view.xml",
"wizard/credit_control_policy_changer_view.xml",
],
"demo": ["demo/res_users.xml"],
'installable': True,
'license': 'AGPL-3',
'application': True,
Expand Down
24 changes: 15 additions & 9 deletions account_credit_control/data/data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@
<record id="email_template_credit_control_base" model="mail.template">
<field name="name">Credit Control Email</field>
<field name="email_from">${user.company_id.email or ''}</field>
<field name="subject">Credit Control:
(${object.current_policy_level.name or 'n/a'})
</field>
<field name="subject">Credit Control: (${object.policy_level_id.name or 'n/a'})</field>
<field name="email_to">${object.get_email() or ''}</field>
<field name="model_id" ref="model_credit_control_communication"/>
<field name="auto_delete" eval="True"/>
<field name="lang">
${object.get_contact_address().lang or 'en_US'}
</field>
<field name="auto_delete" eval="False"/>
<field name="lang">${object.contact_address_id.lang or 'en_US'}</field>
yajo marked this conversation as resolved.
Show resolved Hide resolved
<field name="report_template" ref="credit_control_summary"/>
<field name="body_html"><![CDATA[
Dear ${object.contact_address.name or ''}
Dear ${object.contact_address_id.name or ''}
<br/>
<br/>
${object.current_policy_level.custom_mail_text | safe}
${object.policy_level_id.custom_mail_text | safe}
yajo marked this conversation as resolved.
Show resolved Hide resolved
]]></field>
</record>

Expand Down Expand Up @@ -221,4 +217,14 @@
<field name="credit_policy_id" ref="credit_control_3_time"/>
</record>

<!-- Mail subtypes -->
<record id="mt_request" model="mail.message.subtype">
<field name="name">Credit control</field>
<field name="description">Credit control notification</field>
<field name="res_model">account.credit.control.communication</field>
<field name="default" eval="True"/>
<field name="hidden" eval="False"/>
<field name="internal" eval="False"/>
</record>

</odoo>
11 changes: 11 additions & 0 deletions account_credit_control/demo/res_users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 Tecnativa - Jairo Llopis
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->

<data noupdate="1">

<record id="base.user_demo" model="res.users">
<field name="groups_id" eval="[(4, ref('group_account_credit_control_user'))]"/>
</record>

</data>
29 changes: 29 additions & 0 deletions account_credit_control/migrations/12.0.3.0.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2020 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# Update mail.template records for credit.control.communication
communication_model = env.ref(
"account_credit_control.model_credit_control_communication"
)
replacements = (
("object.contact_address", "object.contact_address_id"),
("object.current_policy_level", "object.policy_level_id"),
("object.get_contact_address()", "object.contact_address_id"),
)
for from_, to in replacements:
openupgrade.logged_query(
env.cr,
"""
UPDATE mail_template SET
subject = REPLACE(subject, %(from)s, %(to)s),
body_html = REPLACE(body_html, %(from)s, %(to)s)
WHERE model_id = %(model_id)s
""",
{"from": from_, "to": to, "model_id": communication_model.id},
)
24 changes: 24 additions & 0 deletions account_credit_control/migrations/12.0.3.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
# Preserve mail_message_id historic data from credit.control.line records
mail_message_legacy = openupgrade.get_legacy_name("mail_message_id")
openupgrade.copy_columns(
env.cr,
{
"credit_control_line": [
("mail_message_id", mail_message_legacy, None),
]
},
)
# Vacuum meaningless transient data from credit.control.communication
openupgrade.logged_query(
env.cr,
"DELETE FROM credit_control_communication",
)
1 change: 1 addition & 0 deletions account_credit_control/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import account_account
from . import account_invoice
from . import credit_control_communication
from . import credit_control_line
from . import credit_control_policy
from . import credit_control_run
Expand Down
Loading