diff --git a/addons/account/data/payment_receipt_data.xml b/addons/account/data/payment_receipt_data.xml index d3c02413732..e05a711ece0 100644 --- a/addons/account/data/payment_receipt_data.xml +++ b/addons/account/data/payment_receipt_data.xml @@ -4,24 +4,32 @@ - Payment Receipt - Send by Email + Payment Receipt: Send by email + ${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' }) ${object.partner_id.id} - - + +
+

+ Dear ${object.partner_id.name}

+ Thank you for your payment. + Here is your payment receipt ${(object.name or '').replace('/','-')} amounting + to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}. +

+ Do not hesitate to contact us if you have any question. +

+ Best regards,
+ % if user and user.signature: + ${user.signature | safe} + % endif +

+
+
${(object.name or '').replace('/','-')} ${object.partner_id.lang} - -

Dear ${object.partner_id.name},

-

Thank you for your payment.
Here is your payment receipt ${(object.name or '').replace('/','-')} amounting to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}.

-

If you have any questions, please do not hesitate to contact us.

-

Best regards, -% if user and user.signature: -${user.signature | safe} -% endif -

-
+ +
diff --git a/addons/auth_signup/data/auth_signup_data.xml b/addons/auth_signup/data/auth_signup_data.xml index 32bde965ba0..bf5dc18e9be 100644 --- a/addons/auth_signup/data/auth_signup_data.xml +++ b/addons/auth_signup/data/auth_signup_data.xml @@ -1,40 +1,96 @@ - Auth Signup: Reset Password - ]]> - ${object.email|safe} Password reset - - - - - + ${('"%s" <%s>' % (object.company_id.name, object.company_id.email or user.email))|safe} + ${object.email_formatted | safe} + +
- ${user.company_id.name} -
+ + +
+ + + + + + + + + + + + + + + +
+ + + +
+ Your Account
+ + ${object.name} + +
+ ${object.company_id.name} +
+
+
+
+ + + +
+
+ Dear ${object.name},

+ A password reset was requested for the Odoo account linked to this email. + You may change your password by following this link which will remain valid during 24 hours:
+ + If you do not expect this, you can safely ignore this email.

+ Thanks,
+ ${user.signature | safe}
+
+
+
+
+
+ + + +
+ ${object.company_id.name} +
+ ${object.company_id.phone} + % if object.company_id.email + | ${object.company_id.email} + % endif + % if object.company_id.website + | + ${object.company_id.website} + + % endif +
+
+
+ +
+ Powered by Odoo +
- -
-

Dear ${object.name},

-

A password reset was requested for the Odoo account linked to this email.

-

You may change your password by following this link which will remain valid during 24 hours:

- -

If you do not expect this, you can safely ignore this email.

-

Best regards,

-
-
- ${user.signature | safe} -

- Sent by ${user.company_id.name} using Odoo -

-
]]> +
+
+
@@ -42,93 +98,96 @@ Auth Signup: Odoo Connection - "${object.company_id.name|safe}" <${object.company_id.email or user.email|safe}> - "${object.name}" <${object.email|safe}> ${object.create_uid.name} from ${object.company_id.name} invites you to connect to Odoo + "${object.company_id.name|safe}" <${object.company_id.email or user.email|safe}> + ${object.email_formatted | safe} - - - - +
- - - - - - - - - -
- - - - - - - - -
- - Welcome to Odoo! - - - -
-
-
-
- - - - -
-
- Dear ${object.name}, -
-
- You have been invited by ${object.create_uid.name} of ${object.company_id.name} to connect on Odoo. -
-
- Accept invitation -
-
- % set website_url = object.env['ir.config_parameter'].sudo().get_param('web.base.url') - Your Odoo domain is:
- ${website_url} -
-
- Your sign in email is:
- ${object.email} -
-
-
- Never heard of Odoo? It’s a all-in-one business software loved by 3+ million users. It will considerably improve your experience at work and increase your productivity. -
-
- Have a look at the Odoo Tour to discover the tool. -
-
- Enjoy Odoo! -
-
- --
The ${object.company_id.name} Team -
-
-
-
+ +
+ + + + + + + + + + + + +
- - - - +
- Powered by Odoo -
+ +
+ Welcome to Odoo
+ + ${object.name} + +
+ ${object.company_id.name} +
+
+
+ + + +
+
+ Dear ${object.name},

+ You have been invited by ${object.create_uid.name} of ${object.company_id.name} to connect on Odoo. + + % set website_url = object.env['ir.config_parameter'].sudo().get_param('web.base.url') + Your Odoo domain is: ${website_url}
+ Your sign in email is: ${object.email}

+ Never heard of Odoo? It’s a all-in-one business software loved by 3+ million users. It will considerably improve your experience at work and increase your productivity. +

+ Have a look at the Odoo Tour to discover the tool. +

+ Enjoy Odoo!
+ --
The ${object.company_id.name} Team +
+
+
+
+
+ + + +
+ ${object.company_id.name} +
+ ${object.company_id.phone} + % if object.company_id.email + | ${object.company_id.email} + % endif + % if object.company_id.website + | + ${object.company_id.website} + + % endif +
+
+
+ + +
+ Powered by Odoo +
+
+
@@ -136,42 +195,91 @@ Auth Signup: Odoo Account Created - "${object.company_id.name|safe}" <${(object.company_id.email or user.email)|safe}> - ${object.email|safe} Welcome to ${object.company_id.name}! + "${object.company_id.name|safe}" <${(object.company_id.email or user.email)|safe}> + ${object.email_formatted | safe} -
- - - - +
- ${user.company_id.name} -
+ + +
+ + + + + + + + + + + + + + + +
+ + + +
+ Your Account
+ + ${object.name} + +
+ ${object.company_id.name} +
+
+
+
+ + + +
+
+ Dear ${object.name},

+ Your account has been successfully created!
+ Your login is ${object.email}
+ To gain access to your account, you can use the following link: + + Thanks,

