Odoo Help


Invoice Date in the account_voucher

on 2/9/16, 6:12 AM 374 views


I want to get the invoice_date when paying an invoice how could I doing this??



Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
Ankit H Gandhi(AHG)
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 2/10/16, 3:47 AM

Hello Jihen,

Please refer below code.

class account_voucher(osv.Model):

_inherit = "account.voucher"

def default_get(self, cr, uid, fields, context=None):

data = super(account_voucher, self).default_get(cr, uid, fields, context=context)

if context.get('active_ids'):

acc_inv_obj = self.pool.get('account.invoice')

for acc_inv_data in acc_inv_obj.browse(cr, uid, context.get('active_ids'), context=context):

data['date_inv'] = acc_inv_data.date_invoice

return data

Hope that code help for you.

Best Regards,

Ankit H Gandhi.

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 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: 2/9/16, 6:12 AM
Seen: 374 times
Last updated: 2/10/16, 4:15 AM