OpenERP 6.1 - Email template to default to html - odoo

I am trying to send an email from the partner window using the Send Mail menu on the right hand panel.
For this I have created a template email from the configuration menu, left the body (Text) empty and filled the body (Rich/html) with:
<p>Some text in <b>bold</b></p>
When I run send mail from the partner form, the message body is desperately empty and it looks like it is defaulting the message body to the Body (Text) tab from the email template.
This is confirmed when I look at table email_template where the field subtype is always "Plain".
I tried to setup the Action window specific to my email template by setting the domain value to [('subtype','=','html')], but it doesn't change anything. I also added this code to most of the Action window domains that relate to email but it hasn't changed anything either.
Does anyone know how to default sending email in HTML format from OpenERP?
UPDATE: Has anyone got a sample of HTML code that works for them, meaning they receive correctly in their email client?
My issue is that if I leave the Plain Text empty within the template and have some html tags under the Rich/html, then I receive an email in format html, but it is always empty. Even the source is totally empty. I suppose there is something wrong with my html syntax. Maybe I need to double the "/" in a closing paragraph as it may be an escape character somewhere, somehow. I have tried a lots of different syntaxes but apparently not the right one.
So if someone out there had some html coding that works for them and they'd
be happy to share, thanks in advance!
UPDATE 2, I have created an html template email after a quick training on the internet. I have tested my bit of code with litmus and it shows exactly what I wanted to see. I then paste this exact same bit of code into OpenERP, send the email message to my email client, identical to the one on litmus, and it is totally empty. However, it says the format is HTML. There is definitely an issue somewhere but I can't point out where. It seems OpenERP doesn't send the html code. Has anyone ever had the same issue???
Here is the html basic code I have used for testing and that I pasted into OpenERP:
<html>
<body leftmargin="0" marginwidth="0" marginheight="0" offset="0">
<table width="100%" bgcolor="#cccccc" cellpading="10" cellspacing="10">
<tr valign="top" align="center">
<td>
<table width="500" bgcolor="#ffffff" cellpading="0" cellspacing="0">
<tr>
<td>
liusuhflsb
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Short answer: you can't do that in 6.1 without using third-party addons or custom code.
Long Answer:
OpenERP 6.1 does not provide a WYSIWYG/Rich Text editor out-of-the-box (OpenERP 7.0 introduces that)
As a result, in 6.1, only the plain text version of a template is used whenever the user can manually edit the email contents. Indeed it would be quite awkward to ask users to manually edit the source of the HTML version of the template when composing their email (no WYSIWYG).
It is the case when you're composing a new email based on a template, via the corresponding Send Mail side bar action, because you can modify the email before sending it.
One typical case where both the HTML/Rich Text and the plain text version of a template are used as expected is when an email template is bound to a Marketing Campaign step (via the marketing_campaign module) - because these emails are sent without any editing nor any manual user action.
UPDATE:
If that's what you're interested in, Marketing Campaigns will
always send both the plain-text and HTML version of your emails
automatically, and the recipients' mail software will display the
relevant one based on user preferences (for most people it will be the
HTML version). However you can not test the templates using the
Send Mail sidebar buttons, because that will keep only the plain-text version, as explained above. There are two recommended ways
to test those campaign emails:
Use the Preview button on the template and select a sample record to render the template for. This will let you double-check the
source of the HTML that will be produced.
Test-drive your campaign putting in "manual" mode: have a dummy record enter the campaign with your email address on it, then use the
Campaign Follow-up menu to make it manually advance through the campaign steps. This is really important to validate not only your
email templates but also the structure of your campaign. See also this
basic introduction to OpenERP Marketing Campaign, from OpenERP
Community Days 2012.
There are community modules that add WYSIWYG editing capabilities to OpenERP 6.1 (search for WYSIWYG on OpenERP Apps), but I don't think they were integrated with the email_template module in order to enable composing Rich Text directly. Doing it wouldn't be very hard though. If you're interested, start by reading the source code of the mail.compose.message wizard (both the original version of the mail module and the email.template extension), to see how the template fields are used and where.
If you're not familiar with OpenERP development, the developer documentation of OpenERP and the technical memento will be interesting starting points.

The e-mail message is sent with both contents: plain and html.
The e-mail client makes the decision to render either one, depending on it's capabilities. It it's html capable, it will use the HTML version, if not, the plain version will be rendered.
You should provide the two versions for the message in your template: plain and html.

This is over a year ago and I have given up on OpenErp because of this kind of flaws. I never got around to having OpenERP send me an automated email in HTML format, no matter what I tried. It always defaulted to text whichever email client I used. I would like to know if wome other people have managed receiving automated html email that related to a marketing campaign in OpenERP?

Related

How to add image uploader in shopify?