+ ${user.signature | safe}
+
+
+
+
+
+ + + +
+ ${object.company_id.name} +
+ ${object.company_id.phone} + % if object.company_id.email + | ${object.company_id.email} + % endif + % if object.company_id.website + | + ${object.company_id.website} + + % endif +
+
+
+ +
+ Powered by Odoo +
- -
-

Dear ${object.name},

-

- Your account has been successfully created! -

-

- Your login: ${object.email} -
-

-

- To gain access to your account, you can use the following link: -

- -

Best regards,

-
-
- ${user.signature | safe} -

- Sent by ${user.company_id.name} using Odoo -

-
+
+ diff --git a/addons/calendar/__manifest__.py b/addons/calendar/__manifest__.py index 47707a492de..0d623bfe651 100644 --- a/addons/calendar/__manifest__.py +++ b/addons/calendar/__manifest__.py @@ -28,6 +28,7 @@ If you need to manage your meetings, you should install the CRM module. 'security/calendar_security.xml', 'data/calendar_cron.xml', 'data/calendar_data.xml', + 'data/mail_data.xml', 'views/mail_activity_views.xml', 'views/calendar_templates.xml', 'views/calendar_views.xml', diff --git a/addons/calendar/data/calendar_data.xml b/addons/calendar/data/calendar_data.xml index 8f4a4774f0e..29083593e32 100644 --- a/addons/calendar/data/calendar_data.xml +++ b/addons/calendar/data/calendar_data.xml @@ -1,8 +1,6 @@ - - Invitation calendar.event @@ -51,280 +49,5 @@ hours email - - - Calendar: Meeting Invitation - ${object.event_id.user_id.email or ''} - ${object.event_id.name} invitation - - ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} - ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } - - -% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} - - - - - -
- ${user.company_id.name} - -

- Accept - Decline - View -

-
- - - - -
-
-
-
-
-
-
- - - - -
-

Invitation to ${object.event_id.name}

-

- Dear ${object.common_name},
- ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.

- - - -
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
-
- -

Details of the event

-
    - % if object.event_id.location: -
  • Location: ${object.event_id.location} - (View Map) -
  • - % endif - % if object.event_id.description : -
  • Description: ${object.event_id.description}
  • - % endif - % if not object.event_id.allday and object.event_id.duration -
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • - % endif -
  • Attendees -
      - % for attendee in object.event_id.attendee_ids: -
    • -
      - % if attendee.common_name != object.common_name: - ${attendee.common_name} - % else: - You - % endif -
    • - % endfor -
  • -
-
-
-
]]>
-
- - - Calendar: Date updated - ${object.event_id.user_id.email or ''} - ${object.event_id.name}: Date updated - - ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} - ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } - - -% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} - - - - - -
- ${user.company_id.name} - -

- Accept - Decline - View -

-
- - - - -
-
-
-
-
- -
- - - - -
-

${object.event_id.name} date updated

-

- Dear ${object.common_name},
- The date of the meeting has been upated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}. -

- - - -
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
-
- -

Details of the event

-
    - % if object.event_id.location: -
  • Location: ${object.event_id.location} - (View Map) -
  • - % endif - % if object.event_id.description : -
  • Description: ${object.event_id.description}
  • - % endif - % if not object.event_id.allday and object.event_id.duration -
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • - % endif -
  • Attendees -
      - % for attendee in object.event_id.attendee_ids: -
    • -
      - % if attendee.common_name != object.common_name: - ${attendee.common_name} - % else: - You - % endif -
    • - % endfor -
  • -
-
-
-
]]>
-
- - - Calendar: Reminder - ${object.event_id.user_id.email or ''} - ${object.event_id.name} - Reminder - - ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} - ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } - - -% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} - - - - - -
- ${user.company_id.name} - -

- Accept - Decline - View -

-
- - - - -
-
-
-
-
- -
- - - - -
-

Reminder for ${object.event_id.name}

-

- Dear ${object.common_name},
- This is a reminder for the below event : -

- - - -
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} -
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
-
- -

Details of the event

-
    - % if object.event_id.location: -
  • Location: ${object.event_id.location} - (View Map) -
  • - % endif - % if object.event_id.description : -
  • Description: ${object.event_id.description}
  • - % endif - % if not object.event_id.allday and object.event_id.duration -
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • - % endif -
  • Attendees -
      - % for attendee in object.event_id.attendee_ids: -
    • -
      - % if attendee.common_name != object.common_name: - ${attendee.common_name} - % else: - You - % endif -
    • - % endfor -
  • -
-
-
-
]]>
-
-
+ \ No newline at end of file diff --git a/addons/calendar/data/mail_data.xml b/addons/calendar/data/mail_data.xml new file mode 100644 index 00000000000..a4e2fa46907 --- /dev/null +++ b/addons/calendar/data/mail_data.xml @@ -0,0 +1,253 @@ + + + + + Calendar: Meeting Invitation + + Invitation to ${object.event_id.name} + ${object.event_id.user_id.email or ''} + ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} + ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } + +
+ % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} +

+ Hello ${object.common_name},

+ ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}. +

+ + + + +
+
+ ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''} +
+
+ +

Details of the event

+
    + % if object.event_id.location: +
  • Location: ${object.event_id.location} + (View Map) +
  • + % endif + % if object.event_id.description : +
  • Description: ${object.event_id.description}
  • + % endif + % if not object.event_id.allday and object.event_id.duration +
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • + % endif +
  • Attendees +
      + % for attendee in object.event_id.attendee_ids: +
    • +
      + % if attendee.common_name != object.common_name: + ${attendee.common_name} + % else: + You + % endif +
    • + % endfor +
  • +
+
+
+ Thank you, +
+ % if object.event_id.user_id and object.event_id.user_id.signature: + ${object.event_id.user_id.signature | safe} + % endif +
+
+ + +
+ + + Calendar: Date updated + + ${object.event_id.name}: Date updated + ${object.event_id.user_id.email or ''} + ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} + ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } + +
+ % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} +

