diff --git a/account_credit_control/__init__.py b/account_credit_control/__init__.py
new file mode 100644
index 000000000..fcbbd9b69
--- /dev/null
+++ b/account_credit_control/__init__.py
@@ -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 .
+#
+##############################################################################
+from . import run
+from . import line
+from . import account
+from . import partner
+from . import policy
+from . import company
+import wizard
+import report
diff --git a/account_credit_control/__openerp__.py b/account_credit_control/__openerp__.py
new file mode 100644
index 000000000..b37ce24d9
--- /dev/null
+++ b/account_credit_control/__openerp__.py
@@ -0,0 +1,80 @@
+# -*- 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 .
+#
+##############################################################################
+{'name' : 'Account Credit Control',
+ 'version' : '0.1',
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'category': 'Finance',
+ 'complexity': "normal",
+ 'depends' : ['base', 'account', 'email_template', 'report_webkit'],
+ 'description': """
+Credit Control
+==============
+
+Configuration
+-------------
+
+Configure the policies and policy levels in ``Accounting > Configuration >
+Credit Control > Credit Policies``.
+You can define as many policy levels as you need.
+
+Configure a tolerance for the Credit control and a default policy
+applied on all partners in each company, under the Accounting tab.
+
+You are able to specify a particular policy for one partner or one invoice.
+
+Usage
+-----
+
+Menu entries are located in ``Accounting > Periodical Processing > 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.
+
+On each generated line, you have many choices:
+ * Send a email
+ * Print a letter
+ * 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",
+ ],
+ 'demo_xml': ["credit_control_demo.xml"],
+ 'tests': [],
+ 'installable': True,
+ 'license': 'AGPL-3',
+ 'application': True
+}
+
diff --git a/account_credit_control/account.py b/account_credit_control/account.py
new file mode 100644
index 000000000..a515bb9b0
--- /dev/null
+++ b/account_credit_control/account.py
@@ -0,0 +1,73 @@
+# -*- 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 .
+#
+##############################################################################
+
+from openerp.osv.orm import Model, fields
+
+
+class AccountAccount(Model):
+ """Add a link to a credit control policy on account.account"""
+
+ _inherit = "account.account"
+
+ _columns = {
+ 'credit_control_line_ids': fields.one2many('credit.control.line',
+ 'account_id',
+ string='Credit Lines',
+ readonly=True)
+ }
+
+
+class AccountInvoice(Model):
+ """Add a link to a credit control policy on account.account"""
+
+ _inherit = "account.invoice"
+ _columns = {
+ 'credit_policy_id': fields.many2one('credit.control.policy',
+ 'Credit Control Policy',
+ help=("The Credit Control Policy "
+ "used for this invoice. "
+ "If nothing is defined, "
+ "it will use the account "
+ "setting or the partner "
+ "setting.")),
+
+ 'credit_control_line_ids': fields.one2many('credit.control.line',
+ 'invoice_id',
+ string='Credit Lines',
+ readonly=True)
+ }
+
+ def action_move_create(self, cr, uid, ids, context=None):
+ """ Write the id of the invoice in the generated moves. """
+ res = super(AccountInvoice, self).action_move_create(cr, uid, ids, context=context)
+ for inv in self.browse(cr, uid, ids, context=context):
+ if inv.move_id:
+ for line in inv.move_id.line_id:
+ line.write({'invoice_id': inv.id})
+ return res
+
+
+class AccountMoveLine(Model):
+
+ _inherit = "account.move.line"
+
+ _columns = {'invoice_id': fields.many2one('account.invoice', 'Invoice')}
+
diff --git a/account_credit_control/account_view.xml b/account_credit_control/account_view.xml
new file mode 100644
index 000000000..cb44a7c67
--- /dev/null
+++ b/account_credit_control/account_view.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ invoice.followup.form.view
+ account.invoice
+
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_credit_control/company.py b/account_credit_control/company.py
new file mode 100644
index 000000000..7a31b7d84
--- /dev/null
+++ b/account_credit_control/company.py
@@ -0,0 +1,40 @@
+# -*- 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 .
+#
+##############################################################################
+from openerp.osv.orm import Model, fields
+
+
+class ResCompany(Model):
+
+ _inherit = 'res.company'
+
+ _columns = {
+ 'credit_control_tolerance': fields.float('Credit Control Tolerance'),
+ # This is not a property on the partner because we cannot search
+ # on fields.property (subclass fields.function).
+ 'credit_policy_id': fields.many2one(
+ 'credit.control.policy',
+ 'Credit Control Policy',
+ help=("The Credit Control Policy used on partners by default. This "
+ "setting can be overriden on partners or invoices.")),
+ }
+
+ _defaults = {"credit_control_tolerance": 0.1}
+
diff --git a/account_credit_control/company_view.xml b/account_credit_control/company_view.xml
new file mode 100644
index 000000000..75139b9be
--- /dev/null
+++ b/account_credit_control/company_view.xml
@@ -0,0 +1,16 @@
+
+
+
+ credit.control.company.form
+ res.company
+ form
+
+
+
+
+
+
+
+
+
+
diff --git a/account_credit_control/credit_control_demo.xml b/account_credit_control/credit_control_demo.xml
new file mode 100644
index 000000000..96734fbea
--- /dev/null
+++ b/account_credit_control/credit_control_demo.xml
@@ -0,0 +1,33 @@
+
+
+
+ X11002-a
+ B2B Debtors - (test)
+
+ receivable
+
+
+
+
+
+
+ X11002-b
+ B2C Debtors - (test)
+
+ receivable
+
+
+
+
+
+
+ X11002-c
+ New Debtors - (test)
+
+ receivable
+
+
+
+
+
+
diff --git a/account_credit_control/data.xml b/account_credit_control/data.xml
new file mode 100644
index 000000000..de9e8ee7e
--- /dev/null
+++ b/account_credit_control/data.xml
@@ -0,0 +1,236 @@
+
+
+
+
+ Credit Control Email
+ noreply@localhost
+ Credit Control: (${object.current_policy_level.name or 'n/a' })
+ ${object.get_email() or ''}
+
+
+
+ %if mode != 'pdf':
+
+
+ %endif
+
+
+
Dear ${object.partner_id.name or ''},
+
+
${object.current_policy_level.custom_text}
+
+
+
Summary
+
+
date due
+
Amount due
+
Amount balance
+
Invoice number
+
+%for line in object.credit_control_line_ids:
+
+
${line.date_due}
+
${line.amount_due}
+
${line.balance_due}
+ %if line.invoice_id:
+
${line.invoice_id.number}
+ %else:
+
n/a
+ %endif
+%endfor
+
+
+
+
+
If you have any question, do not hesitate to contact us.
+
+
Thank you for choosing ${object.company_id.name}!
+
+ -- more info here --
+
${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
+ ${object.company_id.name}
+ % if object.company_id.street:
+ ${object.company_id.street or ''}
+
+ % endif
+
+ % if object.company_id.street2:
+ ${object.company_id.street2}
+ % endif
+ % if object.company_id.city or object.company_id.zip:
+ ${object.company_id.zip or ''} ${object.company_id.city or ''}
+ % endif
+ % if object.company_id.country_id:
+ ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
+ % endif
+ % if object.company_id.phone:
+ Phone: ${object.company_id.phone}
+ % endif
+ % if object.company_id.website:
+ ${object.company_id.website or ''}
+ % endif
+ ]]>
+
+
+
+
+ No follow
+
+
+
+
+
+ 3 time policy
+
+
+
+ 10 days net
+
+ net_days
+
+
+
+ email
+ Dear Sir or Madam,
+
+Our records indicate that we have not received the payment of the
+above mentioned invoice (copy attached for your convenience). If it
+has already been sent, please disregard this notice. If not, please
+proceed with payment within 10 days.
+
+Thank you in advance for your anticipated cooperation in this matter.
+
+Best regards,
+
+
+
+
+ 30 days end of month
+
+ end_of_month
+
+
+
+ email
+ Dear Sir or Madam,
+
+Our records indicate that we have not yet received the payment of the
+above mentioned invoice (copy attached for your convenience) despite
+our first reminder. If it has already been sent, please disregard
+this notice. If not, please proceed with payment within 5 days.
+
+Thank you in advance for your anticipated cooperation in this matter.
+
+Best regards,
+
+
+
+
+ 10 days last reminder
+
+ previous_date
+
+
+
+ letter
+ Dear Sir or Madam,
+
+Our records indicate that we still have not received the payment of
+the above mentioned invoice (copy attached) despite our two reminders.
+If payment have already been sent, please disregard this notice. If
+not, please proceed with payment. If your payment has not been
+received in the next 5 days, your file will be transfered to our debt
+collection agency.
+
+Should you need us to arrange a payment plan for you, please advise.
+A customer account statement is enclosed for you convenience.
+
+Thank you in advance for your anticipated cooperation in this matter.
+
+Best regards,
+
+
+
+
+
+ 2 time policy
+
+
+
+ 30 days end of month
+
+ end_of_month
+
+
+
+ email
+ Dear Sir or Madam,
+
+Our records indicate that we have not received the payment of the
+above mentioned invoice (copy attached for your convenience). If it
+has already been sent, please disregard this notice. If not, please
+proceed with payment within 10 days.
+
+Thank you in advance for your anticipated cooperation in this matter.
+
+Best regards,
+
+
+
+
+ 60 days last reminder
+
+ previous_date
+
+
+
+ letter
+ Dear Sir or Madam,
+
+Our records indicate that we still have not received the payment of
+the above mentioned invoice (copy attached) despite our reminder.
+If payment have already been sent, please disregard this notice. If
+not, please proceed with payment. If your payment has not been
+received in the next 5 days, your file will be transfered to our debt
+collection agency.
+
+Should you need us to arrange a payment plan for you, please advise.
+A customer account statement is enclosed for you convenience.
+
+Thank you in advance for your anticipated cooperation in this matter.
+
+Best regards,
+
+
+
+
+ Credit Control Manager
+
+
+
+
+ Credit Control User
+
+
+
+
+ Credit Control Info
+
+
+
+
+
+
+
+
+
diff --git a/account_credit_control/i18n/account_credit_control.pot b/account_credit_control/i18n/account_credit_control.pot
new file mode 100644
index 000000000..2cc7c34c8
--- /dev/null
+++ b/account_credit_control/i18n/account_credit_control.pot
@@ -0,0 +1,787 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_credit_control
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-07 13:23+0000\n"
+"PO-Revision-Date: 2012-11-07 13:23+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.2_time_1
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_1
+msgid "Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience). If it\n"
+"has already been sent, please disregard this notice. If not, please\n"
+"proceed with payment within 10 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+""
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,custom_text:0
+msgid "Custom Message"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_mailer
+msgid "Mass credit line mailer"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "More..."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Group By..."
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.credit_control_run
+#: model:ir.ui.menu,name:account_credit_control.credit_control_run_menu
+msgid "Credit Control Run"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,computation_mode:0
+msgid "Compute Mode"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_emailer_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_emailer_wizard_menu_action
+msgid "Send By Email"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_line
+msgid "A credit control line"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,move_line_id:0
+msgid "Move line"
+msgstr ""
+
+#. module: account_credit_control
+#: model:res.groups,name:account_credit_control.group_account_credit_control_info
+msgid "Credit Control Info"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_emailer
+msgid "Mass credit line emailer"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,account_id:0
+#: view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_account_account
+msgid "Account"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Due Date"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.communication,current_policy_level:0
+#: field:credit.control.line,level:0
+#: view:credit.control.lines:0
+#: field:credit.control.policy.level,level:0
+msgid "Level"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,delay_days:0
+msgid "Delay (in days)"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_communication
+msgid "credit control communication"
+msgstr ""
+
+#. module: account_credit_control
+#: sql_constraint:account.move.line:0
+msgid "Wrong credit or debit value in accounting entry !"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid "Error ! You can not create recursive accounts."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0
+msgid "Send emails for the selected lines"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_marker
+msgid "Mass marker"
+msgstr ""
+
+#. module: account_credit_control
+#: field:account.invoice,credit_policy_id:0
+#: field:res.company,credit_policy_id:0
+#: field:res.partner,credit_policy_id:0
+msgid "Credit Control Policy"
+msgstr ""
+
+#. module: account_credit_control
+#: view:account.invoice:0
+msgid "Credit control"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid "The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "New lines"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,date_sent:0
+msgid "Sent date"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.policy:0
+#: field:credit.control.policy,account_ids:0
+msgid "Accounts"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.communication,partner_id:0
+#: field:credit.control.line,partner_id:0
+#: view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0
+msgid "Send the emails"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.marker:0
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_marker_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_marker_wizard_menu_action
+msgid "Change Lines' State"
+msgstr ""
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_2
+msgid "Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not yet received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience) despite\n"
+"our first reminder. If it has already been sent, please disregard\n"
+"this notice. If not, please proceed with payment within 5 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+""
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,policy_id:0
+msgid "Related Policy"
+msgstr ""
+
+#. module: account_credit_control
+#: sql_constraint:account.account:0
+msgid "The code of the account must be unique per company !"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:res.company:0
+msgid "Error! You can not create recursive companies."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.policy:0
+#: view:credit.control.policy.level:0
+msgid "Mail and reporting"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Print"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,channel:0
+#: selection:credit.control.policy.level,channel:0
+msgid "Email"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,channel:0
+#: view:credit.control.lines:0
+#: field:credit.control.policy.level,channel:0
+msgid "Channel"
+msgstr ""
+
+#. module: account_credit_control
+#: help:credit.control.run,manual_ids:0
+msgid "If a credit control line has been generated on a policy and the policy has been changed meantime, it has to be handled manually"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.printer,state:0
+msgid "state"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.run,report:0
+msgid "Report"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Due Date, End Of Month"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.marker,name:0
+msgid "Mark as"
+msgstr ""
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.2_time_2
+msgid "Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our reminder.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+""
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+#: field:credit.control.run,policy_ids:0
+msgid "Policies"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,date_due:0
+msgid "Due date"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy,do_nothing:0
+msgid "Do nothing"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,currency_id:0
+msgid "Currency"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not define children to an account with internal type different of \"View\"! "
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_printer
+msgid "Mass printer"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.communication,company_id:0
+#: field:credit.control.line,company_id:0
+#: field:credit.control.policy,company_id:0
+msgid "Company"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.marker:0
+#: model:ir.actions.act_window,help:account_credit_control.open_credit_line_marker_wizard
+msgid "Change the state of the selected lines."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Print the selected lines"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+#: view:credit.control.lines:0
+#: selection:credit.control.marker,name:0
+#: selection:credit.control.run,state:0
+msgid "Draft"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Credit policy"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.policy:0
+#: view:credit.control.policy.level:0
+msgid "Delay Setting"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,balance_due:0
+msgid "Due balance"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Credit policy level"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_run
+msgid "Credit control line generator"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.communication,user_id:0
+msgid "User"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,channel:0
+#: selection:credit.control.policy.level,channel:0
+msgid "Letter"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_account_move_line
+msgid "Journal Items"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,help:account_credit_control.open_credit_line_printer_wizard
+msgid "Print selected lines"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid "You can not create journal items on an account of type view."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.emailer,line_ids:0
+#: field:credit.control.marker,line_ids:0
+#: field:credit.control.printer,line_ids:0
+#: model:ir.actions.act_window,name:account_credit_control.credit_control_line_action
+#: model:ir.ui.menu,name:account_credit_control.credit_control_line_action_menu
+#: field:res.partner,credit_control_line_ids:0
+msgid "Credit Control Lines"
+msgstr ""
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_3
+msgid "Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our two reminders.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+""
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_printer_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_printer_wizard_menu_action
+msgid "Print Lines"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.run,date:0
+msgid "Controlling Date"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_policy
+msgid "Define a reminder policy"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,email_template_id:0
+msgid "Email Template"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+#: view:credit.control.lines:0
+#: selection:credit.control.marker,name:0
+msgid "Ready To Send"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_res_company
+msgid "Companies"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.printer,mark_as_sent:0
+msgid "Mark letter lines as sent"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+msgid "Compute Credit Control Lines"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Previous Reminder"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+#: view:credit.control.lines:0
+msgid "Error"
+msgstr ""
+
+#. module: account_credit_control
+#: sql_constraint:account.invoice:0
+msgid "Invoice Number must be unique per Company!"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+msgid "Report and Errors"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not select an account type with a deferral method different of \"Unreconciled\" for accounts with internal type \"Payable/Receivable\"! "
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,state:0
+#: field:credit.control.run,state:0
+msgid "State"
+msgstr ""
+
+#. module: account_credit_control
+#: help:credit.control.policy,do_nothing:0
+msgid "For policies which should not generate lines or are obsolete"
+msgstr ""
+
+#. module: account_credit_control
+#: field:account.account,credit_control_line_ids:0
+#: field:account.invoice,credit_control_line_ids:0
+#: field:credit.control.communication,credit_control_line_ids:0
+#: model:ir.actions.act_window,name:account_credit_control.act_account_credit_relation_relation
+#: model:ir.actions.act_window,name:account_credit_control.act_partner_credit_relation_relation
+msgid "Credit Lines"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+#: selection:credit.control.marker,name:0
+#: selection:credit.control.run,state:0
+msgid "Done"
+msgstr ""
+
+#. module: account_credit_control
+#: field:account.move.line,invoice_id:0
+#: field:credit.control.line,invoice_id:0
+#: view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0
+#: view:credit.control.marker:0
+#: view:credit.control.printer:0
+msgid "Cancel"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Close"
+msgstr ""
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+msgid "Emailing Error"
+msgstr ""
+
+#. module: account_credit_control
+#: help:account.invoice,credit_policy_id:0
+msgid "The Credit Control Policy used for this invoice. If nothing is defined, it will use the account setting or the partner setting."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+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"
+" \n"
+" \n"
+" %endif\n"
+"
\n"
+"\n"
+"
Dear ${object.partner_id.name or ''},
\n"
+"\n"
+"
${object.current_policy_level.custom_text}
\n"
+"\n"
+"
\n"
+"
Summary
\n"
+"
\n"
+"
date due
\n"
+"
Amount due
\n"
+"
Amount balance
\n"
+"
Invoice number
\n"
+"
\n"
+"%for line in object.credit_control_line_ids:\n"
+"
\n"
+"
${line.date_due}
\n"
+"
${line.amount_due}
\n"
+"
${line.balance_due}
\n"
+" %if line.invoice_id:\n"
+"
${line.invoice_id.number}
\n"
+" %else:\n"
+"
n/a
\n"
+" %endif\n"
+"%endfor\n"
+"
\n"
+" \n"
+" \n"
+"\n"
+"
If you have any question, do not hesitate to contact us.
\n"
+"\n"
+"
Thank you for choosing ${object.company_id.name}!
\n"
+"\n"
+" -- more info here --\n"
+"
${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''} \n"
+" ${object.company_id.name} \n"
+" % if object.company_id.street:\n"
+" ${object.company_id.street or ''} \n"
+"\n"
+" % endif\n"
+"\n"
+" % if object.company_id.street2:\n"
+" ${object.company_id.street2} \n"
+" % endif\n"
+" % if object.company_id.city or object.company_id.zip:\n"
+" ${object.company_id.zip or ''} ${object.company_id.city or ''} \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 ''} \n"
+" % endif\n"
+" % if object.company_id.phone:\n"
+" Phone: ${object.company_id.phone} \n"
+" % endif\n"
+" % if object.company_id.website:\n"
+" ${object.company_id.website or ''} \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."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.run,manual_ids:0
+msgid "Lines to handle manually"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.ui.menu,name:account_credit_control.base_credit_control_configuration_menu
+#: model:ir.ui.menu,name:account_credit_control.base_credit_control_menu
+msgid "Credit Control"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.policy:0
+#: field:credit.control.policy,level_ids:0
+msgid "Policy Levels"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid "The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account or select a multi-currency view on the journal."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,policy_id:0
+msgid "Policy"
+msgstr ""
+
+#. module: account_credit_control
+#: model:email.template,subject:account_credit_control.email_template_credit_control_base
+msgid "Credit Control: (${object.current_policy_level.name or 'n/a' })"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.printer,report_file:0
+msgid "Generated Report"
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+msgid "Move lines To be treated manually"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.credit_policy_configuration_action
+#: model:ir.ui.menu,name:account_credit_control.credit_policy_configuration_action_menu
+msgid "Credit Control Policies"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,help:account_credit_control.open_credit_line_emailer_wizard
+msgid "Send an email for the selected lines."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Sent"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:credit.control.policy.level:0
+msgid "The smallest level can not be of type Previous Reminder"
+msgstr ""
+
+#. module: account_credit_control
+#: help:credit.control.policy,account_ids:0
+msgid "This policy will be active only for the selected accounts"
+msgstr ""
+
+#. module: account_credit_control
+#: help:credit.control.printer,mark_as_sent:0
+msgid "Only letter lines will be marked."
+msgstr ""
+
+#. module: account_credit_control
+#: view:credit.control.line:0
+#: view:credit.control.lines:0
+msgid "Control Credit Lines"
+msgstr ""
+
+#. module: account_credit_control
+#: model:res.groups,name:account_credit_control.group_account_credit_control_manager
+msgid "Credit Control Manager"
+msgstr ""
+
+#. module: account_credit_control
+#: sql_constraint:res.company:0
+msgid "The company name must be unique !"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.policy,name:0
+#: field:credit.control.policy.level,name:0
+msgid "Name"
+msgstr ""
+
+#. module: account_credit_control
+#: help:res.partner,credit_policy_id:0
+msgid "The Credit Control Policyused for this partner. This setting can be forced on the invoice. If nothing is defined, it will use the company setting."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,mail_message_id:0
+msgid "Sent Email"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_policy_level
+msgid "A credit control policy level"
+msgstr ""
+
+#. module: account_credit_control
+#: model:ir.actions.report.xml,name:account_credit_control.report_webkit_html
+msgid "Credit Summary"
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,date:0
+msgid "Controlling date"
+msgstr ""
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid "You can not create journal items on closed account."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,amount_due:0
+msgid "Due Amount Tax incl."
+msgstr ""
+
+#. module: account_credit_control
+#: field:res.company,credit_control_tolerance:0
+msgid "Credit Control Tolerance"
+msgstr ""
+
+#. module: account_credit_control
+#: help:res.company,credit_policy_id:0
+msgid "The Credit Control Policy used on partners by default. This setting can be overriden on partners or invoices."
+msgstr ""
+
+#. module: account_credit_control
+#: field:credit.control.line,policy_level_id:0
+msgid "Overdue Level"
+msgstr ""
+
diff --git a/account_credit_control/i18n/en.po b/account_credit_control/i18n/en.po
new file mode 100644
index 000000000..e93794f55
--- /dev/null
+++ b/account_credit_control/i18n/en.po
@@ -0,0 +1,1026 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_credit_control
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-07 15:35+0000\n"
+"PO-Revision-Date: 2012-11-07 14:24+0100\n"
+"Last-Translator: Guewen Baconnier \n"
+"Language-Team: EN\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.2_time_1
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_1
+msgid ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience). If it\n"
+"has already been sent, please disregard this notice. If not, please\n"
+"proceed with payment within 10 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+msgstr ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience). If it\n"
+"has already been sent, please disregard this notice. If not, please\n"
+"proceed with payment within 10 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,custom_text:0
+msgid "Custom Message"
+msgstr "Custom Message"
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "More..."
+msgstr "More..."
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Group By..."
+msgstr "Group By..."
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.credit_control_run
+#: model:ir.ui.menu,name:account_credit_control.credit_control_run_menu
+msgid "Credit Control Run"
+msgstr "Credit Control Run"
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,computation_mode:0
+msgid "Compute Mode"
+msgstr "Compute Mode"
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_emailer_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_emailer_wizard_menu_action
+msgid "Send By Email"
+msgstr "Send By Email"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_line
+msgid "A credit control line"
+msgstr "A credit control line"
+
+#. module: account_credit_control
+#: field:credit.control.line,move_line_id:0
+msgid "Move line"
+msgstr "Move line"
+
+#. module: account_credit_control
+#: model:res.groups,name:account_credit_control.group_account_credit_control_info
+msgid "Credit Control Info"
+msgstr "Credit Control Info"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_emailer
+msgid "Mass credit line emailer"
+msgstr "Mass credit line emailer"
+
+#. module: account_credit_control
+#: field:credit.control.line,account_id:0 view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_account_account
+msgid "Account"
+msgstr "Account"
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Due Date"
+msgstr "Due Date"
+
+#. module: account_credit_control
+#: field:credit.control.communication,current_policy_level:0
+#: field:credit.control.line,level:0 view:credit.control.lines:0
+#: field:credit.control.policy.level,level:0
+msgid "Level"
+msgstr "Level"
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,delay_days:0
+msgid "Delay (in days)"
+msgstr "Delay (in days)"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_communication
+msgid "credit control communication"
+msgstr "credit control communication"
+
+#. module: account_credit_control
+#: sql_constraint:account.move.line:0
+msgid "Wrong credit or debit value in accounting entry !"
+msgstr "Wrong credit or debit value in accounting entry!"
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "These lines are ready to send by email or by letter using the Actions."
+msgstr "These lines are ready to send by email or by letter using the Actions."
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_marker
+msgid "Mass marker"
+msgstr "Mass marker"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0 view:credit.control.lines:0
+#: selection:credit.control.marker,name:0
+msgid "Ignored"
+msgstr "Ignored"
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0
+msgid "Send emails for the selected lines"
+msgstr "Send emails for the selected lines"
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid "Error ! You can not create recursive accounts."
+msgstr "Error! You can not create recursive accounts."
+
+#. module: account_credit_control
+#: field:account.invoice,credit_policy_id:0
+#: field:res.company,credit_policy_id:0 field:res.partner,credit_policy_id:0
+msgid "Credit Control Policy"
+msgstr "Credit Control Policy"
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid ""
+"The date of your Journal Entry is not in the defined period! You should "
+"change the date or remove this constraint from the journal."
+msgstr ""
+"The date of your Journal Entry is not in the defined period! You should "
+"change the date or remove this constraint from the journal."
+
+#. module: account_credit_control
+#: field:credit.control.line,date_sent:0
+msgid "Sent date"
+msgstr "Sent date"
+
+#. module: account_credit_control
+#: view:credit.control.policy:0 field:credit.control.policy,account_ids:0
+msgid "Accounts"
+msgstr "Accounts"
+
+#. module: account_credit_control
+#: field:credit.control.communication,partner_id:0
+#: field:credit.control.line,partner_id:0 view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_res_partner
+msgid "Partner"
+msgstr "Partner"
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0
+msgid "Send the emails"
+msgstr "Send the emails"
+
+#. module: account_credit_control
+#: view:credit.control.marker:0
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_marker_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_marker_wizard_menu_action
+msgid "Change Lines' State"
+msgstr "Change Lines' State"
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_2
+msgid ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not yet received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience) despite\n"
+"our first reminder. If it has already been sent, please disregard\n"
+"this notice. If not, please proceed with payment within 5 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+msgstr ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we have not yet received the payment of the\n"
+"above mentioned invoice (copy attached for your convenience) despite\n"
+"our first reminder. If it has already been sent, please disregard\n"
+"this notice. If not, please proceed with payment within 5 days.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,policy_id:0
+msgid "Related Policy"
+msgstr "Related Policy"
+
+#. module: account_credit_control
+#: sql_constraint:account.account:0
+msgid "The code of the account must be unique per company !"
+msgstr "The code of the account must be unique per company!"
+
+#. module: account_credit_control
+#: constraint:res.company:0
+msgid "Error! You can not create recursive companies."
+msgstr "Error! You can not create recursive companies."
+
+#. module: account_credit_control
+#: view:credit.control.policy:0 view:credit.control.policy.level:0
+msgid "Mail and reporting"
+msgstr "Mail and reporting"
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Print"
+msgstr "Print"
+
+#. module: account_credit_control
+#: selection:credit.control.line,channel:0
+#: selection:credit.control.policy.level,channel:0
+msgid "Email"
+msgstr "Email"
+
+#. module: account_credit_control
+#: field:credit.control.line,channel:0 view:credit.control.lines:0
+#: field:credit.control.policy.level,channel:0
+msgid "Channel"
+msgstr "Channel"
+
+#. module: account_credit_control
+#: help:credit.control.run,manual_ids:0
+msgid ""
+"If a credit control line has been generated on a policy and the policy has "
+"been changed meantime, it has to be handled manually"
+msgstr ""
+"If a credit control line has been generated on a policy and the policy has "
+"been changed meantime, it has to be handled manually"
+
+#. module: account_credit_control
+#: field:credit.control.printer,state:0
+msgid "state"
+msgstr "state"
+
+#. module: account_credit_control
+#: field:credit.control.run,report:0
+msgid "Report"
+msgstr "Report"
+
+#. module: account_credit_control
+#: help:credit.control.line,state:0
+msgid ""
+"Draft lines need to be triaged.\n"
+"Ignored lines are lines for which we do not want to send something.\n"
+"Draft and ignored lines will be generated again on the next run."
+msgstr ""
+"Draft lines need to be triaged.\n"
+"Ignored lines are lines for which we do not want to send something.\n"
+"Draft and ignored lines will be generated again on the next run."
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Due Date, End Of Month"
+msgstr "Due Date, End Of Month"
+
+#. module: account_credit_control
+#: field:credit.control.marker,name:0
+msgid "Mark as"
+msgstr "Mark as"
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.2_time_2
+msgid ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our reminder.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+msgstr ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our reminder.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "An error has occured during the sending of the email."
+msgstr "An error has occured during the sending of the email."
+
+#. module: account_credit_control
+#: view:credit.control.run:0 field:credit.control.run,policy_ids:0
+msgid "Policies"
+msgstr "Policies"
+
+#. module: account_credit_control
+#: field:credit.control.line,date_due:0
+msgid "Due date"
+msgstr "Due date"
+
+#. module: account_credit_control
+#: field:credit.control.policy,do_nothing:0
+msgid "Do nothing"
+msgstr "Do nothing"
+
+#. module: account_credit_control
+#: field:credit.control.line,currency_id:0
+msgid "Currency"
+msgstr "Currency"
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid ""
+"Configuration Error! \n"
+"You can not define children to an account with internal type different of "
+"\"View\"! "
+msgstr ""
+"Configuration Error! \n"
+"You can not define children to an account with internal type different of "
+"\"View\"! "
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_printer
+msgid "Mass printer"
+msgstr "Mass printer"
+
+#. module: account_credit_control
+#: field:credit.control.communication,company_id:0
+#: field:credit.control.line,company_id:0
+#: field:credit.control.policy,company_id:0
+msgid "Company"
+msgstr "Company"
+
+#. module: account_credit_control
+#: view:credit.control.marker:0
+#: model:ir.actions.act_window,help:account_credit_control.open_credit_line_marker_wizard
+msgid "Change the state of the selected lines."
+msgstr "Change the state of the selected lines."
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Lines which have been ignored from previous runs."
+msgstr "Lines which have been ignored from previous runs."
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Print the selected lines"
+msgstr "Print the selected lines"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0 view:credit.control.lines:0
+#: selection:credit.control.run,state:0
+msgid "Draft"
+msgstr "Draft"
+
+#. module: account_credit_control
+#: view:credit.control.marker:0
+msgid "Warning: you will maybe not be able to revert this operation."
+msgstr "Warning: you will maybe not be able to revert this operation."
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Credit policy"
+msgstr "Credit policy"
+
+#. module: account_credit_control
+#: view:credit.control.policy:0 view:credit.control.policy.level:0
+msgid "Delay Setting"
+msgstr "Delay Setting"
+
+#. module: account_credit_control
+#: field:credit.control.line,balance_due:0
+msgid "Due balance"
+msgstr "Due balance"
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Credit policy level"
+msgstr "Credit policy level"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_run
+msgid "Credit control line generator"
+msgstr "Credit control line generator"
+
+#. module: account_credit_control
+#: field:credit.control.communication,user_id:0
+msgid "User"
+msgstr "User"
+
+#. module: account_credit_control
+#: selection:credit.control.line,channel:0
+#: selection:credit.control.policy.level,channel:0
+msgid "Letter"
+msgstr "Letter"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_account_move_line
+msgid "Journal Items"
+msgstr "Journal Items"
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,help:account_credit_control.open_credit_line_printer_wizard
+msgid "Print selected lines"
+msgstr "Print selected lines"
+
+#. module: account_credit_control
+#: constraint:account.move.line:0
+msgid "You can not create journal items on an account of type view."
+msgstr "You can not create journal items on an account of type view."
+
+#. module: account_credit_control
+#: field:credit.control.emailer,line_ids:0
+#: field:credit.control.marker,line_ids:0
+#: field:credit.control.printer,line_ids:0
+#: model:ir.actions.act_window,name:account_credit_control.credit_control_line_action
+#: model:ir.ui.menu,name:account_credit_control.credit_control_line_action_menu
+#: field:res.partner,credit_control_line_ids:0
+msgid "Credit Control Lines"
+msgstr "Credit Control Lines"
+
+#. module: account_credit_control
+#: model:credit.control.policy.level,custom_text:account_credit_control.3_time_3
+msgid ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our two reminders.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+msgstr ""
+"Dear Sir or Madam,\n"
+"\n"
+"Our records indicate that we still have not received the payment of\n"
+"the above mentioned invoice (copy attached) despite our two reminders.\n"
+"If payment have already been sent, please disregard this notice. If\n"
+"not, please proceed with payment. If your payment has not been\n"
+"received in the next 5 days, your file will be transfered to our debt\n"
+"collection agency.\n"
+"\n"
+"Should you need us to arrange a payment plan for you, please advise.\n"
+"A customer account statement is enclosed for you convenience.\n"
+"\n"
+"Thank you in advance for your anticipated cooperation in this matter.\n"
+"\n"
+"Best regards,\n"
+
+#. module: account_credit_control
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_printer_wizard
+#: model:ir.actions.act_window,name:account_credit_control.open_credit_line_printer_wizard_menu_action
+msgid "Print Lines"
+msgstr "Print Lines"
+
+#. module: account_credit_control
+#: field:credit.control.run,date:0
+msgid "Controlling Date"
+msgstr "Controlling Date"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_credit_control_policy
+msgid "Define a reminder policy"
+msgstr "Define a reminder policy"
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Lines already sent."
+msgstr "Lines already sent."
+
+#. module: account_credit_control
+#: field:credit.control.policy.level,email_template_id:0
+msgid "Email Template"
+msgstr "Email Template"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0 view:credit.control.lines:0
+#: selection:credit.control.marker,name:0
+msgid "Ready To Send"
+msgstr "Ready To Send"
+
+#. module: account_credit_control
+#: model:ir.model,name:account_credit_control.model_res_company
+msgid "Companies"
+msgstr "Companies"
+
+#. module: account_credit_control
+#: field:credit.control.printer,mark_as_sent:0
+msgid "Mark letter lines as sent"
+msgstr "Mark letter lines as sent"
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+msgid "Compute Credit Control Lines"
+msgstr "Compute Credit Control Lines"
+
+#. module: account_credit_control
+#: selection:credit.control.policy.level,computation_mode:0
+msgid "Previous Reminder"
+msgstr "Previous Reminder"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0 view:credit.control.lines:0
+msgid "Error"
+msgstr "Error"
+
+#. module: account_credit_control
+#: sql_constraint:account.invoice:0
+msgid "Invoice Number must be unique per Company!"
+msgstr "Invoice Number must be unique per Company!"
+
+#. module: account_credit_control
+#: view:credit.control.run:0
+msgid "Report and Errors"
+msgstr "Report and Errors"
+
+#. module: account_credit_control
+#: constraint:account.account:0
+msgid ""
+"Configuration Error! \n"
+"You can not select an account type with a deferral method different of "
+"\"Unreconciled\" for accounts with internal type \"Payable/Receivable\"! "
+msgstr ""
+"Configuration Error! \n"
+"You can not select an account type with a deferral method different of "
+"\"Unreconciled\" for accounts with internal type \"Payable/Receivable\"! "
+
+#. module: account_credit_control
+#: field:credit.control.line,state:0 field:credit.control.run,state:0
+msgid "State"
+msgstr "State"
+
+#. module: account_credit_control
+#: help:credit.control.policy,do_nothing:0
+msgid "For policies which should not generate lines or are obsolete"
+msgstr "For policies which should not generate lines or are obsolete"
+
+#. module: account_credit_control
+#: field:account.account,credit_control_line_ids:0
+#: field:account.invoice,credit_control_line_ids:0
+#: field:credit.control.communication,credit_control_line_ids:0
+#: model:ir.actions.act_window,name:account_credit_control.act_account_credit_relation_relation
+#: model:ir.actions.act_window,name:account_credit_control.act_partner_credit_relation_relation
+msgid "Credit Lines"
+msgstr "Credit Lines"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+#: selection:credit.control.marker,name:0 selection:credit.control.run,state:0
+msgid "Done"
+msgstr "Done"
+
+#. module: account_credit_control
+#: field:account.move.line,invoice_id:0 field:credit.control.line,invoice_id:0
+#: view:credit.control.lines:0
+#: model:ir.model,name:account_credit_control.model_account_invoice
+msgid "Invoice"
+msgstr "Invoice"
+
+#. module: account_credit_control
+#: view:credit.control.emailer:0 view:credit.control.marker:0
+#: view:credit.control.printer:0
+msgid "Cancel"
+msgstr "Cancel"
+
+#. module: account_credit_control
+#: view:credit.control.printer:0
+msgid "Close"
+msgstr "Close"
+
+#. module: account_credit_control
+#: selection:credit.control.line,state:0
+msgid "Emailing Error"
+msgstr "Emailing Error"
+
+#. module: account_credit_control
+#: help:account.invoice,credit_policy_id:0
+msgid ""
+"The Credit Control Policy used for this invoice. If nothing is defined, it "
+"will use the account setting or the partner setting."
+msgstr ""
+"The Credit Control Policy used for this invoice. If nothing is defined, it "
+"will use the account setting or the partner setting."
+
+#. module: account_credit_control
+#: view:credit.control.lines:0
+msgid "Run date"
+msgstr "Run date"
+
+#. module: account_credit_control
+#: model:res.groups,name:account_credit_control.group_account_credit_control_user
+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"
+" \n"
+" \n"
+" %endif\n"
+"
+
+
+
+
+ %for comm in objects :
+ <%
+ 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)
+ %>
+ <%include file="${current_uri}" args="object=comm,user=user,ctx=ctx,quote=quote,format_exception=format_exception,mode='pdf'"/>
+
+
+ %endfor
+
+
+
diff --git a/account_credit_control/report/credit_control_summary.py b/account_credit_control/report/credit_control_summary.py
new file mode 100644
index 000000000..6a19659b7
--- /dev/null
+++ b/account_credit_control/report/credit_control_summary.py
@@ -0,0 +1,37 @@
+# -*- 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 .
+#
+##############################################################################
+import time
+
+from openerp.report import report_sxw
+
+class CreditSummaryReport(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(CreditSummaryReport, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'cr':cr,
+ 'uid': uid,
+ })
+
+report_sxw.report_sxw('report.credit_control_summary',
+ 'credit.control.communication',
+ 'addons/account_credit_control/report/credit_control_summary.html.mako',
+ parser=CreditSummaryReport)
diff --git a/account_credit_control/report/report.xml b/account_credit_control/report/report.xml
new file mode 100644
index 000000000..04e84f277
--- /dev/null
+++ b/account_credit_control/report/report.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/account_credit_control/run.py b/account_credit_control/run.py
new file mode 100644
index 000000000..db5120bfe
--- /dev/null
+++ b/account_credit_control/run.py
@@ -0,0 +1,153 @@
+# -*- 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 .
+#
+##############################################################################
+import logging
+
+from openerp.osv.orm import Model, fields
+from openerp.tools.translate import _
+from openerp.osv.osv import except_osv
+
+logger = logging.getLogger('credit.control.run')
+
+
+class CreditControlRun(Model):
+ """Credit Control run generate all credit control lines and reject"""
+
+ _name = "credit.control.run"
+ _rec_name = 'date'
+ _description = """Credit control line generator"""
+ _columns = {
+ 'date': fields.date('Controlling Date', required=True),
+ 'policy_ids': fields.many2many('credit.control.policy',
+ rel="credit_run_policy_rel",
+ id1='run_id', id2='policy_id',
+ string='Policies',
+ readonly=True,
+ states={'draft': [('readonly', False)]}),
+
+ 'report': fields.text('Report', readonly=True),
+
+ 'state': fields.selection([('draft', 'Draft'),
+ ('done', 'Done'),
+ ],
+ string='State',
+ required=True,
+ readonly=True),
+
+ 'manual_ids': fields.many2many(
+ 'account.move.line',
+ rel="credit_runreject_rel",
+ string='Lines to handle manually',
+ help=('If a credit control line has been generated on a policy '
+ 'and the policy has been changed meantime, '
+ 'it has to be handled manually'),
+ readonly=True),
+ }
+
+ def _get_policies(self, cr, uid, context=None):
+ return self.pool.get('credit.control.policy').\
+ search(cr, uid, [], context=context)
+
+ _defaults = {
+ 'state': 'draft',
+ 'policy_ids': _get_policies,
+ }
+
+ def _check_run_date(self, cr, uid, ids, controlling_date, context=None):
+ """Ensure that there is no credit line in the future using controlling_date"""
+ line_obj = self.pool.get('credit.control.line')
+ lines = line_obj.search(cr, uid, [('date', '>', controlling_date)],
+ order='date DESC', limit=1, context=context)
+ if lines:
+ line = line_obj.browse(cr, uid, lines[0], context=context)
+ raise except_osv(
+ _('Error'),
+ _('A run has already been executed more recently than %s') % (line.date))
+ return True
+
+ def _generate_credit_lines(self, cr, uid, run_id, context=None):
+ """ Generate credit control lines. """
+ cr_line_obj = self.pool.get('credit.control.line')
+ assert not (isinstance(run_id, list) and len(run_id) > 1), \
+ "run_id: only one id expected"
+ if isinstance(run_id, list):
+ run_id = run_id[0]
+
+ run = self.browse(cr, uid, run_id, context=context)
+ manually_managed_lines = set() # line who changed policy
+ credit_line_ids = [] # generated lines
+ run._check_run_date(run.date, context=context)
+
+ policies = run.policy_ids
+ if not policies:
+ raise except_osv(
+ _('Error'),
+ _('Please select a policy'))
+
+ report = ''
+ for policy in policies:
+ if policy.do_nothing:
+ continue
+
+ lines = policy._get_move_lines_to_process(run.date, context=context)
+ manual_lines = policy._lines_different_policy(lines, context=context)
+ lines.difference_update(manual_lines)
+ manually_managed_lines.update(manual_lines)
+
+ if lines:
+ policy_generated_ids = []
+ # policy levels are sorted by level so iteration is in the correct order
+ for level in reversed(policy.level_ids):
+ level_lines = level.get_level_lines(run.date, lines, context=context)
+ policy_generated_ids += cr_line_obj.create_or_update_from_mv_lines(
+ cr, uid, [], list(level_lines), level.id, run.date, context=context)
+
+ if policy_generated_ids:
+ report += _("Policy \"%s\" has generated %d Credit Control Lines.\n") % \
+ (policy.name, len(policy_generated_ids))
+ credit_line_ids += policy_generated_ids
+ else:
+ report += _("Policy \"%s\" has not generated any Credit Control Lines.\n" %
+ policy.name)
+
+ vals = {'state': 'done',
+ 'report': report,
+ 'manual_ids': [(6, 0, manually_managed_lines)]}
+ run.write(vals, context=context)
+
+ def generate_credit_lines(self, cr, uid, run_id, context=None):
+ """Generate credit control lines
+
+ Lock the ``credit_control_run`` Postgres table to avoid concurrent
+ calls of this method.
+ """
+ try:
+ cr.execute('SELECT id FROM credit_control_run'
+ ' LIMIT 1 FOR UPDATE NOWAIT' )
+ except Exception, exc:
+ # in case of exception openerp will do a rollback for us and free the lock
+ raise except_osv(
+ _('Error'),
+ _('A credit control run is already running'
+ ' in background, please try later.'), str(exc))
+
+ self._generate_credit_lines(cr, uid, run_id, context)
+ return True
+
diff --git a/account_credit_control/run_view.xml b/account_credit_control/run_view.xml
new file mode 100644
index 000000000..b3a7be8ae
--- /dev/null
+++ b/account_credit_control/run_view.xml
@@ -0,0 +1,65 @@
+
+
+
+
+ credit.control.run.tree
+ credit.control.run
+ tree
+
+
+
+
+
+
+
+
+
+ credit.control.run.form
+ credit.control.run
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Credit Control Run
+ ir.actions.act_window
+ credit.control.run
+
+ form
+ tree,form
+
+
+
+
+
+
+
+
diff --git a/account_credit_control/security/ir.model.access.csv b/account_credit_control/security/ir.model.access.csv
new file mode 100644
index 000000000..ef38bf9cf
--- /dev/null
+++ b/account_credit_control/security/ir.model.access.csv
@@ -0,0 +1,18 @@
+"id","perm_create","perm_unlink","group_id/id","name","model_id/id","perm_read","perm_write"
+"account_credit_control.ir_model_access_270",1,1,"group_account_credit_control_manager","credit_control_manager_line","account_credit_control.model_credit_control_line",1,1
+"account_credit_control.ir_model_access_271",1,1,"group_account_credit_control_user","credit_control_user_line","account_credit_control.model_credit_control_line",1,1
+"account_credit_control.ir_model_access_272",0,0,"group_account_credit_control_info","credit_control_info_line","account_credit_control.model_credit_control_line",1,0
+"account_credit_control.ir_model_access_273",1,1,"group_account_credit_control_manager","credit_control_manager_mail_template","email_template.model_email_template",1,1
+"account_credit_control.ir_model_access_274",1,1,"group_account_credit_control_manager","credit_control_manager_mail_template_preview","email_template.model_email_template_preview",1,1
+"account_credit_control.ir_model_access_275",1,1,"group_account_credit_control_manager","credit_control_manager_mail_message","mail.model_mail_message",1,1
+"account_credit_control.ir_model_access_276",1,0,"group_account_credit_control_user","credit_control_user_mail_message","mail.model_mail_message",1,1
+"account_credit_control.ir_model_access_277",0,0,"group_account_credit_control_info","credit_control_info_mail_message","mail.model_mail_message",1,0
+"account_credit_control.ir_model_access_281",1,1,"group_account_credit_control_manager","credit_control_mananger_run","account_credit_control.model_credit_control_run",1,1
+"account_credit_control.ir_model_access_282",1,1,"group_account_credit_control_user","credit_control_user_run","account_credit_control.model_credit_control_run",1,1
+"account_credit_control.ir_model_access_283",0,0,"group_account_credit_control_info","credit_control_info_run","account_credit_control.model_credit_control_run",1,0
+"account_credit_control.ir_model_access_284",1,1,"group_account_credit_control_manager","credit_control_manager_policy","account_credit_control.model_credit_control_policy",1,1
+"account_credit_control.ir_model_access_285",0,0,"group_account_credit_control_user","credit_control_user_policy","account_credit_control.model_credit_control_policy",1,0
+"account_credit_control.ir_model_access_286",0,0,"group_account_credit_control_info","credit_control_info_policy","account_credit_control.model_credit_control_policy",1,0
+"account_credit_control.ir_model_access_287",1,1,"group_account_credit_control_manager","credit_control_manager_level","account_credit_control.model_credit_control_policy_level",1,1
+"account_credit_control.ir_model_access_288",0,0,"group_account_credit_control_user","credit_control_user_level","account_credit_control.model_credit_control_policy_level",1,0
+"account_credit_control.ir_model_access_289",0,0,"group_account_credit_control_info","credit_control_info_level","account_credit_control.model_credit_control_policy_level",1,0
diff --git a/account_credit_control/wizard/__init__.py b/account_credit_control/wizard/__init__.py
new file mode 100644
index 000000000..ca0a1758a
--- /dev/null
+++ b/account_credit_control/wizard/__init__.py
@@ -0,0 +1,24 @@
+# -*- 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 .
+#
+##############################################################################
+from . import credit_control_emailer
+from . import credit_control_marker
+from . import credit_control_printer
+from . import credit_control_communication
diff --git a/account_credit_control/wizard/credit_control_communication.py b/account_credit_control/wizard/credit_control_communication.py
new file mode 100644
index 000000000..8f4ac37b2
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_communication.py
@@ -0,0 +1,181 @@
+# -*- 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 .
+#
+##############################################################################
+import netsvc
+import logging
+from openerp.osv.orm import TransientModel, fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+
+logger = logging.getLogger('credit.control.line.mailing')
+
+
+class CreditCommunication(TransientModel):
+ """Shell calss used to provide a base model to email template and reporting.
+ Il use this approche in version 7 a browse record will exist even if not saved"""
+ _name = "credit.control.communication"
+ _description = "credit control communication"
+ _rec_name = 'partner_id'
+ _columns = {'partner_id': fields.many2one('res.partner', 'Partner', required=True),
+
+ 'current_policy_level': fields.many2one('credit.control.policy.level',
+ 'Level', required=True),
+
+ 'credit_control_line_ids': fields.many2many('credit.control.line',
+ rel='comm_credit_rel',
+ string='Credit Lines'),
+
+ 'company_id': fields.many2one('res.company', 'Company',
+ required=True),
+
+ 'user_id': fields.many2one('res.users', 'User')}
+
+ _defaults = {'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(
+ 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), \
+ "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)
+ address = form.get_address()
+ email = ''
+ if address and address.email:
+ email = address.email
+ return email
+
+ def _get_credit_lines(self, cr, uid, line_ids, partner_id, level_id, context=None):
+ """Return credit lines related to a partner and a policy level"""
+ cr_line_obj = self.pool.get('credit.control.line')
+ cr_l_ids = cr_line_obj.search(cr,
+ uid,
+ [('id', 'in', line_ids),
+ ('partner_id', '=', partner_id),
+ ('policy_level_id', '=', level_id)],
+ context=context)
+ return cr_l_ids
+
+ def _generate_comm_from_credit_line_ids(self, cr, uid, line_ids, context=None):
+ if not line_ids:
+ return []
+ comms = []
+ sql = ("SELECT distinct partner_id, policy_level_id, credit_control_policy_level.level"
+ " FROM credit_control_line JOIN credit_control_policy_level "
+ " ON (credit_control_line.policy_level_id = credit_control_policy_level.id)"
+ " WHERE credit_control_line.id in %s"
+ " ORDER by credit_control_policy_level.level")
+
+ cr.execute(sql, (tuple(line_ids),))
+ res = cr.dictfetchall()
+ for level_assoc in res:
+ data = {}
+ data['credit_control_line_ids'] = \
+ [(6, 0, self._get_credit_lines(cr, uid, line_ids,
+ level_assoc['partner_id'],
+ level_assoc['policy_level_id'],
+ context=context))]
+ data['partner_id'] = level_assoc['partner_id']
+ data['current_policy_level'] = level_assoc['policy_level_id']
+ comm_id = self.create(cr, uid, data, context=context)
+
+
+ comms.append(self.browse(cr, uid, comm_id, context=context))
+ return comms
+
+ def _generate_emails(self, cr, uid, comms, context=None):
+ """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_ids = []
+
+ 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
+ # of email
+ template = comm.current_policy_level.email_template_id.id
+ 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)
+
+ email_id = email_message_obj.create(cr, uid, email_values, context=context)
+
+ state = 'sent'
+ # The mail will not be send, however it will be in the pool, in an
+ # error state. So we create it, link it with the credit control line
+ # and put this latter in a `email_error` state we not that we have a
+ # problem with the email
+ if any(not email_values.get(field) for field in essential_fields):
+ state = 'email_error'
+
+ cr_line_obj.write(
+ cr, uid, cl_ids,
+ {'mail_message_id': email_id,
+ 'state': state},
+ context=context)
+
+ email_ids.append(email_id)
+ return email_ids
+
+ def _generate_report(self, cr, uid, comms, context=None):
+ """Will generate a report by inserting mako template of related policy template"""
+ service = netsvc.LocalService('report.credit_control_summary')
+ ids = [x.id for x in comms]
+ result, format = service.create(cr, uid, ids, {}, {})
+ return result
+
+ def _mark_credit_line_as_sent(self, cr, uid, comms, context=None):
+ line_ids = []
+ for comm in comms:
+ line_ids += [x.id for x in comm.credit_control_line_ids]
+ l_obj = self.pool.get('credit.control.line')
+ l_obj.write(cr, uid, line_ids, {'state': 'sent'}, context=context)
+ return line_ids
+
diff --git a/account_credit_control/wizard/credit_control_emailer.py b/account_credit_control/wizard/credit_control_emailer.py
new file mode 100644
index 000000000..c0ca50bf6
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_emailer.py
@@ -0,0 +1,83 @@
+# -*- 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 .
+#
+##############################################################################
+
+from openerp.osv.orm import TransientModel, fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+
+
+class CreditControlEmailer(TransientModel):
+ """Send emails for each selected credit control lines."""
+
+ _name = "credit.control.emailer"
+ _description = """Mass credit line emailer"""
+ _rec_name = 'id'
+
+ def _get_line_ids(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ res = False
+ if (context.get('active_model') == 'credit.control.line' and
+ context.get('active_ids')):
+ res = self._filter_line_ids(
+ cr, uid,
+ context['active_ids'],
+ context=context)
+ return res
+
+ _columns = {
+ 'line_ids': fields.many2many(
+ 'credit.control.line',
+ string='Credit Control Lines',
+ domain="[('state', '=', 'to_be_sent'), ('channel', '=', 'email')]"),
+ }
+
+ _defaults = {
+ 'line_ids': _get_line_ids,
+ }
+
+ def _filter_line_ids(self, cr, uid, active_ids, context=None):
+ """filter lines to use in the wizard"""
+ line_obj = self.pool.get('credit.control.line')
+ domain = [('state', '=', 'to_be_sent'),
+ ('id', 'in', active_ids),
+ ('channel', '=', 'email')]
+ return line_obj.search(cr, uid, domain, context=context)
+
+ def email_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"
+ comm_obj = self.pool.get('credit.control.communication')
+ if isinstance(wiz_id, list):
+ wiz_id = wiz_id[0]
+ form = self.browse(cr, uid, wiz_id, context)
+
+ if not form.line_ids:
+ raise except_osv(_('Error'), _('No credit control lines selected.'))
+
+ line_ids = [l.id for l in form.line_ids]
+ filtered_ids = self._filter_line_ids(
+ cr, uid, line_ids, context)
+ comms = comm_obj._generate_comm_from_credit_line_ids(
+ cr, uid, filtered_ids, context=context)
+ comm_obj._generate_emails(cr, uid, comms, context=context)
+ return {}
+
diff --git a/account_credit_control/wizard/credit_control_emailer_view.xml b/account_credit_control/wizard/credit_control_emailer_view.xml
new file mode 100644
index 000000000..ba28fd139
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_emailer_view.xml
@@ -0,0 +1,44 @@
+
+
+
+
+ credit.line.emailer.form
+ credit.control.emailer
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Send By Email
+ credit.control.emailer
+ form
+ form
+
+ new
+ Send an email for the selected lines.
+
+
+
+
+
diff --git a/account_credit_control/wizard/credit_control_marker.py b/account_credit_control/wizard/credit_control_marker.py
new file mode 100644
index 000000000..b79098f9e
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_marker.py
@@ -0,0 +1,101 @@
+# -*- 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 .
+#
+##############################################################################
+from openerp.osv.orm import TransientModel, fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+
+
+class CreditControlMarker(TransientModel):
+ """Change the state of lines in mass"""
+
+ _name = 'credit.control.marker'
+ _description = 'Mass marker'
+
+ def _get_line_ids(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ res = False
+ if (context.get('active_model') == 'credit.control.line' and
+ context.get('active_ids')):
+ res = self._filter_line_ids(
+ cr, uid,
+ context['active_ids'],
+ context=context)
+ return res
+
+ _columns = {
+ 'name': fields.selection([('ignored', 'Ignored'),
+ ('to_be_sent', 'Ready To Send'),
+ ('sent', 'Done')],
+ 'Mark as', required=True),
+ 'line_ids': fields.many2many(
+ 'credit.control.line',
+ string='Credit Control Lines',
+ domain="[('state', '!=', 'sent')]"),
+ }
+
+ _defaults = {
+ 'name': 'to_be_sent',
+ 'line_ids': _get_line_ids,
+ }
+
+ def _filter_line_ids(self, cr, uid, active_ids, context=None):
+ """get line to be marked filter done lines"""
+ line_obj = self.pool.get('credit.control.line')
+ domain = [('state', '!=', 'sent'), ('id', 'in', active_ids)]
+ return line_obj.search(cr, uid, domain, context=context)
+
+ def _mark_lines(self, cr, uid, filtered_ids, state, context=None):
+ """write hook"""
+ line_obj = self.pool.get('credit.control.line')
+ if not state:
+ raise ValueError(_('state can not be empty'))
+ line_obj.write(cr, uid, filtered_ids, {'state': state}, context=context)
+ return filtered_ids
+
+ def mark_lines(self, cr, uid, wiz_id, context=None):
+ """Write state of selected credit lines to the one in entry
+ done credit line will be ignored"""
+ assert not (isinstance(wiz_id, list) and len(wiz_id) > 1), \
+ "wiz_id: only one id expected"
+ if isinstance(wiz_id, list):
+ wiz_id = wiz_id[0]
+ form = self.browse(cr, uid, wiz_id, context)
+
+ if not form.line_ids:
+ raise except_osv(_('Error'), _('No credit control lines selected.'))
+
+ line_ids = [l.id for l in form.line_ids]
+
+ filtered_ids = self._filter_line_ids(cr, uid, line_ids, context)
+ if not filtered_ids:
+ raise except_osv(_('Information'),
+ _('No lines will be changed. All the selected lines are already done.'))
+
+ self._mark_lines(cr, uid, filtered_ids, form.name, context)
+
+ return {'domain': unicode([('id', 'in', filtered_ids)]),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'view_id': False,
+ 'res_model': 'credit.control.line',
+ 'type': 'ir.actions.act_window'}
+
diff --git a/account_credit_control/wizard/credit_control_marker_view.xml b/account_credit_control/wizard/credit_control_marker_view.xml
new file mode 100644
index 000000000..b8de161ae
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_marker_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ credit.line.marker.form
+ credit.control.marker
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Change Lines' State
+ credit.control.marker
+ credit.control.line
+ form
+ form
+
+ new
+ Change the state of the selected lines.
+
+
+
+
diff --git a/account_credit_control/wizard/credit_control_printer.py b/account_credit_control/wizard/credit_control_printer.py
new file mode 100644
index 000000000..9ff1ad0b3
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_printer.py
@@ -0,0 +1,89 @@
+# -*- 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 .
+#
+##############################################################################
+import base64
+
+from openerp.osv.orm import TransientModel, fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+
+class CreditControlPrinter(TransientModel):
+ """Print lines"""
+
+ _name = "credit.control.printer"
+ _rec_name = 'id'
+ _description = 'Mass printer'
+
+ def _get_line_ids(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ res = False
+ if (context.get('active_model') == 'credit.control.line' and
+ context.get('active_ids')):
+ res = context['active_ids']
+ return res
+
+ _columns = {
+ 'mark_as_sent': fields.boolean('Mark letter lines as sent',
+ help="Only letter lines will be marked."),
+ 'report_file': fields.binary('Generated Report', readonly=True),
+ 'state': fields.char('state', size=32),
+ 'line_ids': fields.many2many(
+ 'credit.control.line',
+ string='Credit Control Lines'),
+ }
+
+ _defaults = {
+ 'mark_as_sent': True,
+ 'line_ids': _get_line_ids,
+ }
+
+ def _filter_line_ids(self, cr, uid, active_ids, context=None):
+ """filter lines to use in the wizard"""
+ line_obj = self.pool.get('credit.control.line')
+ domain = [('state', '=', 'to_be_sent'),
+ ('id', 'in', active_ids),
+ ('channel', '=', 'letter')]
+ return line_obj.search(cr, uid, domain, context=context)
+
+ 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"
+ comm_obj = self.pool.get('credit.control.communication')
+ if isinstance(wiz_id, list):
+ wiz_id = wiz_id[0]
+ form = self.browse(cr, uid, wiz_id, context)
+
+ if not form.line_ids and not form.print_all:
+ 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)
+ 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
+
diff --git a/account_credit_control/wizard/credit_control_printer_view.xml b/account_credit_control/wizard/credit_control_printer_view.xml
new file mode 100644
index 000000000..f46128fe3
--- /dev/null
+++ b/account_credit_control/wizard/credit_control_printer_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ credit.line.printer.form
+ credit.control.printer
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Print Lines
+ credit.control.printer
+ credit.control.line
+ form
+ form
+
+ new
+ Print selected lines
+
+
+
+