Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


'Save as attachment prefix' doesn't work?

on 7/30/13, 10:28 AM 3,542 views

I'm currently using v 6.1. If i go to reports and fill field 'Save as attachment prefix' i. e. 'SO' next time i print this report it still has old name even after server restart. After investigation it appears that filename comes from Service name defined in report and this Service is registered each time you start the server. I tried to change this filename , even had success but the problem is that my code is rewriting report_name field each_time you print it and filename appears with one step back. Does anyone faced the same problem? Any help will be appreciated.

how did you give the prefix name?

on 9/26/13, 5:17 AM

having similar problem. the value from the field "Save as Attachment Prefix" is never used. Actually the PDF should also be persisted to the "Attachments", if a prefix is specified, but also this doesn't work.

my prefix for a Purchase Order is: ((object.name) + '_' + (object.state) + '_' + (time.ctime()) + ('.pdf'))

but I also tried a simple one like ('PO.pdf')

Michel Hugues
On 9/7/14, 4:31 PM

For pyhon shell syntax training, try this:

>>> import time
>>> print "%s" % time.ctime()                               >>Sun Sep  7 22:05:46 2014
>>> print "%s" % time.ctime().split()[4]                >>2014
CTRL-D for quit shell


For attach pdf Sale Order in state 'progress' or 'manual' or 'done' with name 'SO001-2014.pdf', my prefix is:

(object.state in ('progress','manual','done')) and ((object.name or '').replace('/','')+'-'+ time.ctime().split()[4] +'.pdf')




Thanks, your prefix helped me partially get where I wanted to go in 8.0, however i'd like to ask if you know if it is possible to create a custom filename in this manner for printing in Aeroo Reports.

What I would like to do is have the Document state (eg. PO), document number (eg. 123456), and then a date/timestamp of when it was printed (eg. 2015-04-18#11_45) as the filename. So in my example above:


I'm just getting to grips with Aeroo, and it's an awesome little reporting engine, but I haven't managed to figure out this one yet. If you have time, any insight or advice would be very appreciated.

Luke Branch
on 4/18/15, 5:38 AM


| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 7/25/14, 3:18 AM

I had simmilar problem, and finaly foud it out to be a strange bug... On fist print the document name is rendered correct, and stored with correct name, but the file that is downloaded after fisrt rendering is having OLD name value, so the first time you download the attachment it has wrong filename. Also, after downloading, check the name of attachment (clicking on attachments button on top of document page and there the name of document shows up corectly)... 
Instead of rewriting javascript that downloads the document, i just discard the first download, and download it againg from attachment so it gets the desired filename.. 


claudio candito
On 7/24/14, 11:13 AM

please try with something like this:

(object.state in ('draft','approved')) and ('RfQ_'+(object.name + '_' + time.ctime()).replace('/','')+'.pdf')



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 7/30/13, 10:28 AM
Seen: 3542 times
Last updated: 8/31/15, 3:23 AM