+ Hello ${object.common_name},

+ The date of the meeting has been updated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}. +

+ + + + +
+
+ ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''} +
+
+ +

Details of the event

+
    + % if object.event_id.location: +
  • Location: ${object.event_id.location} + (View Map) +
  • + % endif + % if object.event_id.description : +
  • Description: ${object.event_id.description}
  • + % endif + % if not object.event_id.allday and object.event_id.duration +
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • + % endif +
  • Attendees +
      + % for attendee in object.event_id.attendee_ids: +
    • +
      + % if attendee.common_name != object.common_name: + ${attendee.common_name} + % else: + You + % endif +
    • + % endfor +
  • +
+
+
+ Thank you, +
+ % if object.event_id.user_id and object.event_id.user_id.signature: + ${object.event_id.user_id.signature | safe} + % endif +
+
+ + +
+ + + Calendar: Reminder + + ${object.event_id.name} - Reminder + ${object.event_id.user_id.email or ''} + ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)} + ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False } + +
+ % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} +

+ Hello ${object.common_name},

+ This is a reminder for the below event : +

+ + + + +
+
+ ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)} +
+
+ ${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''} +
+
+ +

Details of the event

+
    + % if object.event_id.location: +
  • Location: ${object.event_id.location} + (View Map) +
  • + % endif + % if object.event_id.description : +
  • Description: ${object.event_id.description}
  • + % endif + % if not object.event_id.allday and object.event_id.duration +
  • Duration: ${('%dH%02d' % (object.event_id.duration,(object.event_id.duration*60)%60))}
  • + % endif +
  • Attendees +
      + % for attendee in object.event_id.attendee_ids: +
    • +
      + % if attendee.common_name != object.common_name: + ${attendee.common_name} + % else: + You + % endif +
    • + % endfor +
  • +
+
+
+ Thank you, +
+ % if object.event_id.user_id and object.event_id.user_id.signature: + ${object.event_id.user_id.signature | safe} + % endif +
+
+ + +
+
+
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 8deecf4d657..26db5ff6cbe 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -111,7 +111,7 @@ class Attendee(models.Model): _name = 'calendar.attendee' _rec_name = 'common_name' - _description = 'Attendee information' + _description = 'Calendar Registration' def _default_access_token(self): return uuid.uuid4().hex @@ -195,7 +195,7 @@ class Attendee(models.Model): if attendee.email or attendee.partner_id.email: # FIXME: is ics_file text or bytes? ics_file = ics_files.get(attendee.event_id.id) - mail_id = invitation_template.send_mail(attendee.id) + mail_id = invitation_template.send_mail(attendee.id, notif_layout='mail.mail_notification_light') vals = {} if ics_file: diff --git a/addons/crm/data/crm_lead_data.xml b/addons/crm/data/crm_lead_data.xml index a3398a1adfc..f4e15d318b5 100644 --- a/addons/crm/data/crm_lead_data.xml +++ b/addons/crm/data/crm_lead_data.xml @@ -71,22 +71,6 @@ ${(not object.partner_id and object.email_from)|safe} - - Lead: Reminder - - - admin@example.com - ${(object.user_id != False and object.user_id.email)|safe} - Reminder: Lead ${object.name} from ${object.partner_id != False and object.partner_id.name or object.contact_name} - Hello ${object.user_id and object.user_id.name or ''},

-

The opportunity ${object.name} did not have any activity since at least 5 days.

-%if object.description: -

Here is the description about the opportunity :

${object.description} -%endif -

Thank you!

