I used defaults attribute and made state field value as 'draft' and once I saved the form its going to To Approve state
Help me out to resolve this
Thanks in Advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I used defaults attribute and made state field value as 'draft' and once I saved the form its going to To Approve state
Help me out to resolve this
Thanks in Advance
Hi Found solution that is happening because of the work flow defined for the Leave Request
Workflow starting from the Confirm stage so that was happen now I changed workflow to start at the to Submit state now working fine.
Thanks.
Just override the create method of your model, like:
from openerp import api, models
class leave(models.Model)
_inherit = "module.model_leave"
@api.model
@api.returns('self', lambda value: value.id)
def create(self, vals):
vals['state'] = 'approve'
return super(leave, self).create(vals)
In Create method state value coming as 'draft' only but once saved the form its going to confirm state
The create method get executed when the record is about to be saved, so you will get displayed the record in the form as draft using your defaults and when the user clic save the state field will became approve in the create method.
Due to workflows defined for the object create state value is not effecting
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Dec 19
|
6263 | ||
|
0
Jul 19
|
4547 | ||
|
0
Jun 19
|
2252 | ||
|
0
Jun 17
|
2095 | ||
|
0
Jul 24
|
22 |