跳至内容
菜单
此问题已终结
1 回复
8456 查看

HI, 

i have 2 states in my form view statusbar, Draft and Sent. default state is draft. when i click save button ( in form view), the status should change into Sent. How i do this ? please help

形象
丢弃
最佳答案

Hi,

You can override the create method or write method and change the state to the required state.

please refer this

    
    @api.model
def create(self,vals):
vals['state'] = 'sent'
    return super(ClassName, self).create(vals)

   
    @api.multi
def write(self,vals):
vals['state'] = 'sent'
    return super(ClassName, self).write(vals)



Thanks

形象
丢弃
编写者

thanks

相关帖文 回复 查看 活动
1
3月 21
6058
1
2月 21
3493
3
1月 20
8080
0
4月 19
2329
1
3月 19
4568