Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have customized new form for some calculation. i have defined a wizard button for entering a purchase receipt,i have pasted code below:
def action_purchase_receipt(self, cr, uid, ids, context=None):
if not ids: return 
dummy, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_purchase_receipt_form')
# inv = self.browse(cr, uid, ids, context=context)
if i click on validate button, it exits without saving record in purchase receipt.
How to resolve this issue.Help me in this situation.Thanks in advance
create it on save of views that you have returned
hi vadivel ,you are returning view_purchase_receipt_form
Validate button actually call the proforma_voucher method define in account.voucher, so please go through these steps:
#1 Override proforma_voucher ,
#2 At the time of returning the view, pass the context also (pass a identifier to identify that this view is called by you )
#3 On the basis of context in side proforma_voucher create the purchase receipt.
view_id = self.env.ref('account_voucher.view_purchase_receipt_form')
# raise Warning(vi)
def proforma_voucher(self, cr, uid, ids, context=None):
#do my task here
return super(account_voucher,self).proforma_voucher(cr, uid, ids, context)
Hope this help you ,
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 4/20/16, 6:20 AM|
|Seen: 450 times|
|Last updated: 4/20/16, 6:37 AM|