Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
609 Vistas

I've create a new value for state field in sale order named signed using custom module 

I want the system to change the state to signed state not sale order state when the sale order is confirmed

Avatar
Descartar
Mejor respuesta

Hi,

If you need to change the state to "signed" when clicking the confirm button, you can achieve it by inheriting the sale.order model and modifying the action_confirm function. Here's an example:

def action_confirm(self):
    # Change the state to 'signed'
    self.state = 'signed'
The above code will alter the behavior of the confirm button by setting the state to "signed" when it's clicked. However, if you want to maintain the previous functionalities of the confirm button in addition to changing the state, you should call the parent class's action_confirm method using super() and then set the state. Here's how you can do that:

def action_confirm(self):
    # Call the parent class's action_confirm method
    res = super().action_confirm()
   
    # Change the state to 'signed'
    self.state = 'signed'
   
    return res
With this code, you both maintain the previous confirm button functionality and set the state to "signed" afterward.


Hope it helps

Avatar
Descartar
Mejor respuesta

Hi,

Inherit  the function of button confirm order​ and change the value of the state field to signed.

Avatar
Descartar