Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hi there! I am trying to print a custom invoice. The problem is that I cannot print the user's local time. All I can is to print the in UTC Time Format. I am using the code below, but it doesn't work for displaying the time. My timezone is Europe/Athens.
I am making changes in the company's header.
Code:" <drawstring x="1cm" y="21.5cm"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]], Time: [[ time.strftime("%H:%M") ]]</drawstring>"
What I get: "12/10/2013, Time: 22:05" (My local time is 00:05 GMT+2)
Does anyone know how to make it work?
Didnt's help. Should I change something?
I just edit it like that in the companies header form. "<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
<drawstring x="1cm" y="21.5cm"> [[ formatLang(time.strftime("%Y-%m-%d"), date=True) ]], Time: [[ time.strftime("%H:%M") ]]</drawstring>"
Still nothing. Printed GMT0 time not my local one.
I also found the addon called "invoice_date_time" and extract it to /usr/share/pyshared/openerp/addons/invoice_date_time but i dont know if its right. It doesn't print the time still. It prints GMT0 time, not GMT+2. My user has timezone:Europe Athens and lang to Greek.
How can I easily make it save in the users local time? Doesn't openerp do that by default? Maybe I have forgotten to check something in settings???
the add on link: https://www.openerp.com/apps/7.0/invoice_date_time
I'm not sure if it's possible to use rml parser method in the header, I guess yes, it's what I did using webkit_report, I can use my parser methode in the webkit report header, which is mako format:
In the parser method you can define a methode like this to return the date time you needs:
from openerp.report import report_sxw
from tools.translate import _
from datetime import datetime
from openerp.tools import misc
from osv import osv
def _displayDateTime(self, timezone, format='%d/%m/%Y %H:%M'):
raise osv.except_osv(_('Timezone error or date format invalid!'),
_('Please set your timezone before to generate this report.') +
_(' One of those values is not valid: timezone= %r - format= %r')
% (timezone, format))
A bit late! hope it helps!
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/10/13, 6:06 PM|
|Seen: 4071 times|
|Last updated: 3/16/15, 8:10 AM|