Odoo Help


Display date and time on Invoice

on 7/7/15, 4:02 PM 1,338 views


How can I modify:

<div class="col-xs-3" t-if="o.date_invoice">

<strong>Datum računa:</strong>

<p t-field="o.date_invoice"/>


To display date and also time of Invoice?

I see that this in sales report shows time:

<div t-if="o.date_order" class="col-xs-3">

<strong t-if="o.state not in ['draft','sent']">Datum narudžbe:</strong>

<strong t-if="o.state in ['draft','sent']">Datum ponude:</strong>

<p t-field="o.date_order"/>


But how to do it on invoice?



Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 7/7/15, 11:34 PM

You have to override the definition of the field date_invoice via Python.

date_order  is a DATETIME field - always storing the time.

date_invoice  is a DATE field - never storing the time.

(I've never seen or been asked to show a time on an Invoice by the way!)

We have to have time because of the law :)

on 7/8/15, 4:43 AM

True.. in croatia date and time is requirred to be on invoice :) amog other wierd things :)

on 7/8/15, 8:12 AM
On 7/8/15, 3:13 AM

This should do the job

from openerp import models, fields, api 

class override_date_invoice(models.Model):
_inherit = 'account.invoice'
date_invoice = fields.Datetime(string = 'Invoice Date', readonly = True, states = {'draft': [('readonly', False)]}, index=True,help=’Keep empty to use the current date’,copy = False)

HI Thanks and because I am new in all of this can you just tel me how to add this overrride in template? Thanks

on 7/8/15, 4:26 AM

You have to create a new module. https://www.odoo.com/documentation/8.0/howtos/backend.html And write my code in your modul, then install it

on 7/8/15, 4:53 AM

Hi I created module but it does not add anything, is there anything else that I need to override?

on 7/8/15, 9:06 AM

It should not add something, it should only replace the field.date with a Datetime one, to add the Time also

on 7/8/15, 10:29 AM

I have just writen the modul for my system and it works without problems. The field date_invoice in custumer invoice now takes date and time. Have you installed the modul? In your _openerp_.py you have to add account as dependency

on 7/8/15, 10:40 AM
On 7/8/15, 6:27 AM

Is it possible to do is something like this and get time from invoice? To save it?


<div class="col-xs-3" t-if="o.date_invoice">

<strong>Datum računa:</strong>

<p><t t-if="o.date_invoice is not False"><t t-esc="time.strftime('%d.%m.%Y %H:%M')"/></t></p>


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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/7/15, 4:02 PM
Seen: 1338 times
Last updated: 8/8/15, 2:15 AM