In my shopify store I make custom arts based on customer's image. I need to add an image uploader where user selects the image and when they hit continue I should take them to checkout. I am using the debut theme. How can I make this happen?
You can add additional details to a product by including an input field with a name of properties[some-property-name], and this also works for input fields with a type of file.
For example, you could add the following to your product form to create an image upload field. (Note: Make sure your form has enctype="multipart/form-data" set so that browsers submit the form correctly)
<input type="file" name="properties[Uploaded Image]" class="custom-upload" />
The resulting file will be uploaded to Shopify and will be accessible to you through the order in the Shopify admin. Your customers will be bound by whatever limits Shopify enforces regarding file sizes, which from a quick Google search looks to be set at 20MB currently.
NB: If your theme uses Javascript to submit your product form, it may or may not be compatible with file inputs out-of-the-box. Many simple stay-on-page features assume that all of the form data can be treated as text, so would ignore your file field. Here's an answer to a similar question where I tried to provide some ideas on how you could get around this problem: https://stackoverflow.com/a/58271610/2592369

Mechanical Turk externalquestion error when submitting hit

I have managed to create a HIT with an external question that calls an html file hosted in an S3 server. I have worked in the sandbox environment. When I create the hit, I get the following error when I try to submit the hit as a worker:
There was a problem submitting your results for this HIT.
This HIT is still assigned to you. To try this HIT again, click "HITs Assigned To You" in the navigation bar, then click "Continue work on this HIT" for the HIT. If this problem persists, you can contact the Requester for this HIT using the "Contact" link above.
To return this HIT and continue working on other HITs, click the "Return HIT" button.
I have already read multiple forums trying to figure out the problem. When I check out the source in the developer tools, it seems to have all the necessary parameters set:
</style><iframe height="400" scrolling="auto" frameborder="0" align="center" src="https://BUCKET.s3.amazonaws.com/index.html?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&hitId=3N2YPY1GI6BYD6C5MRBYOYBJJSEEVE&workerId=A1YJU5SNGQQP00&turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe>
Also, I made sure I don't have any button named 'submit'. Any ideas of how I could debug this thing?
The issue here is usually that you're not submitting the appropriate information back to MTurk. You need to send the assignmentId parameter in addition to at least one other named field. I often just add a &foo=bar (or similar) to the end of the submit URL. So you should be submitting to something like:
https://workersandbox.mturk.com/mturk/externalSubmit?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&foo=bar
That's for the sandbox. For the live server, switch the base URL to https://www.mturk.com.
Amazon MT HITs seems to be printing a generic error message for a wide range of issues. This causes the problem to be particularity hard to debug.
For me, the error occurred since I was not assigning "name" attribute to my input elements in the form.
You must include the HTML name attribute in the input field definition. Make your name attributes descriptive because they are used as the column headings in the Results table.
If you are using the GUI to build and deploy your tasks, I recommend giving this document a good read and see if you have missed something.
MT Requestor UI guide
Hope this helps.

Passing variables? wordpress

Hello all I'm very thankful for this community here, wouldn't know what to do without you all.
First of all, I'm not even sure if the title to this post is accurate; please read on. In a nutshell what I'm trying to do in Wordpress is create a 'reply' button that will be displayed on the individual post's page. When someone clicks on this 'reply' button it will take them to a different WP page that is using a private messaging plugin. On this page I would like the 'to:' field to automatically know who to reply to (author of the post).
Now here's my question. Is this accomplished by "passing a variable" from first page to the second or is there another way to do this?
I'm not asking for specific code help so please don't tell me to go talk with the plugin developer. I'm just trying to get a general idea of how something like can be accomplished so that I can do some research myself.
At the very least, If someone get give me a starting point for me to do some google research that would be all I need. Being fairly new I don't even know what phrase I should be googling for.
Yes, you can do that by implementing simple wp plugin. First of all you need to know that, there are lots of wp specific functions. You can use the_content for putting your reply link after post content, and get_author_meta in order to get post's author email for putting it in your custom link. I know, you don't want to talk about code, but I can give you sample example; In order to apply this functionality on all post, you can simply implement a plugin.
Edit: For redirecting to Private Messaging plugin's send page with prepopulated recipient field, I have updated get_the_author_meta('email') with get_the_author_meta('user_login'). Now, you can go to mail send page, by clicking Reply link
add_filter('the_content', 'add_custom_link');
function add_custom_link($content) { // You can think that $content => individual post
if(is_single()) {
$content .= 'Reply to this post';
}
return $content;
}
Save this code in a php file and zip it.Then, upload it to your wp site as plugin. And you will see your custom link at the end of your posts. Do not forget to update variables in plugin according to your needs(for example reply url domain)
Here is a working plugin demo: http://huseyinbabal.eu01.aws.af.cm/?p=1
Create a form that posts to the secondary page.
Use a hidden form field to pass the post ID
Make sure you prefix the form fields so your $_POST variable doesn't conflict with any other core/plugin variables
On the secondary page: make sure you sanitize that user input before you do anything else
with it
use the sanitized post id to look up the post's author, without
having to expose the author's email in the url.
Your Form should look something like so:
<form action="url-of-page-2" method="POST">
<input type="hidden" name="myprefix_id" value="<?php echo get_the_ID();?>">
<input type="submit" value="reply">
</form>

