跳至內容
選單
此問題已被標幟
1 回覆
4900 瀏覽次數

in my custom model i create a status field

I use a cancel button to change status to cancelled.

def cancel_status(self):

        self.write({'last_status': self.status})

        self.write({'status': 'cancel'})

        return True

I used a last_status field to write which is last status

My problem is when cancel button is clicked last status updated but it shows like this

How to display Await Approval instead of 'await_approval'?

頭像
捨棄
最佳答案

Dear acha aslam:


try to use if condition before you write the status on Last Status Field. like this:

def cancel_status(self):

        if self.status == 'await_approval':

                self.write({'last_status': 'Await Approval'})

        self.write({'status': 'cancel'})

        return True


I hope I helped you...

頭像
捨棄
作者

Thanks ayman

相關帖文 回覆 瀏覽次數 活動
5
5月 22
25486
0
2月 18
4915
2
9月 23
12391
1
7月 20
3142
2
9月 19
18393