-]]>
-
diff --git a/addons/delivery/data/mail_template_data.xml b/addons/delivery/data/mail_template_data.xml index 14e566c5213..e8b6f08ebfc 100644 --- a/addons/delivery/data/mail_template_data.xml +++ b/addons/delivery/data/mail_template_data.xml @@ -1,30 +1,39 @@ - - + - Delivery: Send by Email - ${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' }) - ${object.partner_id.id} - - - ${(object.name or '').replace('/','_')} - ${object.partner_id.lang} - -

Dear ${object.partner_id.name},

-

We are glad to inform you that your order has been shipped.

-

-%if object.carrier_tracking_ref: - Your tracking reference: - %if object.carrier_tracking_url: - ${object.carrier_tracking_ref}. - %else: - ${object.carrier_tracking_ref}. - %endif -%endif -

-

Find your delivery order attached for more details.

-

Thank you,

-
+ Delivery: Send by Email + + ${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' }) + ${object.partner_id.id} + +
+

+ Hello ${object.partner_id.name},

+ We are glad to inform you that your order has been shipped. + %if object.carrier_tracking_ref: + Your tracking reference is + + %if object.carrier_tracking_url: + ${object.carrier_tracking_ref}. + %else: + ${object.carrier_tracking_ref}. + %endif + + %endif +

+ Please find your delivery order attached for more details.

+ Thank you,
+ % if user and user.signature: + ${user.signature | safe} + % endif +

+
+
+ + ${(object.name or '').replace('/','_')} + ${object.partner_id.lang} + +
-
+
diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 7eddcc52d04..ca8d41cca67 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -141,7 +141,7 @@ class StockPicking(models.Model): default_model='stock.picking', default_use_template=bool(delivery_template_id), default_template_id=delivery_template_id, - custom_layout='mail.mail_notification_borders' + custom_layout='mail.mail_notification_light' ) return { 'type': 'ir.actions.act_window', diff --git a/addons/hr/data/hr_data.xml b/addons/hr/data/hr_data.xml index 8ce5b78ec72..58afb0ede52 100644 --- a/addons/hr/data/hr_data.xml +++ b/addons/hr/data/hr_data.xml @@ -19,14 +19,42 @@ - HR: unknown employee bounce + HR: mailgateway unknown employee bounce + Your document has not been created ${user.email} ${ctx['email_to']|safe} + + + + +
+ + + + + +
+ + +
+
+ Hi,
+ Your document has not been created because your email address is not recognized. Please send emails with the email address recorded on your employee information, or contact your HR manager. +
+
+
+
+ + +
+ Powered by Odoo +
+
+
${user.lang} - - +
diff --git a/addons/hr_recruitment/data/hr_recruitment_data.xml b/addons/hr_recruitment/data/hr_recruitment_data.xml index 0a5a6fad082..786a623cd2e 100644 --- a/addons/hr_recruitment/data/hr_recruitment_data.xml +++ b/addons/hr_recruitment/data/hr_recruitment_data.xml @@ -10,397 +10,278 @@ Applicant: Refuse + Your Job Application: ${object.job_id.name | safe} ${(not object.partner_id and object.email_from or '') | safe} ${object.partner_id.id or ''} - ${object.partner_id.lang or ''} - - - - - - - - - - -
- - ${object.company_id.name} - - - % if 'website_url' in object.job_id and object.job_id.website_url: - Job Description - % endif -
- - - + +
-

- Hi, -

- Thank you for your interest in joining the - ${object.company_id.name} team. We wanted to - let you know that, although your resume is competitive, - our hiring team reviewed your application and did not - select it for further consideration. -

- Please note that recruiting is hard, and we can do - mistake. Do not hesitate to reply to this email if you - think we did a mistake, or if you want more information - about our decision. -

- We will, however, keep your resume on record and get in - touch with you about future opportunities that may be a - better fit for your skills and experience. -

-

- We wish you all the best in your job search and hope we - will have the chance to consider you for another role - in the future. -

-

- Regards, -

- -

--
+ + + + - -
+
+ Hello,

+ Thank you for your interest in joining the + ${object.company_id.name} team. We wanted to + let you know that, although your resume is competitive, + our hiring team reviewed your application and did not + select it for further consideration. +

+ Please note that recruiting is hard, and we can do + mistake. Do not hesitate to reply to this email if you + think we did a mistake, or if you want more information + about our decision. +

+ We will, however, keep your resume on record and get in + touch with you about future opportunities that may be a + better fit for your skills and experience. +

+ We wish you all the best in your job search and hope we + will have the chance to consider you for another role + in the future. +

+ Thank you, +
% if object.user_id: + --
${object.user_id.name}
Email: ${object.user_id.email or ''}
Phone: ${object.user_id.phone or ''} % else: + --
${object.company_id.name}
The HR Team % endif -

- -
- - - - - - -
-
Sent by ${object.company_id.name}
- % if 'website_url' in object.job_id and object.job_id.website_url: -
- Discover our others jobs. -
- % endif -
- - - ]]>
+ + +

+
+ + + ${object.partner_id.lang or ''}
Applicant: Interest - Your Application: ${object.job_id.name | safe} + + Your Job Application: ${object.job_id.name | safe} ${(not object.partner_id and object.email_from or '') | safe} ${object.partner_id.id or ''} - ${object.partner_id.lang or ''} - - - - - - - - - - -
- - ${object.company_id.name} - - - % if 'website_url' in object.job_id and object.job_id.website_url: - Job Description - % endif -
- - - - -
-
-

Congratulations!

-
Your resume has been positively reviewed.
- Congratulations! -
- -

- We just reviewed your resume, and it caught our - attention. As we think you might be great for the - position, your application has been short listed for a - call or an interview. -

- - % if object.user_id: -

- You will soon be contacted by: -

- - - - -
- Avatar - - ${object.user_id.name}
- Email: ${object.user_id.email or ''}
- Phone: ${object.user_id.phone or ''} -
- % endif -

- See you soon, -

- --
- Odoo HR Team -

- -
-

What is the next step?

-

- We usually answer applications within 3 days. - The next step is either a call or a meeting in our offices. -

- Feel free to contact us if you want a faster - feedback or if you don't get news from us - quickly enough (just reply to this email). -

-
- -

Want to learn about us?

-
    -
  1. Founders' story
  2. -
  3. The Odoo Culture
  4. -
  5. About us
  6. -
- -
- - % set location = '' - % if object.job_id.address_id.name: -

${object.job_id.address_id.name}

- % endif - % if object.job_id.address_id.street: -

${object.job_id.address_id.street}

- % set location = object.job_id.address_id.street - % endif - % if object.job_id.address_id.street2: -

${object.job_id.address_id.street2}

- % set location = '%s, %s' % (location, object.job_id.address_id.street2) - % endif -

- % if object.job_id.address_id.city: - ${object.job_id.address_id.city}, - % set location = '%s, %s' % (location, object.job_id.address_id.city) - % endif - % if object.job_id.address_id.state_id.name: - ${object.job_id.address_id.state_id.name}, - % set location = '%s, %s' % (location, object.job_id.address_id.state_id.name) - % endif - % if object.job_id.address_id.zip: - ${object.job_id.address_id.zip} - % set location = '%s, %s' % (location, object.job_id.address_id.zip) - % endif -

- % if object.job_id.address_id.country_id.name: -

${object.job_id.address_id.country_id.name}

- % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) - % endif - -
- - % if object.job_id.address_id: -
- - Google Maps - + + + + + +
+
+

Congratulations!

+
Your resume has been positively reviewed.
+ Congratulations!
- % endif - - - - - - -
-
Sent by ${object.company_id.name}
- % if 'website_url' in object.job_id and object.job_id.website_url: -
- Discover all our jobs. -
- % endif -
+
+ We just reviewed your resume, and it caught our + attention. As we think you might be great for the + position, your application has been short listed for a + call or an interview. +

+ % if 'website_url' in object.job_id and object.job_id.website_url: + + % endif + % if object.user_id: + You will soon be contacted by: + + + + + +
+ Avatar + + ${object.user_id.name}
+ Email: ${object.user_id.email or ''}
+ Phone: ${object.user_id.phone or ''} +
+

