[MERGE]: Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2

bzr revid: sbh@tinyerp.com-20100827070421-9w9xu4hg4sreptpm
This commit is contained in:
sbh (Open ERP)
2010-08-27 12:34:21 +05:30
13 changed files with 103 additions and 116 deletions
+17 -11
View File
@@ -123,7 +123,7 @@ class email_template(osv.osv):
_columns = {
'name' : fields.char('Name', size=100, required=True),
'object_name':fields.many2one('ir.model', 'Model'),
'object_name':fields.many2one('ir.model', 'Resource'),
'model_int_name':fields.char('Model Internal Name', size=200,),
'from_account':fields.many2one(
'email_template.account',
@@ -132,7 +132,7 @@ class email_template(osv.osv):
'def_to':fields.char(
'Recipient (To)',
size=250,
help="The default recipient of email."
help="The Recipient of email. "
"Placeholders can be used here."),
'def_cc':fields.char(
'CC',
@@ -151,12 +151,12 @@ class email_template(osv.osv):
" Placeholders can be used here."),
'message_id':fields.char('Message-ID',
size=250,
help="The Message-ID header value, if you need to"
"specify it, for example to automatically recognize the replies later."
" Placeholders can be used here."),
'track_campaign_item':fields.boolean('Track campaign items',
help="Enable this if you want the outgoing e-mails to include a tracking"
" marker that makes it possible to identify the replies an link them back to the campaign item"),
help="Specify the Message-ID SMTP header to use in outgoing emails. Please note that this overrides the Resource tracking option! Placeholders can be used here."),
'track_campaign_item':fields.boolean('Resource Tracking',
help="Enable this is you wish to include a special \
tracking marker in outgoing emails so you can identify replies and link \
them back to the corresponding resource record. \
This is useful for CRM leads for example"),
'lang':fields.char(
'Language',
size=250,
@@ -164,9 +164,9 @@ class email_template(osv.osv):
" Placeholders can be used here. "
"eg. ${object.partner_id.lang}"),
'def_subject':fields.char(
'Default Subject',
'Subject',
size=200,
help="The default subject of email."
help="The subject of email."
" Placeholders can be used here.",
translate=True),
'def_body_text':fields.text(
@@ -201,10 +201,12 @@ class email_template(osv.osv):
'ref_ir_act_window':fields.many2one(
'ir.actions.act_window',
'Window Action',
help="Action that will open this email template on Resource records",
readonly=True),
'ref_ir_value':fields.many2one(
'ir.values',
'Wizard Button',
help="Button in the side bar of the form view of this Resource that will invoke the Window Action",
readonly=True),
'allowed_groups':fields.many2many(
'res.groups',
@@ -636,9 +638,13 @@ class email_template(osv.osv):
'mail_type':'multipart/alternative',
}
if template['message_id']:
# use provided message_id with placeholders
mailbox_values.update({'message_id': get_value(cursor, user, record_id, template['message_id'], template, context)})
if template['track_campaign_item']:
# get appropriate message-id
mailbox_values.update(message_id=tools.misc.generate_tracking_message_id(record_id))
mailbox_values.update({'message_id': tools.misc.generate_tracking_message_id(record_id)})
if not mailbox_values['account_id']:
raise Exception("Unable to send the mail. No account linked to the template.")
@@ -80,7 +80,12 @@ class email_template_account(osv.osv):
'name': fields.char('Description',
size=64, required=True,
readonly=True, select=True,
help="The description is used as the Sender name along with the provided From Email, \
unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
states={'draft':[('readonly', False)]}),
'auto_delete': fields.boolean('Auto Delete', size=64, readonly=True,
help="Permanently delete emails after sending",
states={'draft':[('readonly', False)]}),
'user':fields.many2one('res.users',
'Related User', required=True,
readonly=True, states={'draft':[('readonly', False)]}),
@@ -189,25 +194,7 @@ class email_template_account(osv.osv):
'Error: You are not allowed to have more than 1 account.',
[])
]
def on_change_emailid(self, cursor, user, ids, name=None, email_id=None, context=None):
"""
Called when the email ID field changes.
UI enhancement
Writes the same email value to the smtpusername
and incoming username
"""
#TODO: Check and remove the write. Is it needed?
self.write(cursor, user, ids, {'state':'draft'}, context=context)
return {
'value': {
'state': 'draft',
'smtpuname':email_id,
'isuser':email_id
}
}
def get_outgoing_server(self, cursor, user, ids, context=None):
"""
Returns the Out Going Connection (SMTP) object
@@ -18,16 +18,17 @@
<notebook colspan="4">
<page string="Outgoing">
<separator string="Server Information" colspan="4" />
<group colspan="4">
<field name="smtpserver" select="1" colspan="2" />
<field name="smtpport" select="2" colspan="2" />
<field name="smtpssl" select="2" colspan="2" />
<field name="smtptls" select="2" colspan="2" />
<group colspan="4" col="4">
<field name="smtpserver" select="1"/>
<field name="smtpport" select="2" />
<field name="smtpssl" select="2" />
<field name="smtptls" select="2" />
<field name="auto_delete" />
</group>
<button name="check_outgoing_connection" type="object" string="Test Outgoing Connection" />
<separator string="User Information" colspan="4" />
<group col="2" colspan="2">
<field name="email_id" select="1" on_change="on_change_emailid(name,email_id)" colspan="2" />
<field name="email_id" select="1" colspan="2" />
<field name="smtppass" password="True" colspan="2" />
<field name="company" select="2" colspan="2" />
</group>
@@ -72,15 +73,16 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Accounts">
<filter icon="terp-personal" string="My Accounts" name="my" domain="[('user','=',uid)]"/>
<filter icon="terp-personal+" string="Personal Accounts" domain="[('company','=','no')]"/>
<filter icon="terp-go-home" string="Company Accounts" domain="[('company','=','yes')]"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new" string="Draft" name="draft" domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test" string="Approved" domain="[('state','=','approved')]"/>
<filter icon="terp-emblem-important" string="Suspended" domain="[('state','=','suspended')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-home" string="Company Accounts" domain="[('company','=','yes')]"/>
<separator orientation="vertical"/>
<field name="user" select="1">
<filter icon="terp-personal" help="My Accounts" name="my" domain="[('user','=',uid)]"/>
</field>
<field name="name" select="1"/>
<field name="user" select="1"/>
<field name="email_id" select="1"/>
</search>
</field>
@@ -99,7 +101,7 @@
<menuitem name="Configuration" parent="base.marketing_menu"
id="base.menu_marketing_config_root" sequence="20" groups="base.group_system"/>
<menuitem name="Emails" id="menu_email_template_configuration" parent="base.menu_marketing_config_root" />
<menuitem name="Email Template" id="menu_email_template_configuration" parent="base.menu_marketing_config_root" />
<menuitem name="Email Accounts" id="menu_email_template_account_all" parent="menu_email_template_configuration" action="action_email_template_account_tree_all"/>
@@ -110,7 +112,7 @@
<menuitem name="Configuration" parent="base.menu_tools"
id="base.menu_lunch_survey_root" sequence="20" />
<menuitem name="Emails" id="menu_email_template_config_tools"
<menuitem name="Email Template" id="menu_email_template_config_tools"
parent="base.menu_lunch_survey_root" />
<menuitem name="Email Accounts" id="menu_email_account_all_tools"
@@ -63,6 +63,7 @@ class email_template_mailbox(osv.osv):
def send_this_mail(self, cr, uid, ids=None, context=None):
result = True
attachment_pool = self.pool.get('ir.attachment')
for id in (ids or []):
try:
account_obj = self.pool.get('email_template.account')
@@ -70,7 +71,7 @@ class email_template_mailbox(osv.osv):
payload = {}
if values['attachments_ids']:
for attid in values['attachments_ids']:
attachment = self.pool.get('ir.attachment').browse(cr, uid, attid, context)#,['datas_fname','datas'])
attachment = attachment_pool.browse(cr, uid, attid, context)#,['datas_fname','datas'])
payload[attachment.datas_fname] = attachment.datas
result = account_obj.send_mail(cr, uid,
[values['account_id'][0]],
@@ -84,8 +85,15 @@ class email_template_mailbox(osv.osv):
message_id=values['message_id'],
context=context)
if result == True:
self.write(cr, uid, id, {'folder':'sent', 'state':'na', 'date_mail':time.strftime("%Y-%m-%d %H:%M:%S")}, context)
self.historise(cr, uid, [id], "Email sent successfully", context)
account = account_obj.browse(cr, uid, values['account_id'][0], context=context)
if account.auto_delete:
self.write(cr, uid, id, {'folder': 'trash'}, context=context)
self.unlink(cr, uid, [id], context=context)
# Remove attachments for this mail
attachment_pool.unlink(cr, uid, values['attachments_ids'], context=context)
else:
self.write(cr, uid, id, {'folder':'sent', 'state':'na', 'date_mail':time.strftime("%Y-%m-%d %H:%M:%S")}, context)
self.historise(cr, uid, [id], "Email sent successfully", context)
else:
error = result['error_msg']
self.historise(cr, uid, [id], error, context)
@@ -100,7 +108,7 @@ class email_template_mailbox(osv.osv):
def historise(self, cr, uid, ids, message='', context=None):
for id in ids:
history = self.read(cr, uid, id, ['history'], context).get('history', '')
self.write(cr, uid, id, {'history':history or '' + "\n" + time.strftime("%Y-%m-%d %H:%M:%S") + ": " + tools.ustr(message)}, context)
self.write(cr, uid, id, {'history': (history or '' )+ "\n" + time.strftime("%Y-%m-%d %H:%M:%S") + ": " + tools.ustr(message)}, context)
_columns = {
'email_from':fields.char(
+31 -24
View File
@@ -68,25 +68,26 @@
<field name="reply_to"/>
</group>
<group col="2" colspan="2">
<separator string="Email Data" colspan="2"/>
<field name="def_subject" colspan="4" required="1" />
<field name="use_sign" colspan="4" />
<separator string="Options" colspan="2"/>
<field name="lang" colspan="4" />
<field name="use_sign" colspan="4" />
<field name="track_campaign_item" colspan="4"/>
</group>
<separator colspan="3" string="Standard Body" />
<separator colspan="1" string="Expression Builder" />
<notebook>
<page string="Body (Text)">
<field name="def_body_text" colspan="4" nolabel="1" />
</page>
<page string="Body (Raw HTML)">
<field name="def_body_html" colspan="4" nolabel="1" />
<label string="Note: This is Raw HTML." colspan="4" />
</page>
</notebook>
<group col="4">
<group col="2" colspan="2">
<separator colspan="2" string="Email Content " />
<field name="def_subject" colspan="4" required="1" />
<notebook>
<page string="Body (Text)">
<field name="def_body_text" colspan="4" nolabel="1" />
</page>
<page string="Body (Raw HTML)">
<field name="def_body_html" colspan="4" nolabel="1" />
<label string="Note: This is Raw HTML." colspan="4" />
</page>
</notebook>
</group>
<group col="4" colspan="2">
<separator colspan="4" string="Expression Builder" />
<field name="template_language"
on_change="onchange_null_value(model_object_field,sub_model_object_field,null_value,template_language,context)" />
<notebook>
@@ -113,17 +114,23 @@
</page>
<page string="Advanced">
<group colspan="2" col="2">
<separator string="Actions" colspan="2"/>
<button name="create_action" string="Create Action" type="object" colspan="2" attrs="{'invisible':[('ref_ir_act_window','!=',False), ('ref_ir_value','!=',False)]}"/>
<field name="ref_ir_act_window"/>
<field name="ref_ir_value"/>
<button name="delete_action" string="Delete Action" type="object" colspan="2" attrs="{'invisible':[('ref_ir_act_window','=',False), ('ref_ir_value','=',False)]}"/>
<group colspan="2" col="2">
<separator string="Actions" colspan="2"/>
<button name="create_action" string="Create Action" type="object" colspan="2" attrs="{'invisible':[('ref_ir_act_window','!=',False), ('ref_ir_value','!=',False)]}"/>
<field name="ref_ir_act_window"/>
<field name="ref_ir_value"/>
<button name="delete_action" string="Delete Action" type="object" colspan="2" attrs="{'invisible':[('ref_ir_act_window','=',False), ('ref_ir_value','=',False)]}"/>
</group>
<group colspan="2" col="2">
<separator string="Advanced Options" colspan="2"/>
<field name="message_id"/>
</group>
</group>
<group colspan="2" col="2">
<separator string="Attachments" colspan="2"/>
<notebook>
<page string="Existing files">
<field name="attachment_ids" colspan="4" nolabel="1"/>
<field name="attachment_ids" colspan="4" nolabel="1" height="350"/>
</page>
<page string="Report">
<field name="file_name" colspan="4" />
@@ -184,11 +191,11 @@
<field name="search_view_id" ref="view_email_template_search"/>
</record>
<menuitem name="E-MAIL Templates" id="menu_email_template_all"
<menuitem name="Email Templates" id="menu_email_template_all"
parent="menu_email_template_configuration" action="action_email_template_tree_all" />
<!-- Email Template menu in Tools -->
<menuitem name="E-MAIL Templates" id="menu_email_template_all_tools"
<menuitem name="Email Templates" id="menu_email_template_all_tools"
parent="menu_email_template_config_tools" action="action_email_template_tree_all" />
</data>
</openerp>
+18 -16
View File
@@ -174,8 +174,8 @@ msgstr "Approve Account"
#. module: email_template
#: model:ir.ui.menu,name:email_template.menu_email_template_all
msgid "E-MAIL Templates"
msgstr "E-MAIL Templates"
msgid "Email Templates"
msgstr "Email Templates"
#. module: email_template
#: field:email_template.preview,rel_model_ref:0
@@ -221,8 +221,8 @@ msgstr "Download Full Mail"
#. module: email_template
#: help:email.template,def_to:0
msgid "The default recipient of email.Placeholders can be used here."
msgstr "The default recipient of email.Placeholders can be used here."
msgid "The recipient of email.Placeholders can be used here."
msgstr "The recipient of email.Placeholders can be used here."
#. module: email_template
#: view:email_template.mailbox:0
@@ -258,8 +258,8 @@ msgstr "Accounts"
#. module: email_template
#: field:email.template,track_campaign_item:0
msgid "Track campaign items"
msgstr "Track campaign items"
msgid "Resource Tracking"
msgstr "Resource Tracking"
#. module: email_template
#: view:email_template.preview:0
@@ -757,8 +757,8 @@ msgstr "Save in Drafts"
#. module: email_template
#: help:email.template,def_subject:0
msgid "The default subject of email. Placeholders can be used here."
msgstr "The default subject of email. Placeholders can be used here."
msgid "The subject of email. Placeholders can be used here."
msgstr "The subject of email. Placeholders can be used here."
#. module: email_template
#: field:email_template.account,smtptls:0
@@ -767,8 +767,8 @@ msgstr "TLS"
#. module: email_template
#: view:email_template.send.wizard:0
msgid "Add here all attachments of the current document you want to include in the e-mail."
msgstr "Add here all attachments of the current document you want to include in the e-mail."
msgid "Add here all attachments of the current document you want to include in the Email."
msgstr "Add here all attachments of the current document you want to include in the Email."
#. module: email_template
#: model:ir.model,name:email_template.model_email_template_send_wizard
@@ -781,6 +781,8 @@ msgstr "This is the wizard for sending mail"
#: code:addons/email_template/email_template_mailbox.py:0
#: code:addons/email_template/wizard/email_template_send_wizard.py:0
#: model:ir.ui.menu,name:email_template.menu_email_template
#: model:ir.ui.menu,name:email_template.menu_email_template_config_tools
#: model:ir.ui.menu,name:email_template.menu_email_template_configuration
#, python-format
msgid "Email Template"
msgstr "Email Template"
@@ -1018,8 +1020,8 @@ msgstr "Password"
#: help:email.template,message_id:0
#: help:email_template.preview,message_id:0
#: help:email_template.send.wizard,message_id:0
msgid "The Message-ID header value, if you need tospecify it, for example to automatically recognize the replies later. Placeholders can be used here."
msgstr "The Message-ID header value, if you need tospecify it, for example to automatically recognize the replies later. Placeholders can be used here."
msgid "Specify the Message-ID SMTP header to use in outgoing emails. Please note that this overrides the Resource tracking option! Placeholders can be used here."
msgstr "Specify the Message-ID SMTP header to use in outgoing emails. Please note that this overrides the Resource tracking option! Placeholders can be used here."
#. module: email_template
#: model:ir.ui.menu,name:email_template.menu_email_template_configuration
@@ -1120,8 +1122,8 @@ msgstr "Emails will be sent from this approved account."
#. module: email_template
#: field:email.template,def_subject:0
msgid "Default Subject"
msgstr "Default Subject"
msgid "Subject"
msgstr "Subject"
#. module: email_template
#: help:email.template,def_bcc:0
@@ -1172,8 +1174,8 @@ msgstr "Has Attachments"
#. module: email_template
#: help:email.template,track_campaign_item:0
msgid "Enable this if you want the outgoing e-mails to include a tracking marker that makes it possible to identify the replies an link them back to the campaign item"
msgstr "Enable this if you want the outgoing e-mails to include a tracking marker that makes it possible to identify the replies an link them back to the campaign item"
msgid "Enable this is you wish to include a special tracking marker in outgoing emails so you can identify replies and link them back to the corresponding resource record. This is useful for CRM leads for example"
msgstr "Enable this is you wish to include a special tracking marker in outgoing emails so you can identify replies and link them back to the corresponding resource record. This is useful for CRM leads for example"
#. module: email_template
#: code:addons/email_template/email_template.py:0
@@ -33,7 +33,7 @@
<field name="body_html" select="2" colspan="4" nolabel="1" />
</page>
<page string="Attachments">
<label string="Add here all attachments of the current document you want to include in the e-mail." colspan="4"/>
<label string="Add here all attachments of the current document you want to include in the Email." colspan="4"/>
<field name="attachment_ids" colspan="4" nolabel="1"/>
</page>
</notebook>
-3
View File
@@ -78,9 +78,6 @@
<field name="view_mode">tree,form</field>
<field name="domain">[('type','=','Project')]</field>
</record>
<record id="board_project_form" model="ir.ui.view">
<field name="name">board.project.form</field>
<field name="model">board.board</field>
-2
View File
@@ -791,8 +791,6 @@ class config_compute_remaining(osv.osv_memory):
}
config_compute_remaining()
class account_analytic_account(osv.osv):
_inherit = 'account.analytic.account'
-2
View File
@@ -254,7 +254,5 @@
<field name="project_id" ref="project_project_22"/>
<field name="name">Latest in house tests</field>
</record>
</data>
</openerp>
+2 -6
View File
@@ -565,11 +565,7 @@ Issues like bugs in a system, client complain, materials breakdown are collected
</page>
</field>
</record>
<act_window domain="[('user_id', '=', active_id),('state', '&lt;&gt;', 'cancelled'),('state', '&lt;&gt;', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned tasks" res_model="project.task" src_model="res.users" view_mode="tree,form,gantt,calendar,graph" view_type="form"/>
<act_window domain="[('user_id', '=', active_id),('date', '&gt;=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/>
<act_window domain="[('user_id', '=', active_id),('state', '&lt;&gt;', 'cancelled'),('state', '&lt;&gt;', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned tasks" res_model="project.task" src_model="res.users" view_mode="tree,form,gantt,calendar,graph" view_type="form"/>
<act_window domain="[('user_id', '=', active_id),('date', '&gt;=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/>
</data>
</openerp>
+1 -1
View File
@@ -33,7 +33,7 @@
'website': 'http://www.openerp.com',
'init_xml': [],
'update_xml': ['project_messages_view.xml'],
'demo_xml': ['project_message_data.xml'],
'demo_xml': [],
'installable': True,
'active': False,
}
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="project_message_1" model="project.message">
<field name="project_id" ref="project.project_project_23"/>
<field name="user_id" ref="base.user_root"/>
<field name="description">Follow the procedure of Configuration wizard.
- Add all required modules
- Add chat of accounts
- Create Users</field>
<field name="subject">Configuration steps</field>
</record>
</data>
</openerp>