Template sending wrong report

Asked by nzresearch

I have created a template using powermail and upon testing i find that it is sending report associated with other items.

I.E. if i am editing invoice 45 it will send the invoice of 72 (as an example)

Any Ideas?

Sam

Question information

Language:
English Edit question
Status:
Solved
For:
Power Email Edit question
Assignee:
No assignee Edit question
Solved by:
nzresearch
Solved:
Last query:
Last reply:
Revision history for this message
nzresearch (sboy031) said :
#1

actually i've explored some more - it is actually sending a Sales Order, and the same one - any clues as to why this occurs?

Revision history for this message
nzresearch (sboy031) said :
#2

is this mako related - because i'm running Hardy and can't figure out how to install mako version greater than 0.1.10-1?

Revision history for this message
nzresearch (sboy031) said :
#3

ok -upgraded to mako 0.2.5 - still no change

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) said :
#4

Nautica,

Which version of Poweremail are you using?

Revision history for this message
nzresearch (sboy031) said :
#5

0.6.3

Revision history for this message
nzresearch (sboy031) said :
#6

is this line of code in poweremail_mailbox.py the probem? (line 93)
attachment = self.pool.get('ir.attachment').browse(cr,uid,attid)#,['datas_fname','datas'])

Revision history for this message
nzresearch (sboy031) said :
#7

or is pem_attachments_ids set incorrectly?

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) said :
#8

Can you check two things to confirm the issue:

1. Go to the attachment when mail is in the outbox and check if it has the right attachment. If not then its the problem of report generation.

2. If its the right report there and the sending has the issue then its the wrong attachment being loaded at send time.

Revision history for this message
nzresearch (sboy031) said :
#9

Ok, thanks for the quick reply. The report is incorrect in the outbox. ll the attachment information is correct, invoice num, partner, etc. but when i save the attachment from the outbox, it is that same erroneous report. hmmm.....

Revision history for this message
nzresearch (sboy031) said :
#10

Ok I've done some mucking around and it looks like the save_to_mailbox method in poweremail_send_wizard.py is using an incorrect record_id. According to the code and bug #435708 the value that sets the record_id is screen_vals['rel_model_ref'] which should be the calling documents id from what i understand. However for invoices it looks as though the entire module has a document id which is the same. So no matter which record i select under account.invoice, the 'rel_model_ref' from the referring page will be the same! So, undesired behavior, as this is the incorrect id. I changed the record_id value to ctx['src_rec_id'] and now the correct record_id for the invoice that i am sending is selected.

Hope that makes sense. I'm not sure if this will resolve all cases, but in the case where the referring document id is not the same as the record_id that I am view this patch should work.

Line 167 of poweremail_send_wizard.py from
                record_id = screen_vals['rel_model_ref']
to
                record_id = ctx['src_rec_id']