I want output a odoo 8 datetime field in the localization format but without time.
I extended the t-field with a option hide_time.
Is there a simpler build in solution?
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I want output a odoo 8 datetime field in the localization format but without time.
I extended the t-field with a option hide_time.
Is there a simpler build in solution?
Thanks
This is lovely! :) I found my own answer, but it didn't work this time (version 12). It turned out that f-field-options turned into t-options in the meantime. So I modified it accordingly.
MORE UNIVERSAL:
<span t-field="o.scheduled_date" t-options="{'widget': 'date'}" />
You can use below this code.
<span t-field="o.your_date_field" t-field-options='{"format": "dd/MMM/yyyy"}'/>
Thanks it works for me.
Use the below code:
<span t-esc="time.strftime('%m/%d/%Y',time.strptime(object.datetimefield,'%Y-%m-%d %H:%M:%S'))"/>Original Date field:
01/15/2016 10:41:01
Output Date field:
01/15/2016
You can use formatLang , <t-esc="formatLang(o.your_datatime_field,date=True)"/>
but u need to override the report ,as given sample code
#################
import time
from openerp.report import report_sxw
from openerp.osv import osv
class QuotationPrint(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(QuotationPrint, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
self.context = context
class quotation(osv.AbstractModel):
_name = 'report.sale.quotation_template'
_inherit = 'report.abstract_report'
_template = 'sale.quotation_template'
_wrapped_report_class = QuotationPrint
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Ol
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.