Odoo Help

0
2 Answers
0
Avatar

Avinash Nk

--Avinash Nk--

2131
| 4 3 7
Calicut, India
--Avinash Nk--

 

Avinash Nk
7/29/17, 12:38 AM

Hi Jose Antonio, 

You can Automatically validate an invoice by the following code. 

For Version 10

class YourClass(models.Model):
_inherit = "account.invoice"

@api.model
def create(self, values):
invoice = super(YourClass, self).create(values)
invoice.action_invoice_open() return invoice

For Version 8 and 9

@api.model
def create(self, values):
invoice = super(YourClass, self).create(values)
invoice.signal_workflow('invoice_open')
return invoice

Thank You.

0
José Antonio
7/31/17, 4:46 AM

Hi Avinash Nk,

I tried your code and I'm getting this error:

AttributeError: 'account.invoice' object has no attribute 'action_invoice_open'

What means this error? Thanks.


1 Comment
Avinash Nk
8/1/17, 1:15 AM

Hi Jose Antonio,

I think you are using Odoo 8 or 9. That is why you getting that error. Anyway i just update the Answer. You can choose which code is needed for your Version of Odoo. And please Don't Put This Type of Comments as Answers. You can put it as Comments.

Thank you.

Ask a Question
Keep Informed
1 follower(s)
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