+ % endif + See you soon, +
+ --
+ Odoo HR Team + % if 'website_url' in object.job_id and object.job_id.website_url + Discover all our jobs.
+ % endif +
-
- ]]> +
+

What is the next step?

+ We usually answer applications within 3 days. +

+ The next step is either a call or a meeting in our offices. +
+ Feel free to contact us if you want a faster + feedback or if you don't get news from us + quickly enough (just reply to this email). +
+ +
+

Want to learn about us?

+
    +
  1. Founders' story
  2. +
  3. The Odoo Culture
  4. +
  5. About us
  6. +
+ +
+ % set location = '' + % if object.job_id.address_id.name: + ${object.job_id.address_id.name}
+ % endif + % if object.job_id.address_id.street: + ${object.job_id.address_id.street}
+ % set location = object.job_id.address_id.street + % endif + % if object.job_id.address_id.street2: + ${object.job_id.address_id.street2}
+ % set location = '%s, %s' % (location, object.job_id.address_id.street2) + % endif + % if object.job_id.address_id.city: + ${object.job_id.address_id.city}, + % set location = '%s, %s' % (location, object.job_id.address_id.city) + % endif + % if object.job_id.address_id.state_id.name: + ${object.job_id.address_id.state_id.name}, + % set location = '%s, %s' % (location, object.job_id.address_id.state_id.name) + % endif + % if object.job_id.address_id.zip: + ${object.job_id.address_id.zip} + % set location = '%s, %s' % (location, object.job_id.address_id.zip) + % endif +
+ % if object.job_id.address_id.country_id.name: + ${object.job_id.address_id.country_id.name}
+ % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) + % endif +
+ + % if object.job_id.address_id: + + + + % endif + +
+ + + ${object.partner_id.lang or ''} Applicant: Acknowledgment - Job Application Confirmation: ${object.job_id.name | safe} + + Your Job Application: ${object.job_id.name | safe} ${(not object.partner_id and object.email_from or '') | safe} ${object.partner_id.id or ''} - ${object.partner_id.lang or ''} - - - - - - - - - - -
- - ${object.company_id.name} - - - % if 'website_url' in object.job_id and object.job_id.website_url: - Job Description - % endif -
- - - + +
-

- Hi, -

- We confirm we successfully received your application to the job + + + + - -
+
+ Hello, +

+ We confirm we successfully received your application to the job + "${object.job_id.name}" at ${object.company_id.name}. +

+ We will come back to you shortly. - "${object.job_id.name}" - at ${object.company_id.name}. -

-

- We will come back to you shortly. -

+ % if 'website_url' in object.job_id and object.job_id.website_url: + + % endif -
- % if object.user_id: +
+ % if object.user_id:

Your Contact:

- - - - +
- Avatar - - ${object.user_id.name}
- Email: ${object.user_id.email or ''}
- Phone: ${object.user_id.phone or ''} -
+ + + +
+ Avatar + + ${object.user_id.name}
+ Email: ${object.user_id.email or ''}
+ Phone: ${object.user_id.phone or ''} +
- % endif +
+ % endif -
+

What is the next step?

+ We usually answer applications within 3 days.

+ Feel free to contact us if you want a faster + feedback or if you don't get news from us + quickly enough (just reply to this email). -

What is the next step?

-

We usually answer applications within 3 days.

-

- Feel free to contact us if you want a faster - feedback or if you don't get news from us - quickly enough (just reply to this email). -

-
+
+

Want to learn more?

+
    +
  1. Founders' story
  2. +
  3. The Odoo Culture
  4. +
  5. About us
  6. +
-

Want to learn more?

-
    -
  1. Founders' story
  2. -
  3. The Odoo Culture
  4. -
  5. About us
  6. -
- -
- - % set location = '' - % if object.job_id.address_id.name: -

${object.job_id.address_id.name}

- % endif - % if object.job_id.address_id.street: -

${object.job_id.address_id.street}

- % set location = object.job_id.address_id.street - % endif - % if object.job_id.address_id.street2: -

${object.job_id.address_id.street2}

- % set location = '%s, %s' % (location, object.job_id.address_id.street2) - % endif -

- % if object.job_id.address_id.city: - ${object.job_id.address_id.city}, - % set location = '%s, %s' % (location, object.job_id.address_id.city) - % endif - % if object.job_id.address_id.state_id.name: - ${object.job_id.address_id.state_id.name}, - % set location = '%s, %s' % (location, object.job_id.address_id.state_id.name) - % endif - % if object.job_id.address_id.zip: - ${object.job_id.address_id.zip} - % set location = '%s, %s' % (location, object.job_id.address_id.zip) - % endif -

- % if object.job_id.address_id.country_id.name: -

${object.job_id.address_id.country_id.name}

- % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) - % endif - -
- - % if object.job_id.address_id: -

- - Google Maps - +
+ % set location = '' + % if object.job_id.address_id.name: + ${object.job_id.address_id.name}
+ % endif + % if object.job_id.address_id.street: + ${object.job_id.address_id.street}
+ % set location = object.job_id.address_id.street + % endif + % if object.job_id.address_id.street2: + ${object.job_id.address_id.street2}
+ % set location = '%s, %s' % (location, object.job_id.address_id.street2) + % endif + % if object.job_id.address_id.city: + ${object.job_id.address_id.city}, + % set location = '%s, %s' % (location, object.job_id.address_id.city) + % endif + % if object.job_id.address_id.state_id.name: + ${object.job_id.address_id.state_id.name}, + % set location = '%s, %s' % (location, object.job_id.address_id.state_id.name) + % endif + % if object.job_id.address_id.zip: + ${object.job_id.address_id.zip} + % set location = '%s, %s' % (location, object.job_id.address_id.zip) + % endif +
+ % if object.job_id.address_id.country_id.name: + ${object.job_id.address_id.country_id.name}
+ % set location = '%s, %s' % (location, object.job_id.address_id.country_id.name) + % endif +
+ % if object.job_id.address_id: + + + + % endif
- % endif - - - - - - -
-
Sent by ${object.company_id.name}
- % if 'website_url' in object.job_id and object.job_id.website_url: -
- Discover all our jobs. -
- % endif -
- - - - ]]> +
+ + + ${object.partner_id.lang or ''}
- - Applicant: Welcome new employee - Welcome ${object.name} - - Dear all,