Is it possible to send inline image using email template in openerp?

I have to send an image using email template in OpenERP but I have to insert it just like we have a feature of insert image in gmail,yahoo and have here also in stackoverflow.com.
I have to send image like this is because I want it should be displayed at the same time when mail is open, along with the text.
If I send it using attachments it coems in attachments which we can see just after download the image. I dont need this download option what I need is open image.
thanks in advance !
There are 3 common ways to embed images within an email (in increasing complexity order): using public URLs, using Data URI to inline the image data in the src attribute, and using images attached to the email.
In all 3 cases you can use regular HTML techniques to include them in the HTML/Rich-Text body of the OpenERP email template: for example with an <img src="..."/> tag or the CSS background-image property.
Only the first 2 techniques will work out-of-the-box in OpenERP's email templates.
1. Using hosted images
The image URL can simply be a public URL on your website or any image hosting service on the internet:<img src="http://www.example.com/myimage.png">. This is very similar to what happens when you embed an image on stackoverflow, as the image is first uploaded to imgur.com automatically and the img src attributes refers to the URL of the uploaded image on imgur.com.
This works but nowadays most email clients (thunderbird, gmail, outlook, ...) will block remote images, as they are commonly abused to detect the fact that a given email was opened by its recipient (if the image is downloaded, it means the mail was opened). Typically the recipient will have to click a banner or warning in order to display these remote images.
This is the only technique that works out-of-the-box with OpenERP's email templates.
2. Using Data URI to inline the image data
The src attribute of an img tag can use the Data URI (RFC 2397) scheme to include the image binary source inline. The image tag would look like this:
<img src="data:mime-type;encoding,<encoded_image_data>"/>
For a PNG image, this could look like this
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."/>
You can use this technique for OpenERP email templates, and it does not have the downside of being blocked by email clients. However you will need to manually convert your image to base64[A]. This will also substantially increase the size of your templates and your outgoing emails, and has several limitations (e.g. max 32KB if you want maximum compatibility).
[A]: Google "online base64 file encoder" if you want a simple way to do the conversion
3. Using attached images (not currently supported in OpenERP)
RFC 2111 specifies a way for message body parts to refer to other body parts using cid: URLs. For example the img src attribute within an email can refer to one of the attachments. Technically the img tag could look like this:
<img src="cid:some_unique_content_id/>
where some_unique_content_id is the Content-ID of the message part that contains the image. This is what it will look like in the final (raw) email:
------=_NextPart_WHATEVER_ID
Content-Type: image/jpeg;
name="image.jpg"
Content-Transfer-Encoding: base64
Content-ID: <some_unique_content_id>
Content-Disposition: inline;
filename="image.jpg"
/9j/4AAQ...continuation_of_the_base64_encoded_image
This technique also does not have the downside of being blocked by email clients, but it is more complex to implement because you need to specifically assign a Content-ID to each attachment, and the final email that is sent on the wire is bigger because it must contain the actual images.
This is not currently available in OpenERP, but it would not be very difficult to implement. One trivial way would be to automatically assign sequential Content-ID identifiers to all attachment (e.g. attachment_1, attachment_2) when the final mail is crafted by the email layer, and perhaps add an option in the email template Value Builder assistant to generate cid-based URLs for the attachments.
this maybe useful embedding image in html email
although I don't think this is an openerp-related problem...
Here is how I added the company logo on my Sale Order email template with Odoo 11:
<p>
% set company = object.company_id or ctx.get('company')
% if company.logo:
% set field_value = '%s' % company.logo
% set company_logo_base64 = 'data:image/*;base64,%s' % field_value[2:-1]
% endif
<img t-if="company_logo_base64" src="${company_logo_base64}">
</p>

Keeping DRY with progressive enhancement

I'm building a website with very small amounts of Javascript, just to add things to the page (like a contact form) without having to go to a new page.
I understand that I should build the contact page anyways (just in case the user doesn't have javascript turned on) and then use javascript if they've got it.
So where do I store the HTML for the form if I don't want to have it in two places?
(Normally I'm not so picky, but I'm curious on this one.)
If you have access to a server-side language, you can keep a separate snippet of the form in an external page. Then, you can include the snippet into the HTML content page with an appropriate include call. This has the added benefit that, for your JavaScript, you can pull the contact form from this snippet file using AJAX. In fact, many plugins allow you to display DHTML windows with HTML content. For example, check out ThickBox.
Without a server-side language, you can do something similar with frames. Just display the form snippet in a frame when you need to reference it. Personally, I don't like frames very much, so this isn't a very attractive solution for me, but you can use it if you choose (and style the frames appropriately).
Just put your HTML for the contact form in a .html file. Assuming you're using PHP or something, just include the file in your contact page and include it in the section for your dynamic contact form. The form should still submit to the same server-side page and have the same look and feel..
e.g. contactForm.html
<div class="contact-form">
<input ....>
</div>