diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2010-06-11 09:44:19 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2010-06-11 09:44:19 +0200 |
| commit | 87cbde0be2e0349bc7727e67ee064dfe121e8917 (patch) | |
| tree | d691732d35e502248c2a2990c645ef594c1e0504 /addons/email_template | |
| parent | 4b613caa0edd0ba1ba73acaeccb3268428f935c7 (diff) | |
[IMP] marketing campaign
bzr revid: fp@tinyerp.com-20100611074419-93biwenk8q1r68em
Diffstat (limited to 'addons/email_template')
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/__init__.py | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/__openerp__.py | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template.py | 30 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_account.py | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_account_view.xml | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_engines.py | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_mailbox.py | 4 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_mailbox_view.xml | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_scheduler_data.xml | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_view.xml | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/email_template_workflow.xml | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | addons/email_template/html2text.py | 0 |
12 files changed, 20 insertions, 14 deletions
diff --git a/addons/email_template/__init__.py b/addons/email_template/__init__.py index c959f7204da..c959f7204da 100755..100644 --- a/addons/email_template/__init__.py +++ b/addons/email_template/__init__.py diff --git a/addons/email_template/__openerp__.py b/addons/email_template/__openerp__.py index 9c5f7bb5c70..9c5f7bb5c70 100755..100644 --- a/addons/email_template/__openerp__.py +++ b/addons/email_template/__openerp__.py diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 1cef7aac6e3..2d34a095ff5 100755..100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -17,10 +17,10 @@ try: TEMPLATE_ENGINES.append(('mako', 'Mako Templates')) except: LOGGER.notifyChannel( - _("Email Template"), - netsvc.LOG_ERROR, - _("Mako templates not installed") - ) + _("Email Template"), + netsvc.LOG_WARNING, + _("Mako templates not installed") + ) try: from django.template import Context, Template as DjangoTemplate #Workaround for bug: @@ -31,10 +31,10 @@ try: TEMPLATE_ENGINES.append(('django', 'Django Template')) except: LOGGER.notifyChannel( - _("Email Template"), - netsvc.LOG_ERROR, - _("Django templates not installed") - ) + _("Email Template"), + netsvc.LOG_WARNING, + _("Django templates not installed") + ) import email_template_engines import tools @@ -468,7 +468,7 @@ class email_template(osv.osv): context) return True - def generate_mailbox_item_from_template(self, + def _generate_mailbox_item_from_template(self, cursor, user, template, @@ -559,6 +559,8 @@ class email_template(osv.osv): 'folder':'drafts', 'mail_type':'multipart/alternative' } + if not mailbox_values['account_id']: + raise Exception("Unable to send the mail. No account linked to the template.") #Use signatures if allowed if template.use_sign: sign = self.pool.get('res.users').read(cursor, @@ -570,13 +572,17 @@ class email_template(osv.osv): mailbox_values['body_text'] += sign if mailbox_values['body_html']: mailbox_values['body_html'] += sign + print 'Creating', mailbox_values mailbox_id = self.pool.get('email_template.mailbox').create( cursor, user, mailbox_values, context) + + print 'Sending', mailbox_id + self.pool.get('email_template.mailbox').send_this_mail(cursor, user, [mailbox_id], context) return mailbox_id - + def generate_mail(self, cursor, user, @@ -588,6 +594,7 @@ class email_template(osv.osv): template = self.browse(cursor, user, template_id, context=context) if not template: raise Exception("The requested template could not be loaded") + print 'loaded', record_ids for record_id in record_ids: mailbox_id = self._generate_mailbox_item_from_template( cursor, @@ -595,6 +602,7 @@ class email_template(osv.osv): template, record_id, context) + print 'loaded' mail = self.pool.get('email_template.mailbox').browse( cursor, user, @@ -616,7 +624,7 @@ class email_template(osv.osv): mailbox_id, {'folder':'outbox'}, context=context - ) + ) return True email_template() diff --git a/addons/email_template/email_template_account.py b/addons/email_template/email_template_account.py index 0bcf3c3d099..0bcf3c3d099 100755..100644 --- a/addons/email_template/email_template_account.py +++ b/addons/email_template/email_template_account.py diff --git a/addons/email_template/email_template_account_view.xml b/addons/email_template/email_template_account_view.xml index 7a0bc84538f..7a0bc84538f 100755..100644 --- a/addons/email_template/email_template_account_view.xml +++ b/addons/email_template/email_template_account_view.xml diff --git a/addons/email_template/email_template_engines.py b/addons/email_template/email_template_engines.py index 2fc58310e9b..2fc58310e9b 100755..100644 --- a/addons/email_template/email_template_engines.py +++ b/addons/email_template/email_template_engines.py diff --git a/addons/email_template/email_template_mailbox.py b/addons/email_template/email_template_mailbox.py index 45eef77729e..fe9ca334d21 100755..100644 --- a/addons/email_template/email_template_mailbox.py +++ b/addons/email_template/email_template_mailbox.py @@ -41,9 +41,7 @@ class email_template_mailbox(osv.osv): return True def send_this_mail(self, cr, uid, ids=None, context=None): - if ids is None: - ids = [] - for id in ids: + for id in (ids or []): try: account_obj = self.pool.get('email_template.account') values = self.read(cr, uid, id, [], context) diff --git a/addons/email_template/email_template_mailbox_view.xml b/addons/email_template/email_template_mailbox_view.xml index c521320bf3a..c521320bf3a 100755..100644 --- a/addons/email_template/email_template_mailbox_view.xml +++ b/addons/email_template/email_template_mailbox_view.xml diff --git a/addons/email_template/email_template_scheduler_data.xml b/addons/email_template/email_template_scheduler_data.xml index 30d69f99398..30d69f99398 100755..100644 --- a/addons/email_template/email_template_scheduler_data.xml +++ b/addons/email_template/email_template_scheduler_data.xml diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml index 5158d7a5544..5158d7a5544 100755..100644 --- a/addons/email_template/email_template_view.xml +++ b/addons/email_template/email_template_view.xml diff --git a/addons/email_template/email_template_workflow.xml b/addons/email_template/email_template_workflow.xml index 4d3176f0ae0..4d3176f0ae0 100755..100644 --- a/addons/email_template/email_template_workflow.xml +++ b/addons/email_template/email_template_workflow.xml diff --git a/addons/email_template/html2text.py b/addons/email_template/html2text.py index f8be00adf0f..f8be00adf0f 100755..100644 --- a/addons/email_template/html2text.py +++ b/addons/email_template/html2text.py |