-

I’m very pleased to announce that ${object.name} will be -joining us as a ${object.job_id.name} -%if object.department_id: - in ${object.department_id.name}. -%endif -.

-

Please welcome him/her and help him/her finding his/her marks.

]]>
-
- - - Graduate 1 diff --git a/addons/hr_recruitment/models/hr_employee.py b/addons/hr_recruitment/models/hr_employee.py index 5c88db5efa0..73104b1a31f 100644 --- a/addons/hr_recruitment/models/hr_employee.py +++ b/addons/hr_recruitment/models/hr_employee.py @@ -21,19 +21,3 @@ class HrEmployee(models.Model): def _search_newly_hired_employee(self, operator, value): applicants = self.env['hr.applicant'].search([('job_id.state', '=', 'recruit')]) return [('id', 'in', applicants.ids)] - - @api.multi - def _broadcast_welcome(self): - """ Broadcast the welcome message to all users in the employee company. """ - self.ensure_one() - IrModelData = self.env['ir.model.data'] - channel_all_employees = IrModelData.xmlid_to_object('mail.channel_all_employees') - template_new_employee = IrModelData.xmlid_to_object('hr_recruitment.email_template_data_applicant_employee') - if template_new_employee: - MailTemplate = self.env['mail.template'] - body_html = MailTemplate.render_template(template_new_employee.body_html, 'hr.employee', self.id) - subject = MailTemplate.render_template(template_new_employee.subject, 'hr.employee', self.id) - channel_all_employees.message_post( - body=body_html, subject=subject, - subtype='mail.mt_comment') - return True diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index 898a5234939..67ca1548bfd 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -338,7 +338,11 @@ class Applicant(models.Model): applicant = self[0] changes, dummy = tracking[applicant.id] if 'stage_id' in changes and applicant.stage_id.template_id: - res['stage_id'] = (applicant.stage_id.template_id, {'composition_mode': 'mass_mail'}) + res['stage_id'] = (applicant.stage_id.template_id, { + 'auto_delete_message': True, + 'subtype_id': self.env['ir.model.data'].xmlid_to_res_id('mail.mt_note'), + 'notif_layout': 'mail.mail_notification_light' + }) return res @api.multi @@ -445,7 +449,6 @@ class Applicant(models.Model): applicant.job_id.message_post( body=_('New Employee %s Hired') % applicant.partner_name if applicant.partner_name else applicant.name, subtype="hr_recruitment.mt_job_applicant_hired") - employee._broadcast_welcome() else: raise UserError(_('You must define an Applied Job and a Contact Name for this applicant.')) diff --git a/addons/l10n_be_invoice_bba/data/mail_template_data.xml b/addons/l10n_be_invoice_bba/data/mail_template_data.xml index b7110f157e7..e12f7745b91 100644 --- a/addons/l10n_be_invoice_bba/data/mail_template_data.xml +++ b/addons/l10n_be_invoice_bba/data/mail_template_data.xml @@ -2,47 +2,37 @@ - Dear ${object.partner_id.name} -% set access_action = object.with_context(force_website=True).get_access_action() -% set is_online = access_action and access_action['type'] == 'ir.actions.act_url' -% set access_url = is_online and object.get_mail_url() or '/report/pdf/account.report_invoice/' + str(object.id) - -% if object.partner_id.parent_id: - (${object.partner_id.parent_id.name}) -% endif -,

-

Here is your -% if object.number: -invoice ${object.number} -% else: -pro-forma invoice -% endif -% if object.origin: -(with reference: ${object.origin} ) -% endif -amounting in ${format_amount(object.amount_total, object.currency_id)} -from ${object.company_id.name}. -

- -% if is_online: -

-
- View Invoice -
-% endif -

- -% if object.reference_type=='bba' and object.reference: -

Please use the following communication for your payment : ${object.reference}

-% endif - -

Please remit payment at your earliest convenience.

-

Thank you,

-% if object.user_id and object.user_id.signature: - ${object.user_id.signature | safe} -% endif -]]>
+ +
+

+ Dear ${object.partner_id.name} + % if object.partner_id.parent_id: + (${object.partner_id.parent_id.name}) + % endif +

+ Here is, in attachment, your + % if object.number: + invoice ${object.number} + % else: + invoice + %endif + % if object.origin: + (with reference: ${object.origin} ) + % endif + amounting in ${format_amount(object.amount_total, object.currency_id)} + from ${object.company_id.name}. + % if object.state=='paid': + This invoice is already paid. + % else: + Please remit payment at your earliest convenience. + % if object.reference_type == 'bba' and object.reference: + Please use the following communication for your payment: ${object.reference}. + % endif +

+ Do not hesitate to contact us if you have any question. +

