[6.1.1.0] Invoice Email is send without attachment

Bug #941428 reported by weissollo
48
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 1
6.1
Fix Committed
Medium
OpenERP Publisher's Warranty Team

Bug Description

Hi all,

 I have installed the following modules:
 crm Customer Relationship Management 6.1.1.0
 account_voucher Accounting & Finance 6.1.1.0
 account_accountant Accounting & Finance 6.1.1.1
 sale Sales Management 6.1.1.0
 stock Warehouse Management 6.1.1.1
 purchase Purchase Management 6.1.1.1
 account Accounting & Finance 6.1.1.1
 base_action_rule Sales Management 6.1.1.0
 document Knowledge Management 6.1.2.1
 edi Tools 6.1.1.0
 email_template Marketing 6.1.1.1
 fetchmail Tools 6.1.1.0
 l10n_de Account Charts 6.1.1.0
 product Sales Management 6.1.1.1

1) Steps to reproduce the issue you have observed

 1. Go to Settings | Configuration | Email | Outgoing Mail Server |
 2. Set a Email server (Googleapps)
 3. Go to Settings | Configuration | Email | Templates | Invoice
 4. Click Edit | Advanced
 5. Attach Report | Optional report to print and attach: Invoices | Report Filename: Invoice
 6. Save

 7. Create an Invoice
 8. E-Mail is send out without attachment

2) The result you observed
Email is send without an attachment (no entries within the logfile)

3) The result you expected
Receive an email with invoice attachment without clicking on a seperate link

4) The platform your are using

Linux ubuntu 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux
Ubuntu 10.04.4 LTS

Related branches

Revision history for this message
weissollo (weissollo) wrote :
affects: openobject-server → openobject-addons
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Low
status: New → Confirmed
importance: Low → Medium
Revision history for this message
Mykola Lys (job-mlys) wrote :

Hello,

I faced this issue with sending attached reports from Invoice/Sales orders in 6.1 version on Windows after update from 6.0.

Actually there is missed sending functionallity in email_template wizard. I have fixed this issue an also issue with incorrect attachment name in base/ir.attchemnts.

Would like to share this fix. Just let me know how to send you my code changes.

Thank you!
--Mykola Lys.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Mykola,

Thanks for replied on this.

You can attach a patch on this or you can create a branch for this and put a merge proposal then this branch link to this bug,

Thanks in advance!

Revision history for this message
Mykola Lys (job-mlys) wrote :

Great!

Here is email_template fixed. Patched it from dev branch with recent updates.

It fixes issue with attaching generated reports. Static attachments works as expected.

Revision history for this message
Mykola Lys (job-mlys) wrote :

Also base.ir.ir_mail_server fixed is attached. Here has addressed issue with 'noname' attachment in Gmail and Outlook.

See there - http://www.openerp.com/forum/topic31148.html?sid=2e35d4b20a69771a6412862a06d70094

Revision history for this message
weissollo (weissollo) wrote :

Hi Mykola,

thanks a lot for your patch.

With your patch of the email_template it is now sending out an email with attachment.

But your second patch does not seem to work correctly:
When a Invoice is send to an outlook account it is called "invoice.pdf"
When I send an invoice to a gmail account it is named "noname" when I forward this email from my gmail to the exchagne address it will be named "ATT00001.bin"

Revision history for this message
Mykola Lys (job-mlys) wrote :

Weissollo,

actually base addon patch should fix this issue with 'noname' and was tested particularly with Gmail.
Please try to rewrite file from 'base.zip' to your original base addon and restart OpenERP server/service.

Looks like it works also for people from Openerp forum so I beliewe will work to you.
Let me know how it goes anyway. Thanks!

Revision history for this message
weissollo (weissollo) wrote :

Hello Mykola,

yes. Now it works :). I did not restart the server....

When I now go to "Attach Report" | "Report Filename" and enter there for example "Ref${object.name or 'n/a' }" a report is now send with attachment and the correct filename RefSO009.pdf.

If you now change the "Attach Report" | "Report Filename" to "TESTTEXT" a report for new invoices is send out still with RefSO009.pdf.

A workaround is to delete the existing reports and reinstall email_template again.

I used the latest nighly build to test it.

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello Mykola Lys (job-mlys) ,

I have checked you patch with trunk. But I have found another
problem. I got a traceback when open a messages after apply a patch.

