Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5236 Zobrazení

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'?

Avatar
Zrušit
Nejlepší odpověď

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...

Avatar
Zrušit
Autor

Thanks ayman

Related Posts Odpovědi Zobrazení Aktivita
5
kvě 22
25947
0
úno 18
5305
2
zář 23
12937
1
čvc 20
3530
2
zář 19
18782