+
+
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml index 7b5196d271d..4c3848f1199 100644 --- a/addons/mail/data/mail_data.xml +++ b/addons/mail/data/mail_data.xml @@ -168,7 +168,7 @@ Your
- + @@ -183,7 +183,7 @@ -
+
@@ -195,7 +195,7 @@
- +
@@ -219,7 +219,7 @@
-
+
Powered by Odoo
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index 211368f0f24..ec27b66e08f 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -405,7 +405,6 @@ class MailTemplate(models.Model): """Generates an email from the template for given the given model based on records given by res_ids. - :param template_id: id of the template to render. :param res_id: id of the record to use for rendering the template (model is taken from template definition) :returns: a dict containing all relevant fields for creating a new @@ -487,19 +486,18 @@ class MailTemplate(models.Model): return multi_mode and results or results[res_ids[0]] @api.multi - def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None): - """Generates a new mail message for the given template and record, - and schedules it for delivery through the ``mail`` module's scheduler. + def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None, notif_layout=False): + """ Generates a new mail.mail. Template is rendered on record given by + res_id and model coming from template. - :param int res_id: id of the record to render the template with - (model is taken from the template) - :param bool force_send: if True, the generated mail.message is - immediately sent after being created, as if the scheduler - was executed for this message only. - :param dict email_values: if set, the generated mail.message is - updated with given values dict - :returns: id of the mail.message that was created - """ + :param int res_id: id of the record to render the template + :param bool force_send: send email immediately; otherwise use the mail + queue (recommended); + :param dict email_values: update generated mail with those values to further + customize the mail; + :param str notif_layout: optional notification layout to encapsulate the + generated email; + :returns: id of the mail.mail that was created """ self.ensure_one() Mail = self.env['mail.mail'] Attachment = self.env['ir.attachment'] # TDE FIXME: should remove dfeault_type from context @@ -513,6 +511,21 @@ class MailTemplate(models.Model): # add a protection against void email_from if 'email_from' in values and not values.get('email_from'): values.pop('email_from') + # encapsulate body + if notif_layout and values['body_html']: + try: + template = self.env.ref(notif_layout, raise_if_not_found=True) + except ValueError: + _logger.warning('QWeb template %s not found when sending template %s. Sending without layouting.' % (notif_layout, self.name)) + else: + record = self.env[self.model].browse(res_id) + template_ctx = { + 'message': self.env['mail.message'].sudo().new(dict(body=values['body_html'], record_name=record.display_name)), + 'model_description': self.env['ir.model']._get(record._name).display_name, + 'company': 'company_id' in record and record['company_id'] or self.env.user.company_id, + } + body = template.render(template_ctx, engine='ir.qweb', minimal_qcontext=True) + values['body_html'] = self.env['mail.thread']._replace_local_links(body) mail = Mail.create(values) # manage attachments diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 9c349c36bc2..9995bc15f04 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -94,20 +94,5 @@ form new - - - diff --git a/addons/portal/data/portal_data.xml b/addons/portal/data/portal_data.xml index 6539d154080..0cab34b3c01 100644 --- a/addons/portal/data/portal_data.xml +++ b/addons/portal/data/portal_data.xml @@ -5,34 +5,94 @@ Portal: new user - ${object.partner_id.email} - Your Odoo account at ${user.company_id.name} + Your Odoo account at ${object.user_id.company_id.name} + ${object.user_id.email_formatted | safe} + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+ Your Account
+ + ${object.user_id.name} + +
+ ${object.user_id.company_id.name} +
+
+
+
+ + + +
+
+ Dear ${object.user_id.name or ''},

+ You have been given access to ${object.user_id.company_id.name}'s portal.
+ Your login account data is: + + You can set or change your password via the following url: + + ${object.wizard_id.welcome_message or ''} +
+
+
+
+
+ + + +
+ ${object.user_id.company_id.name} +
+ ${object.user_id.company_id.phone} + % if object.user_id.company_id.email + | ${object.user_id.company_id.email} + % endif + % if object.user_id.company_id.website + | + ${object.user_id.company_id.website} + + % endif +
+
+
+ + +
+ Powered by Odoo +
+
+
${object.partner_id.lang} - - - Dear ${object.user_id.name or ''}, -

-

- You have been given access to ${user.company_id.name}'s portal. -

-

- Your login account data is: -

- -

- You can set or change your password via the following url: -

- -

-${object.wizard_id.welcome_message or ''}]]> + diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index 6fa550a184f..ee5b82eecda 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -143,7 +143,7 @@ class PortalWizardUser(models.TransientModel): wizard_user.user_id.write({'active': True, 'groups_id': [(4, group_portal.id)]}) # prepare for the signup process wizard_user.user_id.partner_id.signup_prepare() - wizard_user.with_context(active_test=True)._send_email() + wizard_user.with_context(active_test=True)._send_email() wizard_user.refresh() else: # remove the user (if it exists) from the portal group diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml index 16fa3861f1d..b5f7fb33024 100644 --- a/addons/purchase/data/mail_template_data.xml +++ b/addons/purchase/data/mail_template_data.xml @@ -4,8 +4,8 @@ Purchase Order: Send RFQ - ${object.create_uid.email_formatted | safe} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) + ${object.create_uid.email_formatted | safe} ${object.partner_id.id}

@@ -40,8 +40,8 @@ Purchase Order: Send PO - ${object.create_uid.email_formatted | safe} ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) + ${object.create_uid.email_formatted | safe} ${object.partner_id.id}
@@ -62,6 +62,8 @@ from ${object.company_id.name}.

Do not hesitate to contact us if you have any question. +

+ Best regards,

diff --git a/addons/repair/data/repair_data.xml b/addons/repair/data/repair_data.xml index 4b62c7aacb9..136a20d0c82 100644 --- a/addons/repair/data/repair_data.xml +++ b/addons/repair/data/repair_data.xml @@ -1,31 +1,35 @@ - - - Repair Quotation - Send by Email - ${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe} - ${object.partner_id.name} Repair Orders (Ref ${object.name or 'n/a' }) - ${object.partner_id.id} + Repair Quotation: Send by email + ${object.partner_id.name} Repair Orders (Ref ${object.name or 'n/a' }) + ${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe} + ${object.partner_id.id} + +
+

+ Hello ${object.partner_id.name},
+ Here is your repair order ${doc_name} ${object.name} + % if object.origin: + (with reference: ${object.origin} ) + % endif + % if object.invoice_method != 'none': + amounting in ${format_amount(object.amount_total, object.pricelist_id.currency_id)}.
+ % else: + .
+ % endif + You can reply to this email if you have any questions. +

+ Thank you, +

+
${(object.name or '').replace('/','_')} ${object.partner_id.lang} - -

