mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP+FIX] account_credit_control: Several improvements & fixes
* Modify scenarios to be compatible with python scenarios * Voucher/statement related steps * Deprecated step implementation * Print report generation * All tests green * Mail + print of reminder * Broken translations
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import mail
|
||||
from . import run
|
||||
from . import line
|
||||
from . import account
|
||||
|
||||
@@ -58,21 +58,21 @@ On each generated line, you have many choices:
|
||||
* Change the state (so you can ignore or reopen lines)
|
||||
""",
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'init_xml': ["data.xml"],
|
||||
'update_xml': ["line_view.xml",
|
||||
"account_view.xml",
|
||||
"partner_view.xml",
|
||||
"policy_view.xml",
|
||||
"run_view.xml",
|
||||
"company_view.xml",
|
||||
"wizard/credit_control_emailer_view.xml",
|
||||
"wizard/credit_control_marker_view.xml",
|
||||
"wizard/credit_control_printer_view.xml",
|
||||
"report/report.xml",
|
||||
"security/ir.model.access.csv",],
|
||||
'data': ["data.xml",
|
||||
"line_view.xml",
|
||||
"account_view.xml",
|
||||
"partner_view.xml",
|
||||
"policy_view.xml",
|
||||
"run_view.xml",
|
||||
"company_view.xml",
|
||||
"wizard/credit_control_emailer_view.xml",
|
||||
"wizard/credit_control_marker_view.xml",
|
||||
"wizard/credit_control_printer_view.xml",
|
||||
"report/report.xml",
|
||||
"security/ir.model.access.csv"],
|
||||
'demo_xml': ["credit_control_demo.xml"],
|
||||
'tests': [],
|
||||
'installable': True,
|
||||
'license': 'AGPL-3',
|
||||
'application': True
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,18 @@
|
||||
<field name="model_id" ref="model_credit_control_communication"/>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="body_html"><![CDATA[
|
||||
<%page args="object, user=None, ctx=None, quote=None, format_exception=True, mode='email'" />
|
||||
%if mode != 'pdf':
|
||||
%if mode and mode != 'pdf':
|
||||
<!-- your css here -->
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.custom_text {
|
||||
font-family: helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
%endif
|
||||
<div>
|
||||
@@ -24,7 +32,7 @@
|
||||
<table style="border: 1px solid" width="100%">
|
||||
<caption><b>Summary</b></caption>
|
||||
<tr>
|
||||
<th>date due</th>
|
||||
<th>Date due</th>
|
||||
<th>Amount due</th>
|
||||
<th>Amount balance</th>
|
||||
<th>Invoice number</th>
|
||||
|
||||
@@ -562,79 +562,6 @@ msgstr ""
|
||||
msgid "Run date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_credit_control
|
||||
#: model:res.groups,name:account_credit_control.group_account_credit_control_user
|
||||
msgid "Credit Control User"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_credit_control
|
||||
#: model:email.template,body_html:account_credit_control.email_template_credit_control_base
|
||||
msgid "\n"
|
||||
" <%page args=\"object, user=None, ctx=None, quote=None, format_exception=True, mode='mail'\" />\n"
|
||||
" %if mode != 'pdf':\n"
|
||||
" <!-- your css here -->\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" </style>\n"
|
||||
" %endif\n"
|
||||
" <div>\n"
|
||||
"\n"
|
||||
" <p>Dear ${object.partner_id.name or ''},</p>\n"
|
||||
"\n"
|
||||
" <pre class=\"custom_text\">${object.current_policy_level.custom_text}</pre>\n"
|
||||
"\n"
|
||||
" <table style=\"border: 1px solid\" width=\"100%\">\n"
|
||||
" <caption><b>Summary</b></caption>\n"
|
||||
" <tr>\n"
|
||||
" <th>date due</th>\n"
|
||||
" <th>Amount due</th>\n"
|
||||
" <th>Amount balance</th>\n"
|
||||
" <th>Invoice number</th>\n"
|
||||
" </tr>\n"
|
||||
"%for line in object.credit_control_line_ids:\n"
|
||||
" <tr>\n"
|
||||
" <td>${line.date_due}</td>\n"
|
||||
" <td>${line.amount_due}</td>\n"
|
||||
" <td>${line.balance_due}</td>\n"
|
||||
" %if line.invoice_id:\n"
|
||||
" <td>${line.invoice_id.number}</td>\n"
|
||||
" %else:\n"
|
||||
" <td>n/a</td>\n"
|
||||
" %endif\n"
|
||||
"%endfor\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
"\n"
|
||||
" <p>If you have any question, do not hesitate to contact us.</p>\n"
|
||||
"\n"
|
||||
" <p>Thank you for choosing ${object.company_id.name}! </p>\n"
|
||||
"\n"
|
||||
" -- more info here --\n"
|
||||
" <p>${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}<br/>\n"
|
||||
" ${object.company_id.name}<br/>\n"
|
||||
" % if object.company_id.street:\n"
|
||||
" ${object.company_id.street or ''}<br/>\n"
|
||||
"\n"
|
||||
" % endif\n"
|
||||
"\n"
|
||||
" % if object.company_id.street2:\n"
|
||||
" ${object.company_id.street2}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.city or object.company_id.zip:\n"
|
||||
" ${object.company_id.zip or ''} ${object.company_id.city or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.country_id:\n"
|
||||
" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.phone:\n"
|
||||
" Phone: ${object.company_id.phone}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.website:\n"
|
||||
" ${object.company_id.website or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: account_credit_control
|
||||
#: constraint:account.move.line:0
|
||||
msgid "Company must be the same for its related account and period."
|
||||
@@ -784,4 +711,3 @@ msgstr ""
|
||||
#: field:credit.control.line,policy_level_id:0
|
||||
msgid "Overdue Level"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_credit_control
|
||||
# * account_credit_control
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
@@ -650,147 +650,6 @@ msgstr "Run date"
|
||||
msgid "Credit Control User"
|
||||
msgstr "Credit Control User"
|
||||
|
||||
#. module: account_credit_control
|
||||
#: model:email.template,body_html:account_credit_control.email_template_credit_control_base
|
||||
msgid ""
|
||||
"\n"
|
||||
" <%page args=\"object, user=None, ctx=None, quote=None, "
|
||||
"format_exception=True, mode='mail'\" />\n"
|
||||
" %if mode != 'pdf':\n"
|
||||
" <!-- your css here -->\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" </style>\n"
|
||||
" %endif\n"
|
||||
" <div>\n"
|
||||
"\n"
|
||||
" <p>Dear ${object.partner_id.name or ''},</p>\n"
|
||||
"\n"
|
||||
" <pre class=\"custom_text\">${object.current_policy_level.custom_text}</"
|
||||
"pre>\n"
|
||||
"\n"
|
||||
" <table style=\"border: 1px solid\" width=\"100%\">\n"
|
||||
" <caption><b>Summary</b></caption>\n"
|
||||
" <tr>\n"
|
||||
" <th>date due</th>\n"
|
||||
" <th>Amount due</th>\n"
|
||||
" <th>Amount balance</th>\n"
|
||||
" <th>Invoice number</th>\n"
|
||||
" </tr>\n"
|
||||
"%for line in object.credit_control_line_ids:\n"
|
||||
" <tr>\n"
|
||||
" <td>${line.date_due}</td>\n"
|
||||
" <td>${line.amount_due}</td>\n"
|
||||
" <td>${line.balance_due}</td>\n"
|
||||
" %if line.invoice_id:\n"
|
||||
" <td>${line.invoice_id.number}</td>\n"
|
||||
" %else:\n"
|
||||
" <td>n/a</td>\n"
|
||||
" %endif\n"
|
||||
"%endfor\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
"\n"
|
||||
" <p>If you have any question, do not hesitate to contact us.</p>\n"
|
||||
"\n"
|
||||
" <p>Thank you for choosing ${object.company_id.name}! </p>\n"
|
||||
"\n"
|
||||
" -- more info here --\n"
|
||||
" <p>${object.user_id.name} ${object.user_id.user_email and '<"
|
||||
"%s>'%(object.user_id.user_email) or ''}<br/>\n"
|
||||
" ${object.company_id.name}<br/>\n"
|
||||
" % if object.company_id.street:\n"
|
||||
" ${object.company_id.street or ''}<br/>\n"
|
||||
"\n"
|
||||
" % endif\n"
|
||||
"\n"
|
||||
" % if object.company_id.street2:\n"
|
||||
" ${object.company_id.street2}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.city or object.company_id.zip:\n"
|
||||
" ${object.company_id.zip or ''} ${object.company_id.city or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.country_id:\n"
|
||||
" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id."
|
||||
"name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.phone:\n"
|
||||
" Phone: ${object.company_id.phone}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.website:\n"
|
||||
" ${object.company_id.website or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"\n"
|
||||
" <%page args=\"object, user=None, ctx=None, quote=None, "
|
||||
"format_exception=True, mode='mail'\" />\n"
|
||||
" %if mode != 'pdf':\n"
|
||||
" <!-- your css here -->\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" </style>\n"
|
||||
" %endif\n"
|
||||
" <div>\n"
|
||||
"\n"
|
||||
" <p>Dear ${object.partner_id.name or ''},</p>\n"
|
||||
"\n"
|
||||
" <pre class=\"custom_text\">${object.current_policy_level.custom_text}</"
|
||||
"pre>\n"
|
||||
"\n"
|
||||
" <table style=\"border: 1px solid\" width=\"100%\">\n"
|
||||
" <caption><b>Summary</b></caption>\n"
|
||||
" <tr>\n"
|
||||
" <th>date due</th>\n"
|
||||
" <th>Amount due</th>\n"
|
||||
" <th>Amount balance</th>\n"
|
||||
" <th>Invoice number</th>\n"
|
||||
" </tr>\n"
|
||||
"%for line in object.credit_control_line_ids:\n"
|
||||
" <tr>\n"
|
||||
" <td>${line.date_due}</td>\n"
|
||||
" <td>${line.amount_due}</td>\n"
|
||||
" <td>${line.balance_due}</td>\n"
|
||||
" %if line.invoice_id:\n"
|
||||
" <td>${line.invoice_id.number}</td>\n"
|
||||
" %else:\n"
|
||||
" <td>n/a</td>\n"
|
||||
" %endif\n"
|
||||
"%endfor\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
"\n"
|
||||
" <p>If you have any question, do not hesitate to contact us.</p>\n"
|
||||
"\n"
|
||||
" <p>Thank you for choosing ${object.company_id.name}! </p>\n"
|
||||
"\n"
|
||||
" -- more info here --\n"
|
||||
" <p>${object.user_id.name} ${object.user_id.user_email and '<"
|
||||
"%s>'%(object.user_id.user_email) or ''}<br/>\n"
|
||||
" ${object.company_id.name}<br/>\n"
|
||||
" % if object.company_id.street:\n"
|
||||
" ${object.company_id.street or ''}<br/>\n"
|
||||
"\n"
|
||||
" % endif\n"
|
||||
"\n"
|
||||
" % if object.company_id.street2:\n"
|
||||
" ${object.company_id.street2}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.city or object.company_id.zip:\n"
|
||||
" ${object.company_id.zip or ''} ${object.company_id.city or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.country_id:\n"
|
||||
" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id."
|
||||
"name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.phone:\n"
|
||||
" Phone: ${object.company_id.phone}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.website:\n"
|
||||
" ${object.company_id.website or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" "
|
||||
|
||||
#. module: account_credit_control
|
||||
#: constraint:account.move.line:0
|
||||
msgid "Company must be the same for its related account and period."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_credit_control
|
||||
# * account_credit_control
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
@@ -662,139 +662,6 @@ msgstr "Date de lancement"
|
||||
msgid "Credit Control User"
|
||||
msgstr "Utilisateur du contrôle de crédit"
|
||||
|
||||
#. module: account_credit_control
|
||||
#: model:email.template,body_html:account_credit_control.email_template_credit_control_base
|
||||
msgid ""
|
||||
"\n"
|
||||
" <%page args=\"object, user=None, ctx=None, quote=None, format_exception=True, mode='mail'\" />\n"
|
||||
" %if mode != 'pdf':\n"
|
||||
" <!-- your css here -->\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" </style>\n"
|
||||
" %endif\n"
|
||||
" <div>\n"
|
||||
"\n"
|
||||
" <p>Dear ${object.partner_id.name or ''},</p>\n"
|
||||
"\n"
|
||||
" <pre class=\"custom_text\">${object.current_policy_level.custom_text}</pre>\n"
|
||||
"\n"
|
||||
" <table style=\"border: 1px solid\" width=\"100%\">\n"
|
||||
" <caption><b>Summary</b></caption>\n"
|
||||
" <tr>\n"
|
||||
" <th>date due</th>\n"
|
||||
" <th>Amount due</th>\n"
|
||||
" <th>Amount balance</th>\n"
|
||||
" <th>Invoice number</th>\n"
|
||||
" </tr>\n"
|
||||
"%for line in object.credit_control_line_ids:\n"
|
||||
" <tr>\n"
|
||||
" <td>${line.date_due}</td>\n"
|
||||
" <td>${line.amount_due}</td>\n"
|
||||
" <td>${line.balance_due}</td>\n"
|
||||
" %if line.invoice_id:\n"
|
||||
" <td>${line.invoice_id.number}</td>\n"
|
||||
" %else:\n"
|
||||
" <td>n/a</td>\n"
|
||||
" %endif\n"
|
||||
"%endfor\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
"\n"
|
||||
" <p>If you have any question, do not hesitate to contact us.</p>\n"
|
||||
"\n"
|
||||
" <p>Thank you for choosing ${object.company_id.name}! </p>\n"
|
||||
"\n"
|
||||
" -- more info here --\n"
|
||||
" <p>${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}<br/>\n"
|
||||
" ${object.company_id.name}<br/>\n"
|
||||
" % if object.company_id.street:\n"
|
||||
" ${object.company_id.street or ''}<br/>\n"
|
||||
"\n"
|
||||
" % endif\n"
|
||||
"\n"
|
||||
" % if object.company_id.street2:\n"
|
||||
" ${object.company_id.street2}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.city or object.company_id.zip:\n"
|
||||
" ${object.company_id.zip or ''} ${object.company_id.city or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.country_id:\n"
|
||||
" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.phone:\n"
|
||||
" Phone: ${object.company_id.phone}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.website:\n"
|
||||
" ${object.company_id.website or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"\n"
|
||||
" <%page args=\"object, user=None, ctx=None, quote=None, format_exception=True, mode='mail'\" />\n"
|
||||
" %if mode != 'pdf':\n"
|
||||
" <!-- your css here -->\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" </style>\n"
|
||||
" %endif\n"
|
||||
" <div>\n"
|
||||
"\n"
|
||||
" <p>Cher ${object.partner_id.name or ''},</p>\n"
|
||||
"\n"
|
||||
" <pre class=\"custom_text\">${object.current_policy_level.custom_text}</pre>\n"
|
||||
"\n"
|
||||
" <table style=\"border: 1px solid\" width=\"100%\">\n"
|
||||
" <caption><b>Summary</b></caption>\n"
|
||||
" <tr>\n"
|
||||
" <th>Date due</th>\n"
|
||||
" <th>Somme due</th>\n"
|
||||
" <th>Solde du</th>\n"
|
||||
" <th>Numéro de facture</th>\n"
|
||||
" </tr>\n"
|
||||
"%for line in object.credit_control_line_ids:\n"
|
||||
" <tr>\n"
|
||||
" <td>${line.date_due}</td>\n"
|
||||
" <td>${line.amount_due}</td>\n"
|
||||
" <td>${line.balance_due}</td>\n"
|
||||
" %if line.invoice_id:\n"
|
||||
" <td>${line.invoice_id.number}</td>\n"
|
||||
" %else:\n"
|
||||
" <td>n/a</td>\n"
|
||||
" %endif\n"
|
||||
"%endfor\n"
|
||||
" </table>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
"\n"
|
||||
" <p>Si vous avez des questions n'hésitez pas à nous contacter.</p>\n"
|
||||
"\n"
|
||||
" <p>Merci d'avoir choisi ${object.company_id.name}! </p>\n"
|
||||
"\n"
|
||||
" -- more info here --\n"
|
||||
" <p>${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}<br/>\n"
|
||||
" ${object.company_id.name}<br/>\n"
|
||||
" % if object.company_id.street:\n"
|
||||
" ${object.company_id.street or ''}<br/>\n"
|
||||
"\n"
|
||||
" % endif\n"
|
||||
"\n"
|
||||
" % if object.company_id.street2:\n"
|
||||
" ${object.company_id.street2}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.city or object.company_id.zip:\n"
|
||||
" ${object.company_id.zip or ''} ${object.company_id.city or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.country_id:\n"
|
||||
" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.phone:\n"
|
||||
" Téléphone : ${object.company_id.phone}<br/>\n"
|
||||
" % endif\n"
|
||||
" % if object.company_id.website:\n"
|
||||
" ${object.company_id.website or ''}<br/>\n"
|
||||
" % endif\n"
|
||||
" "
|
||||
|
||||
#. module: account_credit_control
|
||||
#: constraint:account.move.line:0
|
||||
msgid "Company must be the same for its related account and period."
|
||||
@@ -962,4 +829,3 @@ msgstr "Niveau de créance"
|
||||
#~ msgstr "Contrôle de crédit"
|
||||
#~ msgid "New lines"
|
||||
#~ msgstr "Nouvelles lignes"
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class CreditControlLine(orm.Model):
|
||||
'partner_id': fields.many2one('res.partner', "Partner", required=True),
|
||||
'amount_due': fields.float('Due Amount Tax incl.', required=True, readonly=True),
|
||||
'balance_due': fields.float('Due balance', required=True, readonly=True),
|
||||
'mail_message_id': fields.many2one('mail.message', 'Sent Email', readonly=True),
|
||||
'mail_message_id': fields.many2one('mail.mail', 'Sent Email', readonly=True),
|
||||
|
||||
'move_line_id': fields.many2one('account.move.line', 'Move line',
|
||||
required=True, readonly=True),
|
||||
|
||||
28
account_credit_control/mail.py
Normal file
28
account_credit_control/mail.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Nicolas Bessi, Guewen Baconnier
|
||||
# Copyright 2012 Camptocamp SA
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
class Mail(orm.Model):
|
||||
_inherit = 'mail.mail'
|
||||
|
||||
# use HTML fields instead of text
|
||||
_columns = {'body_html': fields.html('Rich-text Contents',
|
||||
help="Rich-text/HTML message"),}
|
||||
@@ -2,16 +2,156 @@
|
||||
<head>
|
||||
<style type="text/css">
|
||||
${css}
|
||||
body {
|
||||
font-family: helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.custom_text {
|
||||
font-family: helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table {
|
||||
font-family: helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-left: 0px;
|
||||
text-align: left;
|
||||
width: 300px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.basic_table{
|
||||
text-align: center;
|
||||
border: 1px solid lightGrey;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.basic_table th {
|
||||
border: 1px solid lightGrey;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.basic_table td {
|
||||
border: 1px solid lightGrey;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.list_table {
|
||||
border-color: black;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.list_table td {
|
||||
border-color: gray;
|
||||
border-top: 1px solid gray;
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
padding-right: 3px;
|
||||
padding-left: 3px;
|
||||
padding-top: 3px;
|
||||
padding-bottom:3px;
|
||||
}
|
||||
|
||||
.list_table th {
|
||||
border-bottom: 2px solid black;
|
||||
text-align: left;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding-right: 3px
|
||||
padding-left: 3px
|
||||
}
|
||||
|
||||
.list_table thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
.address table {
|
||||
font-size: 11px;
|
||||
border-collapse: collapse;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.address .shipping {
|
||||
|
||||
}
|
||||
|
||||
.address .invoice {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.address .recipient {
|
||||
margin-right: 120px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
table .address_title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.address td.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td.amount, th.amount {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tr.line .note {
|
||||
border-style: none;
|
||||
font-size: 9px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
tr.line {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
%for comm in objects :
|
||||
<div class="address">
|
||||
<table class="recipient">
|
||||
<tr><td class="name">${comm.partner_id.title and comm.partner_id.title.name or ''} ${comm.partner_id.name }</td></tr>
|
||||
%for part in comm.partner_id.contact_address.split("\n")[1:]:
|
||||
%if part:
|
||||
<tr><td>${part}</td></tr>
|
||||
%endif
|
||||
%endfor
|
||||
</table>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<%
|
||||
setLang(comm.partner_id.lang)
|
||||
current_uri = '%s_policy_template' % (comm.partner_id.lang)
|
||||
if not context.lookup.has_template(current_uri):
|
||||
context.lookup.put_string(current_uri, comm.current_policy_level.email_template_id.body_html)
|
||||
# awfully horrible we add page tags here beacause openerp replaced
|
||||
# mako by Jinga but not everywere so they sandbox mako into jinga
|
||||
# and jinga prevent %page tag to wwork
|
||||
context.lookup.put_string(current_uri,
|
||||
"""<%page args="object, user=None, ctx=None, quote=None, format_exception=True, mode='email'" />
|
||||
""" + comm.current_policy_level.email_template_id.body_html)
|
||||
%>
|
||||
<%include file="${current_uri}" args="object=comm,user=user,ctx=ctx,quote=quote,format_exception=format_exception,mode='pdf'"/>
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
Feature: General parameters in order to test the credit control module
|
||||
|
||||
@deactivate_journal_control
|
||||
Scenario: Journal setup to vaoid unfixed voucher bug
|
||||
Given I execute the SQL commands
|
||||
"""
|
||||
UPDATE account_journal SET allow_date = false;
|
||||
"""
|
||||
@account_credit_control_setup_install_modules
|
||||
Scenario: MODULES INSTALLATION
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_feb
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_feb
|
||||
|
||||
Feature: Ensure that mail credit line generation first pass is correct
|
||||
|
||||
@@ -23,11 +23,11 @@ Feature: Ensure that mail credit line generation first pass is correct
|
||||
Given I need a "credit.control.run" with oid: credit_control.run2
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-02-29 |
|
||||
| date | %Y-02-28 |
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 360 | 2012-02-15 | Debtors | 3 time policy | 2012-02-29 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 360 | USD |
|
||||
| 1000 | 2012-02-17 | Debtors USD | 3 time policy | 2012-02-29 | customer_5_usd | email | 1 | SI_13 | 10 days net | draft | 1000 | USD |
|
||||
| 300 | 2012-01-18 | Debtors | 3 time policy | 2012-02-29 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 300 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 360 | %Y-02-15 | Debtors | 3 time policy | %Y-02-28 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 360 | USD |
|
||||
| 1000 | %Y-02-17 | Debtors USD | 3 time policy | %Y-02-28 | customer_5_usd | email | 1 | SI_13 | 10 days net | draft | 1000 | USD |
|
||||
| 300 | %Y-01-18 | Debtors | 3 time policy | %Y-02-28 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 300 | |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_mar
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_mar
|
||||
|
||||
Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@@ -20,47 +20,43 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@pay_invoice_si_19_part1
|
||||
Scenario: I pay a part of the first part of the invoice SI 19,
|
||||
Given I need a "account.bank.statement" with oid: scen.voucher_statement_si_19
|
||||
Given I need a "account.bank.statement" with oid: scen.state_control_eur_1
|
||||
And having:
|
||||
| name | value |
|
||||
| name | Bk.St.si_19_part1 |
|
||||
| date | 2012-03-31 |
|
||||
| currency_id | by name: EUR |
|
||||
| journal_id | by oid: scen.voucher_eur_journal |
|
||||
And the bank statement is linked to period "03/2012"
|
||||
| name | value |
|
||||
| name | Bk.St.si_19_part1 |
|
||||
| date | %Y-03-31 |
|
||||
| journal_id | by oid: scen.eur_journal |
|
||||
|
||||
And I import invoice "SI_19" using import invoice button
|
||||
And I should have a "account.bank.statement.line" with name: SI_19 and amount: 450
|
||||
And the line amount should be 450
|
||||
And I should have a "account.bank.statement.line" with name: "SI_19" and amount: "450"
|
||||
And I set the voucher paid amount to "300"
|
||||
And I save the voucher
|
||||
Then I modify the line amount to 300
|
||||
And I should have a "account.bank.statement.line" with name: SI_19 and amount: 1050
|
||||
And the line amount should be 1050
|
||||
And I should have a "account.bank.statement.line" with name: "SI_19" and amount: "1050"
|
||||
And I set the voucher paid amount to "0"
|
||||
And I save the voucher
|
||||
Then I modify the line amount to 0
|
||||
And I should have a "account.bank.statement" with oid: scen.voucher_statement_si_19
|
||||
Then I modify the line amount to "0"
|
||||
Given I need a "account.bank.statement" with oid: scen.state_control_eur_1
|
||||
And I set bank statement end-balance
|
||||
When I confirm bank statement
|
||||
Then My invoice "SI_19" is in state "open" reconciled with a residual amount of "1200.0"
|
||||
|
||||
@account_credit_control_run_month
|
||||
@account_credit_control_run_month_mar
|
||||
Scenario: Create run
|
||||
Given I need a "credit.control.run" with oid: credit_control.run3
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-03-31 |
|
||||
| date | %Y-03-31 |
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1000 | 2012-02-29 | Debtors | 2 time policy | 2012-03-31 | customer_2 | email | 1 | SI_4 | 30 days end of month | draft | 1000 | |
|
||||
| 1000 | 2012-02-17 | Debtors | 2 time policy | 2012-03-31 | customer_3 | email | 1 | SI_7 | 30 days end of month | draft | 1000 | |
|
||||
| 700 | 2012-02-29 | Debtors | 3 time policy | 2012-03-31 | customer_4 | email | 1 | SI_10 | 10 days net | draft | 700 | |
|
||||
| 450 | 2012-03-15 | Debtors | 3 time policy | 2012-03-31 | customer_4 | email | 1 | SI_12 | 10 days net | draft | 450 | |
|
||||
| 1200 | 2012-03-16 | Debtors USD | 3 time policy | 2012-03-31 | customer_5_usd | email | 1 | SI_14 | 10 days net | draft | 1200 | USD |
|
||||
| 360 | 2012-02-15 | Debtors | 3 time policy | 2012-03-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 360 | USD |
|
||||
| 1000 | 2012-02-17 | Debtors USD | 3 time policy | 2012-03-31 | customer_5_usd | email | 2 | SI_13 | 30 days end of month | draft | 1000 | USD |
|
||||
| 300 | 2012-01-18 | Debtors | 3 time policy | 2012-03-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 300 | |
|
||||
| 450 | 2012-03-15 | Debtors | 3 time policy | 2012-03-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 450 | |
|
||||
| 150 | 2012-03-15 | Debtors | 3 time policy | 2012-03-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 450 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1000 | %Y-02-28 | Debtors | 2 time policy | %Y-03-31 | customer_2 | email | 1 | SI_4 | 30 days end of month | draft | 1000 | |
|
||||
| 1000 | %Y-02-17 | Debtors | 2 time policy | %Y-03-31 | customer_3 | email | 1 | SI_7 | 30 days end of month | draft | 1000 | |
|
||||
| 700 | %Y-02-28 | Debtors | 3 time policy | %Y-03-31 | customer_4 | email | 1 | SI_10 | 10 days net | draft | 700 | |
|
||||
| 450 | %Y-03-15 | Debtors | 3 time policy | %Y-03-31 | customer_4 | email | 1 | SI_12 | 10 days net | draft | 450 | |
|
||||
| 1200 | %Y-03-17 | Debtors USD | 3 time policy | %Y-03-31 | customer_5_usd | email | 1 | SI_14 | 10 days net | draft | 1200 | USD |
|
||||
| 360 | %Y-02-15 | Debtors | 3 time policy | %Y-03-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 360 | USD |
|
||||
| 1000 | %Y-02-17 | Debtors USD | 3 time policy | %Y-03-31 | customer_5_usd | email | 2 | SI_13 | 30 days end of month | draft | 1000 | USD |
|
||||
| 300 | %Y-01-18 | Debtors | 3 time policy | %Y-03-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 300 | |
|
||||
| 450 | %Y-03-15 | Debtors | 3 time policy | %Y-03-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 450 | |
|
||||
| 150 | %Y-03-15 | Debtors | 3 time policy | %Y-03-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 450 | |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_apr
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_apr
|
||||
|
||||
Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@@ -22,22 +22,23 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Scenario: Create run
|
||||
Given I need a "credit.control.run" with oid: credit_control.run4
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-04-30 |
|
||||
| name | value |
|
||||
| date | %Y-04-30 |
|
||||
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1200 | 2012-03-31 | Debtors | 2 time policy | 2012-04-30 | customer_2 | email | 1 | SI_5 | 30 days end of month | draft | 1200 | USD |
|
||||
| 1200 | 2012-03-16 | Debtors | 2 time policy | 2012-04-30 | customer_3 | email | 1 | SI_8 | 30 days end of month | draft | 1200 | USD |
|
||||
| 840 | 2012-03-31 | Debtors | 3 time policy | 2012-04-30 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 840 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors USD | 3 time policy | 2012-04-30 | customer_5_usd | email | 1 | SI_15 | 10 days net | draft | 1500 | USD |
|
||||
| 700 | 2012-02-29 | Debtors | 3 time policy | 2012-04-30 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 700 | |
|
||||
| 450 | 2012-03-15 | Debtors | 3 time policy | 2012-04-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 450 | USD |
|
||||
| 1200 | 2012-03-16 | Debtors USD | 3 time policy | 2012-04-30 | customer_5_usd | email | 2 | SI_14 | 30 days end of month | draft | 1200 | USD |
|
||||
| 360 | 2012-02-15 | Debtors | 3 time policy | 2012-04-30 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 360 | USD |
|
||||
| 1000 | 2012-02-17 | Debtors USD | 3 time policy | 2012-04-30 | customer_5_usd | letter | 3 | SI_14 | 10 days last reminder | draft | 1000 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors | 3 time policy | 2012-04-30 | customer_4 | email | 1 | SI_16 | 10 days net | draft | 1500 | |
|
||||
| 1500 | 2012-04-14 | Debtors | 3 time policy | 2012-04-30 | customer_4 | email | 1 | SI_17 | 10 days net | draft | 1500 | |
|
||||
| 450 | 2012-03-15 | Debtors | 3 time policy | 2012-04-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 450 | |
|
||||
| 150 | 2012-03-15 | Debtors | 3 time policy | 2012-04-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 450 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 360 | %Y-02-15 | Debtors | 3 time policy | %Y-04-30 | customer_4 | letter | 3 | SI_11 | 10 days last reminder | draft | 360 | USD |
|
||||
| 1200 | %Y-03-31 | Debtors | 2 time policy | %Y-04-30 | customer_2 | email | 1 | SI_5 | 30 days end of month | draft | 1200 | USD |
|
||||
| 1200 | %Y-03-17 | Debtors | 2 time policy | %Y-04-30 | customer_3 | email | 1 | SI_8 | 30 days end of month | draft | 1200 | USD |
|
||||
| 700 | %Y-02-28 | Debtors | 3 time policy | %Y-04-30 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 700 | |
|
||||
| 840 | %Y-03-31 | Debtors | 3 time policy | %Y-04-30 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 840 | USD |
|
||||
| 450 | %Y-03-15 | Debtors | 3 time policy | %Y-04-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 450 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors USD | 3 time policy | %Y-04-30 | customer_5_usd | email | 1 | SI_15 | 10 days net | draft | 1500 | USD |
|
||||
| 1200 | %Y-03-17 | Debtors USD | 3 time policy | %Y-04-30 | customer_5_usd | email | 2 | SI_14 | 30 days end of month | draft | 1200 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors USD | 3 time policy | %Y-04-30 | customer_5_usd | email | 1 | SI_15 | 10 days net | draft | 1500 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors | 3 time policy | %Y-04-30 | customer_4 | email | 1 | SI_16 | 10 days net | draft | 1500 | |
|
||||
| 1500 | %Y-04-14 | Debtors | 3 time policy | %Y-04-30 | Scrooge McDuck | email | 1 | SI_17 | 10 days net | draft | 1500 | |
|
||||
| 450 | %Y-03-15 | Debtors | 3 time policy | %Y-04-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 450 | |
|
||||
| 150 | %Y-03-15 | Debtors | 3 time policy | %Y-04-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 450 | |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_may
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_may
|
||||
|
||||
Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@@ -22,12 +22,10 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Scenario: I pay entirely the invoice SI 16, so it should no longer appear in the credit control lines
|
||||
Given I need a "account.bank.statement" with oid: scen.voucher_statement_si_16
|
||||
And having:
|
||||
| name | value |
|
||||
| name | Bk.St.si_16 |
|
||||
| date | 2012-05-30 |
|
||||
| currency_id | by name: EUR |
|
||||
| journal_id | by oid: scen.voucher_eur_journal |
|
||||
And the bank statement is linked to period "05/2012"
|
||||
| name | value |
|
||||
| name | Bk.St.si_16 |
|
||||
| date | %Y-05-30 |
|
||||
| journal_id | by oid: scen.eur_journal |
|
||||
And I import invoice "SI_16" using import invoice button
|
||||
And I set bank statement end-balance
|
||||
When I confirm bank statement
|
||||
@@ -37,19 +35,16 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Scenario: I pay entirely the invoice SI 17, so it should no longer appear in the credit control lines
|
||||
Given I need a "account.bank.statement" with oid: scen.voucher_statement_si_17
|
||||
And having:
|
||||
| name | value |
|
||||
| name | Bk.St.si_17 |
|
||||
| date | 2012-05-30 |
|
||||
| currency_id | by name: EUR |
|
||||
| journal_id | by oid: scen.voucher_eur_journal |
|
||||
And the bank statement is linked to period "05/2012"
|
||||
| name | value |
|
||||
| name | Bk.St.si_17 |
|
||||
| date | %Y-05-30 |
|
||||
| journal_id | by oid: scen.eur_journal |
|
||||
And I import invoice "SI_17" using import invoice button
|
||||
And I need a "account.bank.statement.line" with name: SI_17
|
||||
And the line amount should be 1500
|
||||
And I should have a "account.bank.statement.line" with name: "SI_17" and amount: "1500"
|
||||
And I set the voucher paid amount to "1000"
|
||||
And I save the voucher
|
||||
Then I modify the line amount to 1000
|
||||
And I should have a "account.bank.statement" with oid: scen.voucher_statement_si_17
|
||||
And I modify the line amount to "1000"
|
||||
And I need a "account.bank.statement" with oid: scen.voucher_statement_si_17
|
||||
And I set bank statement end-balance
|
||||
When I confirm bank statement
|
||||
Then My invoice "SI_17" is in state "open" reconciled with a residual amount of "500.0"
|
||||
@@ -58,24 +53,20 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Scenario: I pay the first part of the invoice SI 18, so it should no longer appear in the credit control lines however, the second move lines should still appears
|
||||
Given I need a "account.bank.statement" with oid: scen.voucher_statement_si_18
|
||||
And having:
|
||||
| name | value |
|
||||
| name | Bk.St.si_18_part1 |
|
||||
| date | 2012-05-30 |
|
||||
| currency_id | by name: EUR |
|
||||
| journal_id | by oid: scen.voucher_eur_journal |
|
||||
And the bank statement is linked to period "05/2012"
|
||||
| name | value |
|
||||
| name | Bk.St.si_18_part1 |
|
||||
| date | %Y-05-30 |
|
||||
| journal_id | by oid: scen.eur_journal |
|
||||
And I import invoice "SI_18" using import invoice button
|
||||
And I should have a "account.bank.statement.line" with name: SI_18 and amount: 450
|
||||
And the line amount should be 450
|
||||
And I should have a "account.bank.statement.line" with name: "SI_18" and amount: "450"
|
||||
And I set the voucher paid amount to "450"
|
||||
And I save the voucher
|
||||
Then I modify the line amount to 450
|
||||
And I should have a "account.bank.statement.line" with name: SI_18 and amount: 1050
|
||||
And the line amount should be 1050
|
||||
And I modify the line amount to "450"
|
||||
And I should have a "account.bank.statement.line" with name: "SI_18" and amount: "1050"
|
||||
And I set the voucher paid amount to "0"
|
||||
And I save the voucher
|
||||
Then I modify the line amount to 0
|
||||
And I should have a "account.bank.statement" with oid: scen.voucher_statement_si_18
|
||||
Then I modify the line amount to "0"
|
||||
And I need a "account.bank.statement" with oid: scen.voucher_statement_si_18
|
||||
And I set bank statement end-balance
|
||||
When I confirm bank statement
|
||||
Then My invoice "SI_18" is in state "open" reconciled with a residual amount of "1050.0"
|
||||
@@ -85,22 +76,22 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Given I need a "credit.control.run" with oid: credit_control.run5
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-05-31 |
|
||||
| date | %Y-05-31 |
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1500 | 2012-04-30 | Debtors | 2 time policy | 2012-05-31 | customer_2 | email | 1 | SI_6 | 30 days end of month | draft | 1500 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors | 2 time policy | 2012-05-31 | customer_3 | email | 1 | SI_8 | 30 days end of month | draft | 1500 | USD |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-05-31 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 1050 | USD |
|
||||
| 1000 | 2012-02-29 | Debtors | 2 time policy | 2012-05-31 | customer_2 | letter | 2 | SI_4 | 60 days last reminder | draft | 1000 | |
|
||||
| 1000 | 2012-02-17 | Debtors | 2 time policy | 2012-05-31 | customer_3 | letter | 2 | SI_7 | 60 days last reminder | draft | 1000 | |
|
||||
| 840 | 2012-03-31 | Debtors | 3 time policy | 2012-05-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 840 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors USD | 3 time policy | 2012-05-31 | customer_5_usd | email | 2 | SI_15 | 30 days end of month | draft | 1500 | USD |
|
||||
| 700 | 2012-02-29 | Debtors | 3 time policy | 2012-05-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 700 | |
|
||||
| 450 | 2012-03-15 | Debtors | 3 time policy | 2012-05-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 450 | USD |
|
||||
| 1200 | 2012-03-16 | Debtors USD | 3 time policy | 2012-05-31 | customer_5_usd | letter | 3 | SI_14 | 10 days last reminder | draft | 1200 | USD |
|
||||
| 500 | 2012-04-14 | Debtors | 3 time policy | 2012-05-31 | Scrooge McDuck | email | 2 | SI_17 | 30 days end of month | draft | 1500 | |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-05-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 1050 | |
|
||||
| 150 | 2012-03-15 | Debtors | 3 time policy | 2012-05-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 450 | |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-05-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 1050 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1500 | %Y-04-30 | Debtors | 2 time policy | %Y-05-31 | customer_2 | email | 1 | SI_6 | 30 days end of month | draft | 1500 | USD |
|
||||
| 1000 | %Y-02-28 | Debtors | 2 time policy | %Y-05-31 | customer_2 | letter | 2 | SI_4 | 60 days last reminder | draft | 1000 | |
|
||||
| 1000 | %Y-02-17 | Debtors | 2 time policy | %Y-05-31 | customer_3 | letter | 2 | SI_7 | 60 days last reminder | draft | 1000 | |
|
||||
| 1500 | %Y-04-14 | Debtors | 2 time policy | %Y-05-31 | customer_3 | email | 1 | SI_9 | 30 days end of month | draft | 1500 | |
|
||||
| 840 | %Y-03-31 | Debtors | 3 time policy | %Y-05-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 840 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors USD | 3 time policy | %Y-05-31 | customer_5_usd | email | 2 | SI_15 | 30 days end of month | draft | 1500 | USD |
|
||||
| 700 | %Y-02-28 | Debtors | 3 time policy | %Y-05-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 700 | |
|
||||
| 450 | %Y-03-15 | Debtors | 3 time policy | %Y-05-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 450 | USD |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-05-31 | customer_4 | email | 1 | SI_12 | 10 days net | draft | 1050 | USD |
|
||||
| 1200 | %Y-03-17 | Debtors USD | 3 time policy | %Y-05-31 | customer_5_usd | letter | 3 | SI_14 | 10 days last reminder | draft | 1200 | USD |
|
||||
| 500 | %Y-04-14 | Debtors | 3 time policy | %Y-05-31 | Scrooge McDuck | email | 2 | SI_17 | 30 days end of month | draft | 1500 | |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-05-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 1050 | |
|
||||
| 150 | %Y-03-15 | Debtors | 3 time policy | %Y-05-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 450 | |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-05-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 1050 | |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_jun
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_jun
|
||||
|
||||
Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@@ -23,16 +23,16 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Given I need a "credit.control.run" with oid: credit_control.run6
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-06-30 |
|
||||
| date | %Y-06-30 |
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1200 | 2012-03-31 | Debtors | 2 time policy | 2012-06-30 | customer_2 | letter | 2 | SI_5 | 60 days last reminder | draft | 1200 | USD |
|
||||
| 1200 | 2012-03-16 | Debtors | 2 time policy | 2012-06-30 | customer_3 | letter | 2 | SI_8 | 60 days last reminder | draft | 1200 | USD |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-06-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 1050 | USD |
|
||||
| 840 | 2012-03-31 | Debtors | 3 time policy | 2012-06-30 | customer_4 | letter | 3 | SI_11 | 10 days last reminder | draft | 840 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors USD | 3 time policy | 2012-06-30 | customer_5_usd | letter | 3 | SI_15 | 10 days last reminder | draft | 1500 | USD |
|
||||
| 500 | 2012-04-14 | Debtors | 3 time policy | 2012-06-30 | Scrooge McDuck | letter | 3 | SI_17 | 10 days last reminder | draft | 1500 | |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-06-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 1050 | |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-06-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 1050 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1200 | %Y-03-31 | Debtors | 2 time policy | %Y-06-30 | customer_2 | letter | 2 | SI_5 | 60 days last reminder | draft | 1200 | USD |
|
||||
| 1200 | %Y-03-17 | Debtors | 2 time policy | %Y-06-30 | customer_3 | letter | 2 | SI_8 | 60 days last reminder | draft | 1200 | USD |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-06-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 1050 | USD |
|
||||
| 840 | %Y-03-31 | Debtors | 3 time policy | %Y-06-30 | customer_4 | letter | 3 | SI_11 | 10 days last reminder | draft | 840 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors USD | 3 time policy | %Y-06-30 | customer_5_usd | letter | 3 | SI_15 | 10 days last reminder | draft | 1500 | USD |
|
||||
| 500 | %Y-04-14 | Debtors | 3 time policy | %Y-06-30 | Scrooge McDuck | letter | 3 | SI_17 | 10 days last reminder | draft | 1500 | |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-06-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 1050 | |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-06-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 1050 | |
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Features Generic tags (none for all)
|
||||
##############################################################################
|
||||
|
||||
@account_credit_control_run @account_credit_control_run_jul
|
||||
@account_credit_control @account_credit_control_run @account_credit_control_run_jul
|
||||
|
||||
Feature: Ensure that email credit line generation first pass is correct
|
||||
|
||||
@@ -23,13 +23,13 @@ Feature: Ensure that email credit line generation first pass is correct
|
||||
Given I need a "credit.control.run" with oid: credit_control.run7
|
||||
And having:
|
||||
| name | value |
|
||||
| date | 2012-07-31 |
|
||||
| date | %Y-07-31 |
|
||||
When I launch the credit run
|
||||
Then my credit run should be in state "done"
|
||||
And the generated credit lines should have the following values:
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1500 | 2012-04-30 | Debtors | 2 time policy | 2012-07-31 | customer_2 | letter | 2 | SI_6 | 60 days last reminder | draft | 1500 | USD |
|
||||
| 1500 | 2012-04-14 | Debtors | 2 time policy | 2012-07-31 | customer_3 | letter | 2 | SI_9 | 60 days last reminder | draft | 1500 | USD |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-07-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 1050 | USD |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-07-31 | Donald Duck | letter | 3 | SI_18 | 10 days last reminder | draft | 1050 | |
|
||||
| 1050 | 2012-04-30 | Debtors | 3 time policy | 2012-07-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 1050 | |
|
||||
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
|
||||
| 1500 | %Y-04-30 | Debtors | 2 time policy | %Y-07-31 | customer_2 | letter | 2 | SI_6 | 60 days last reminder | draft | 1500 | USD |
|
||||
| 1500 | %Y-04-14 | Debtors | 2 time policy | %Y-07-31 | customer_3 | letter | 2 | SI_9 | 60 days last reminder | draft | 1500 | USD |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-07-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 1050 | USD |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-07-31 | Donald Duck | letter | 3 | SI_18 | 10 days last reminder | draft | 1050 | |
|
||||
| 1050 | %Y-04-30 | Debtors | 3 time policy | %Y-07-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 1050 | |
|
||||
|
||||
@@ -11,8 +11,8 @@ def impl(ctx, policy_oid):
|
||||
for row in ctx.table:
|
||||
acc = acc_obj.get(['code = %s' % row['account code']])
|
||||
assert acc, "Account with code %s not found" % row['account code']
|
||||
accounts.append(accounts)
|
||||
policy.write({'account_ids': accounts})
|
||||
accounts.append(acc)
|
||||
policy.write({'account_ids': [x.id for x in accounts]})
|
||||
|
||||
|
||||
@when(u'I launch the credit run')
|
||||
@@ -44,16 +44,22 @@ def impl(ctx):
|
||||
for row in rows:
|
||||
account = model('account.account').get(['name = %s' % row['account']])
|
||||
assert account, "no account named %s found" % row['account']
|
||||
import pdb; pdb.set_trace()
|
||||
|
||||
policy = model('credit.control.policy').get(['name = %s' % row['policy']])
|
||||
assert policy, "No policy %s found" % row['policy']
|
||||
|
||||
partner = model('res.partner').get(['name = %s' % row['partner']])
|
||||
assert partner, "No partner %s found" % row['partner']
|
||||
move_line = model('account.move.line').get(['name = %s' % row['move line']])
|
||||
|
||||
maturity_date = _parse_date(row['date due'])
|
||||
move_line = model('account.move.line').get(['name = %s' % row['move line'],
|
||||
'date_maturity = %s' % maturity_date])
|
||||
assert move_line, "No move line %s found" % row['move line']
|
||||
level = model('credit.control.policy.level').get(['name = %s' % row['policy level'], 'policy_id = %s' % policy.id])
|
||||
|
||||
level = model('credit.control.policy.level').get(['name = %s' % row['policy level'],
|
||||
'policy_id = %s' % policy.id])
|
||||
assert level, "No level % found" % row['policy level']
|
||||
|
||||
domain = [['account_id', '=', account.id],
|
||||
['policy_id', '=', policy.id],
|
||||
['partner_id', '=', partner.id],
|
||||
@@ -65,8 +71,9 @@ def impl(ctx):
|
||||
['balance_due', '=', row.get('balance', 0.0)],
|
||||
['date_due', '=', _parse_date(row['date due'])],
|
||||
['date', '=', _parse_date(row['date'])],
|
||||
['move_line_id', '=', move_line.id],
|
||||
]
|
||||
if row.get('currrency'):
|
||||
if row.get('currency'):
|
||||
curreny = model('res.currency').get(['name = %s' % row['currency']])
|
||||
assert curreny, "No currency %s found" % row['currency']
|
||||
domain.append(('currency_id', '=', curreny.id))
|
||||
@@ -74,8 +81,9 @@ def impl(ctx):
|
||||
lines = model('credit.control.line').search(domain)
|
||||
assert lines, "no line found for %s" % repr(row)
|
||||
assert len(lines) == 1, "Too many lines found for %s" % repr(row)
|
||||
date_lines = model('credit.control.lines').search([('date', '=', ctx.found_item.date)])
|
||||
assert len(date_lines) == len(ctx.table), "Too many lines generated"
|
||||
date_lines = model('credit.control.line').search([('date', '=', ctx.found_item.date)])
|
||||
assert len(date_lines) == len(ctx.table.rows), "Too many lines generated"
|
||||
|
||||
|
||||
def open_invoice(ctx):
|
||||
assert ctx.found_item
|
||||
@@ -90,3 +98,23 @@ def impl(ctx):
|
||||
@given(u'I open the credit invoice')
|
||||
def impl(ctx):
|
||||
open_invoice(ctx)
|
||||
|
||||
@given(u'there is "{state}" credit lines')
|
||||
def impl(ctx, state):
|
||||
assert model('credit.control.line').search(['state = %s' % state])
|
||||
|
||||
@given(u'I mark all draft email to state "{state}"')
|
||||
def impl(ctx, state):
|
||||
wiz = model('credit.control.marker').create({'name': state})
|
||||
lines = model('credit.control.line').search([('state', '=', 'draft')])
|
||||
assert lines
|
||||
ctx.lines = lines
|
||||
wiz.write({'line_ids': lines})
|
||||
wiz.mark_lines()
|
||||
|
||||
@then(u'the draft line should be in state "{state}"')
|
||||
def impl(ctx, state):
|
||||
assert ctx.lines
|
||||
lines = model('credit.control.line').search([('state', '!=', state),
|
||||
('id', 'in', ctx.lines)])
|
||||
assert not lines
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
from support import *
|
||||
import datetime
|
||||
|
||||
@step('I import invoice "{inv_name}" using import invoice button')
|
||||
def impl(ctx, inv_name):
|
||||
invoice = model('account.invoice').get([('name', '=', inv_name)])
|
||||
assert invoice
|
||||
bank_statement = ctx.found_item
|
||||
for line in bank_statement.line_ids:
|
||||
line.unlink()
|
||||
lines = model('account.move.line').browse([('move_id', '=', invoice.move_id.id),
|
||||
('account_id', '=', invoice.account_id.id)])
|
||||
|
||||
wizard = model('account.statement.from.invoice.lines').create({'line_ids': lines})
|
||||
wizard.populate_statement({'statement_id': bank_statement.id})
|
||||
|
||||
@given(u'I should have a "account.bank.statement.line" with name: "{name}" and amount: "{amount}"')
|
||||
def impl(ctx, name, amount):
|
||||
assert ctx.found_item
|
||||
line = model('account.bank.statement.line').get([('name', '=', name),
|
||||
('amount', '=', amount),
|
||||
('statement_id', '=', ctx.found_item.id)])
|
||||
assert line
|
||||
ctx.line = line
|
||||
|
||||
@given(u'I set the voucher paid amount to "{amount}"')
|
||||
def impl(ctx, amount):
|
||||
assert ctx.line
|
||||
voucher = model('account.voucher').get(ctx.line.voucher_id.id)
|
||||
assert voucher
|
||||
|
||||
vals = voucher.onchange_amount(float(amount),
|
||||
voucher.payment_rate,
|
||||
voucher.partner_id.id,
|
||||
voucher.journal_id.id if voucher.journal_id else False,
|
||||
voucher.currency_id.id if voucher.currency_id else False,
|
||||
voucher.type,
|
||||
voucher.date,
|
||||
voucher.payment_rate,
|
||||
voucher.company_id.id if voucher.company_id else false)
|
||||
vals = vals['value']
|
||||
vals.update({'amount': ctx.line.voucher_id.amount})
|
||||
voucher_line_ids = []
|
||||
voucher_line_dr_ids = []
|
||||
v_l_obj = model('account.voucher.line')
|
||||
for v_line_vals in vals.get('line_cr_ids', []) or []:
|
||||
v_line_vals['voucher_id'] = voucher.id
|
||||
voucher_line_ids.append(v_l_obj.create(v_line_vals).id)
|
||||
vals['line_cr_ids'] = voucher_line_ids
|
||||
|
||||
for v_line_vals in vals.get('line_dr_ids', []) or []:
|
||||
v_line_vals['voucher_id'] = voucher.id
|
||||
voucher_line_dr_ids.append(v_l_obj.create(v_line_vals).id)
|
||||
vals['line_dr_ids'] = voucher_line_ids
|
||||
|
||||
voucher.write(vals)
|
||||
ctx.vals = vals
|
||||
ctx.voucher = voucher
|
||||
|
||||
@given(u'I save the voucher')
|
||||
def impl(ctx):
|
||||
assert True
|
||||
|
||||
@given(u'I modify the line amount to "{amount}"')
|
||||
@then(u'I modify the line amount to "{amount}"')
|
||||
def impl(ctx, amount):
|
||||
assert ctx.line
|
||||
# we have to change voucher amount before chaning statement line amount
|
||||
if ctx.line.voucher_id:
|
||||
model('account.voucher').write([ctx.line.voucher_id.id],
|
||||
{'amount': float(amount)})
|
||||
ctx.line.write({'amount': float(amount)})
|
||||
|
||||
@step('My invoice "{inv_name}" is in state "{state}" reconciled with a residual amount of "{amount:f}"')
|
||||
def impl(ctx, inv_name, state, amount):
|
||||
invoice = model('account.invoice').get([('name', '=', inv_name)])
|
||||
assert_almost_equal(invoice.residual, amount)
|
||||
assert_equal(invoice.state, state)
|
||||
|
||||
@step('I modify the bank statement line amount to {amount:f}')
|
||||
def impl(ctx, amount):
|
||||
line = ctx.found_item.voucher_id.line_cr_ids[0]
|
||||
#ctx.voucher = model('account.voucher').get(ctx.found_item.voucher_id.id)
|
||||
ctx.found_item.on_change('onchange_amount', 'amount', (), amount)
|
||||
|
||||
@then(u'I set bank statement end-balance')
|
||||
@given(u'I set bank statement end-balance')
|
||||
def impl(ctx):
|
||||
assert ctx.found_item, "No statement found"
|
||||
ctx.found_item.write({'balance_end_real': ctx.found_item.balance_end})
|
||||
assert ctx.found_item.balance_end == ctx.found_item.balance_end_real
|
||||
|
||||
@when(u'I confirm bank statement')
|
||||
def impl(ctx):
|
||||
assert ctx.found_item
|
||||
assert_equal(ctx.found_item._model._name, 'account.bank.statement')
|
||||
ctx.found_item.button_confirm_bank()
|
||||
@@ -20,9 +20,7 @@
|
||||
##############################################################################
|
||||
import netsvc
|
||||
import logging
|
||||
from openerp.osv.orm import TransientModel, fields
|
||||
from openerp.osv.osv import except_osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv.orm import TransientModel, fields
|
||||
|
||||
logger = logging.getLogger('credit.control.line.mailing')
|
||||
|
||||
@@ -51,24 +49,6 @@ class CreditCommunication(TransientModel):
|
||||
cr, uid, 'credit.control.policy', context=c),
|
||||
'user_id': lambda s, cr, uid, c: uid}
|
||||
|
||||
def get_address(self, cr, uid, com_id, context=None):
|
||||
"""Return a valid address for customer"""
|
||||
assert not (isinstance(com_id, list) and len(com_id) > 1), \
|
||||
"com_id: only one id expected"
|
||||
if isinstance(com_id, list):
|
||||
com_id = com_id[0]
|
||||
form = self.browse(cr, uid, com_id, context=context)
|
||||
part_obj = self.pool.get('res.partner')
|
||||
adds = part_obj.address_get(cr, uid, [form.partner_id.id],
|
||||
adr_pref=['invoice', 'default'])
|
||||
|
||||
add = adds.get('invoice', adds.get('default'))
|
||||
add_obj = self.pool.get('res.partner.address')
|
||||
if add:
|
||||
return add_obj.browse(cr, uid, add, context=context)
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_email(self, cr, uid, com_id, context=None):
|
||||
"""Return a valid email for customer"""
|
||||
assert not (isinstance(com_id, list) and len(com_id) > 1), \
|
||||
@@ -76,10 +56,7 @@ class CreditCommunication(TransientModel):
|
||||
if isinstance(com_id, list):
|
||||
com_id = com_id[0]
|
||||
form = self.browse(cr, uid, com_id, context=context)
|
||||
address = form.get_address()
|
||||
email = ''
|
||||
if address and address.email:
|
||||
email = address.email
|
||||
email = form.partner_id.email or False
|
||||
return email
|
||||
|
||||
def _get_credit_lines(self, cr, uid, line_ids, partner_id, level_id, context=None):
|
||||
@@ -124,15 +101,12 @@ class CreditCommunication(TransientModel):
|
||||
"""Generate email message using template related to level"""
|
||||
cr_line_obj = self.pool.get('credit.control.line')
|
||||
email_temp_obj = self.pool.get('email.template')
|
||||
email_message_obj = self.pool.get('mail.message')
|
||||
email_message_obj = self.pool.get('mail.mail')
|
||||
email_ids = []
|
||||
|
||||
essential_fields = [
|
||||
'subject',
|
||||
'body_html',
|
||||
'email_from',
|
||||
'email_to'
|
||||
]
|
||||
essential_fields = ['subject',
|
||||
'body_html',
|
||||
'email_from',
|
||||
'email_to']
|
||||
|
||||
for comm in comms:
|
||||
# we want to use a local cr in order to send the maximum
|
||||
@@ -141,9 +115,11 @@ class CreditCommunication(TransientModel):
|
||||
email_values = {}
|
||||
cl_ids = [cl.id for cl in comm.credit_control_line_ids]
|
||||
email_values = email_temp_obj.generate_email(cr, uid,
|
||||
template,
|
||||
comm.id,
|
||||
context=context)
|
||||
template,
|
||||
comm.id,
|
||||
context=context)
|
||||
email_values['body_html'] = email_values['body']
|
||||
email_values['type'] = 'email'
|
||||
|
||||
email_id = email_message_obj.create(cr, uid, email_values, context=context)
|
||||
|
||||
@@ -178,4 +154,3 @@ class CreditCommunication(TransientModel):
|
||||
l_obj = self.pool.get('credit.control.line')
|
||||
l_obj.write(cr, uid, line_ids, {'state': 'sent'}, context=context)
|
||||
return line_ids
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class CreditControlPrinter(TransientModel):
|
||||
|
||||
def print_lines(self, cr, uid, wiz_id, context=None):
|
||||
assert not (isinstance(wiz_id, list) and len(wiz_id) > 1), \
|
||||
"wiz_id: only one id expected"
|
||||
"wiz_id: only one id expected"
|
||||
comm_obj = self.pool.get('credit.control.communication')
|
||||
if isinstance(wiz_id, list):
|
||||
wiz_id = wiz_id[0]
|
||||
@@ -75,15 +75,20 @@ class CreditControlPrinter(TransientModel):
|
||||
raise except_osv(_('Error'), _('No credit control lines selected.'))
|
||||
|
||||
line_ids = [l.id for l in form.line_ids]
|
||||
comms = comm_obj._generate_comm_from_credit_line_ids(
|
||||
cr, uid, line_ids, context=context)
|
||||
comms = comm_obj._generate_comm_from_credit_line_ids(cr, uid, line_ids,
|
||||
context=context)
|
||||
report_file = comm_obj._generate_report(cr, uid, comms, context=context)
|
||||
|
||||
form.write({'report_file': base64.b64encode(report_file), 'state': 'done'})
|
||||
|
||||
if form.mark_as_sent:
|
||||
filtered_ids = self._filter_line_ids(cr, uid, line_ids, context)
|
||||
comm_obj._mark_credit_line_as_sent(cr, uid, comms, context=context)
|
||||
|
||||
return False # do not close the window, we need it to download the report
|
||||
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'res_model': 'credit.control.printer',
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'res_id': form.id,
|
||||
'views': [(False, 'form')],
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user