Odoo Help

Welcome!

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.

-1

Display date and time on Invoice

By
Marin
on 7/7/15, 4:02 PM 597 views

Hi

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"/>

</div>


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"/>

</div>

But how to do it on invoice?


Thanks

2

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

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 :)

Marin
on 7/8/15, 4:43 AM

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

Bole
on 7/8/15, 8:12 AM
0
Dairidi
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

Marin
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

Dairidi
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?

Marin
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

Dairidi
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

Dairidi
on 7/8/15, 10:40 AM
0
Marin
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>

<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>

</div>


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

1 follower(s)

Stats

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