Dear ${object.partner_id.name}

-

- Here is your repair order ${doc_name} ${object.name} - % if object.origin: - (with reference: ${object.origin} ) - % endif - % if object.invoice_method != 'none': - amounting in ${format_amount(object.amount_total, object.pricelist_id.currency_id)}. - % endif -

-

You can reply to this email if you have any questions.

-

Thank you,

-
+ +
diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index 95581a5e990..b0f188fd920 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -256,7 +256,8 @@ class Repair(models.Model): 'default_res_id': self.id, 'default_use_template': bool(template_id), 'default_template_id': template_id, - 'default_composition_mode': 'comment' + 'default_composition_mode': 'comment', + 'custom_layout': 'mail.mail_notification_light', } return { 'type': 'ir.actions.act_window', diff --git a/addons/survey/__manifest__.py b/addons/survey/__manifest__.py index 78290313cbf..179041a01a9 100644 --- a/addons/survey/__manifest__.py +++ b/addons/survey/__manifest__.py @@ -25,6 +25,7 @@ sent mails with personal token for the invitation of the survey. 'views/survey_templates.xml', 'views/survey_result.xml', 'views/res_users_views.xml', + 'data/mail_template_data.xml', 'wizard/survey_email_compose_message.xml', 'data/survey_stages.xml', ], diff --git a/addons/survey/data/mail_template_data.xml b/addons/survey/data/mail_template_data.xml new file mode 100644 index 00000000000..08b6d4403c4 --- /dev/null +++ b/addons/survey/data/mail_template_data.xml @@ -0,0 +1,28 @@ + + + + + Survey: Send by email + + ${object.title}: Survey + +
+

+ Hello

+ We are conducting a survey, and your response would be appreciated. +

+ Thanks for your participation! +

+
+
+ + +
+ +
+
\ No newline at end of file diff --git a/addons/survey/models/survey.py b/addons/survey/models/survey.py index 58835e4b675..97e58f3a5df 100644 --- a/addons/survey/models/survey.py +++ b/addons/survey/models/survey.py @@ -326,7 +326,8 @@ class Survey(models.Model): default_survey_id=self.id, default_use_template=bool(template), default_template_id=template and template.id or False, - default_composition_mode='comment' + default_composition_mode='comment', + notif_layout='mail.mail_notification_light', ) return { 'type': 'ir.actions.act_window', diff --git a/addons/survey/tests/test_survey.py b/addons/survey/tests/test_survey.py index c767b2ece4d..03c5bbbc5f4 100644 --- a/addons/survey/tests/test_survey.py +++ b/addons/survey/tests/test_survey.py @@ -124,7 +124,9 @@ class TestSurvey(TransactionCase): default_survey_id=correct_survey.id, default_use_template=bool(template), default_template_id=template and template.id or False, - default_composition_mode='comment') + default_composition_mode='comment', + notif_layout='mail.mail_notification_light', + ) self.assertDictEqual(action, { 'type': 'ir.actions.act_window', diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py index 80884543585..f57cc226b6c 100644 --- a/addons/survey/wizard/survey_email_compose_message.py +++ b/addons/survey/wizard/survey_email_compose_message.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging import re import uuid @@ -10,9 +11,12 @@ from odoo import api, fields, models, _ from odoo.exceptions import UserError from odoo.tools import pycompat +_logger = logging.getLogger(__name__) + emails_split = re.compile(r"[;,\n\r]+") email_validator = re.compile(r"[^@]+@[^@]+\.[^@]+") + class SurveyMailComposeMessage(models.TransientModel): _name = 'survey.mail.compose.message' _inherit = 'mail.compose.message' @@ -73,6 +77,11 @@ class SurveyMailComposeMessage(models.TransientModel): #------------------------------------------------------ # Wizard validation and send #------------------------------------------------------ + + @api.multi + def send_mail_action(self): + return self.send_mail() + @api.multi def send_mail(self, auto_commit=False): """ Process the wizard content and proceed with sending the related @@ -81,6 +90,7 @@ class SurveyMailComposeMessage(models.TransientModel): SurveyUserInput = self.env['survey.user_input'] Partner = self.env['res.partner'] Mail = self.env['mail.mail'] + notif_layout = self.env.context.get('notif_layout', self.env.context.get('custom_layout')) def create_response_and_send_mail(wizard, token, partner_id, email): """ Create one mail by recipients and replace __URL__ by link with identification token """ @@ -106,6 +116,22 @@ class SurveyMailComposeMessage(models.TransientModel): values['recipient_ids'] = [(4, partner_id)] else: values['email_to'] = email + + # optional support of notif_layout in context + if notif_layout: + try: + template = self.env.ref(notif_layout, raise_if_not_found=True) + except ValueError: + _logger.warning('QWeb template %s not found when sending survey mails. Sending without layouting.' % (notif_layout)) + else: + template_ctx = { + 'message': self.env['mail.message'].sudo().new(dict(body=values['body_html'], record_name=wizard.survey_id.title)), + 'model_description': self.env['ir.model']._get('survey.survey').display_name, + 'company': self.env.user.company_id, + } + body = template.render(template_ctx, engine='ir.qweb', minimal_qcontext=True) + values['body_html'] = self.env['mail.thread']._replace_local_links(body) + Mail.create(values).send() def create_token(wizard, partner_id, email): diff --git a/addons/survey/wizard/survey_email_compose_message.xml b/addons/survey/wizard/survey_email_compose_message.xml index baa4601b7ea..dee6315971f 100644 --- a/addons/survey/wizard/survey_email_compose_message.xml +++ b/addons/survey/wizard/survey_email_compose_message.xml @@ -1,20 +1,6 @@ - - - Survey - Send by Email - - - - Hello,

-

We are conducting a survey, and your response would be appreciated.

-

Please, click here to start survey

-

Thanks for your participation!

- ]]> -
-
@@ -69,7 +55,7 @@