Odoo Help

1

Set default invoiced date to current date

By
Andreas Marpmann
on 9/6/13, 4:44 PM 13,123 views

At Quotation we set --> Create Invoice: On Delivery Order

After the delivery a popup window appears to create the invoice, by default the invoiced date field is empty.

I want to change it to:

After I click create invoice, the invoice date field will display the current date.

Create Invoice On Delivery Order

1
Grover Menacho
On 9/6/13, 5:08 PM

This is a wizard that is located on stock/wizard/stock_invoice_onshipping.

You can inherit it with this:

from datetime import date
from openerp.osv import fields, osv
from openerp.tools.translate import _

class stock_invoice_onshipping(osv.osv_memory):

    _inherit = "stock.invoice.onshipping"

    _defaults={
        invoice_date': date.today().strftime('%Y-%m-%d'),
    }

Or you can add that line on defaults to the original file, but this is no recommended because if you want to update your OpenERP version you have to check all your changes and modify them on the new version. do this as a new module and it's going to work.

I've just tested it on the RunBot. The date is set when the invoice is validated

Metrolux Gmbh, Andreas Marpmann
on 9/6/13, 5:10 PM

Can you tell me in what file that is entered?

Metrolux Gmbh, Andreas Marpmann
on 9/9/13, 4:59 AM

Sorry I don't understand your question. what do you mean?

GH Mediacloud, Grover Menacho
on 9/9/13, 11:13 PM

OK. Your code looks like the part of a custom module. You dont edit account_invoice.py? Please see, i have edit my question.

Metrolux Gmbh, Andreas Marpmann
on 9/10/13, 4:59 AM

Answer edited too.

GH Mediacloud, Grover Menacho
on 9/10/13, 9:23 AM

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

Question tools

0 follower(s)

Stats

Asked: 9/6/13, 4:44 PM
Seen: 13123 times
Last updated: 3/16/15, 8:10 AM