Traceback (most recent call last):
  File "/home/jir/workspace/trunk6/server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/jir/workspace/trunk6/server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/jir/workspace/trunk6/server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/jir/workspace/trunk6/server/openerp/osv/orm.py", line 2201, in search_count
    res = self.search(cr, user, args, context=context, count=True)
  File "/home/jir/workspace/trunk6/server/openerp/osv/orm.py", line 2248, in search
    return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
  File "/home/jir/workspace/trunk6/server/openerp/addons/base/ir/ir_attachment.py", line 79, in _search
    model_attachments.setdefault(target_dict['res_model'],{}).setdefault(target_dict['res_id'],set()).add(target_dict['id'])
TypeError: string indices must be integers, not str

Steps to produce.
---------------------------
1) Set Outgoing server.
2) Set Email template with attached a report ,
      Give a report name.
3) Create sale Order , Click send button
4) Open Messages.
      -> Trackback.

Revision history for this message
Mykola Lys (job-mlys) wrote :

Thanks guys will try to reproduce these issues.

Revision history for this message
Mykola Lys (job-mlys) wrote :

Hello Weissollo,

have you saved email_template after changed the report name?

I change the Report FileName in "Attach Report" | "Report Filename" and save document it works as expected, new email has correct(changed) report name. Probably it is due to my Debug mode=on but don't think so. it uses report name from DB's email_template table each time when generate new mail.

Does that make sense?

Revision history for this message
Jeroen Brandligt (jbrandligt) wrote :

Hi Mykola,

Thanks for this patch, just what i was looking for! I have two issues with it though:

- I use the email template for sending invoices. In the email template it shows the translated (in Dutch) body text. When I open the message form (after selecting invoice and clicking send button) it still shows the translated body as expected, but in the actual mail being send the original English body text is used.

- Second issue is that when i manualy change the recipient address in the message form, it is not changed in the mail being send. It still uses the address which is configured in the mail template.

I copied both the base and email_template paches and restarted the openerp-server from init.d.

btw i don't have traceback issue as reported in #10, and the attachments work fine when i change the report name also.

Revision history for this message
weissollo (weissollo) wrote :

Just tested with openerp_6.1-20120406-233633-1. There I don't have the issue with the wrong name.

@Jeroen Brandlig
A workaround for your first issue would be to write a fix filename into the filename box.

When i try to reproduce the second issue. I get the message:
Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: subject - subject]Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: subject - subject]Integrity Error

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: subject - subject]

Revision history for this message
weissollo (weissollo) wrote :

I have now found a way on how to reproduce the second issue from #13: I added the button " (Automated Invoice Notification Mail) for manual sending the email and then changed the emailaddy in the to textfield. The email is also send to the wrong

Revision history for this message
Jeroen Brandligt (jbrandligt) wrote :

@weissolo #14
Thanks for testing, but I don't see how changing the filename of the attachment would have anything to do with the translation of the body text of the email?? I'm not referring to the attachment here, but the body text of the email.

The problem is that in all of the fields (not just the body text as i mentioned in post #13) in the email_template the translations are ignored. Only the original English text is used.

Revision history for this message
Kuldeep Joshi(OpenERP) (kjo-openerp) wrote :

Hello, Thanks For Reporting.

We have tested issue at our end and it's valid point.Your patch seems working ok . So, applying patch in branch https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-941428-kjo
revision-id: <email address hidden>
revno: 6724

It will be available in trunk soon.

Thank's for your contribution

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Enapps Ltd OpenERP Partner London UK (enapps-london-uk) wrote :
Revision history for this message
daemon dog (nodenet-1) wrote :

The patch provided for 6.1-1 didn't work for me. I'm not sure why, perhaps this is due to additional modules or different settings.

After some debugging I found that although attachments were being stored the mail message to attachment table was not being updated and the attachments appeared to be orphaned. The required code appears to be available in mail/mail_message.py so I moved this across to email_template.py along with a couple of other fixes...

* report_name was not subject to place holder expansion
* context does not appear to be set when sending interactively via the sidebar (for the moment I have just ignored context if not set but perhaps it should be investigated)

Revision history for this message
neonaga (neonaga) wrote :

Still not working even with last patch.

Attachment is with .dat extension on Oulook 2007 and 2010.

Revision history for this message
Arnaud Pineux (OpenERP) (api-openerp) wrote :

I tested those steps on the newest trunk and I didn't find the issues anymore.
If someone can try again on the Trunk before we close that bug, it would be great.

Good luck,

Arnaud Pineux

Revision history for this message
Thibault Delavallée (OpenERP) (tde-openerp) wrote :

In trunk, it should have been fixed at rev8084 <email address hidden> (http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/revision/8084).

Thibault.

Revision history for this message
Arnaud Pineux (OpenERP) (api-openerp) wrote :

I've got the confirmation that the bug doesn't exist anymore in the trunk version.

good luck to everybody,

Arnaud Pineux

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.