Skip to Content
Menu
This question has been flagged

Hi !
I've looked at few messages about this topic but no one has the same objective/solution.

I want to create an automated action to "click" on the sale order button "send by email" aka method action_quotation_send

I've tried many ways  based on previous experience that worked on similar case :
I've created an automated action triggered on creation :
- 1 :
record.action_quotation_send()

-2:

for rec in record:

  if rec.state == "draft":

        rec.action_quotation_send()

     also tried  : action = rec.action_quotation_send()

 

-3:

records.action_confirm()


I've successfuly done something similar ton confirm sale ordrer ( action_confirm() ) but not succeded to this one....


thanks,

Avatar
Discard
Best Answer

Hello florent

Base on your comments when you call automated action it will be clicked send by email button 

--> on that button click wizard(a popup will open)

So, you have to click that send button from wizard then it will work.

Thanks

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

Avatar
Discard

I don't think a wizard will open from that automated action

Jainesh,

How do I click second button by python code?
could you please give an example of the code?

Best regards,

Best Answer

Action Quotation send isn't working because that method doesn't actually send email to the customer but returns a widget with the values rendered necessary to compose the email. Then when you press on the "Send" button in that wizard then only your email gets sent. In order to send that email, you'll need to use the values returned by the method and then call send method from there.


The following snippet is of automated action to send email


The following snippet is of automated action to update stage


The following snippet is of calling multiple actions at once



Try it and let me know.

Thanks and Regards,

Divyansh

Avatar
Discard
Author

Hi both,

So I'v tried using a multiple action that :

- 1st : send email

- 2nd : execute python code to change 'state' to 'sent'

But the 2nd doesn't work I got a message "A quotation can't be modified if not in "draft" '.

Is there is another "ghost" state before "Draft" ?

Hey,

First of all, Draft is the first stage, there's no ghost stage before that.

Second why are you trying to use the python code to update the stage, in the "Actions to do" field just select the option of "Update the record", the in the fields to update table in the bottom, just select the field , in your case it would be "State" and for value write "sent".

Third, In order to fire the automated actions you created, create on more automated action, and in it's "Action To do" field just select the option of "Execute Several Actions", in the bottom an Actions table will appear and in that table select both your actions, it'll all work.

Thanks and Regards,

Divyansh

Author

Hi !

Strange, I've posted another comment wich is not published !?

In fact I tried the multiple action 1st send the email, 2nd update the record to 'sent' but nothing more.

I have an error message telling that it's not possible to update a sale order that is not in 'draft'.......

If I did the action I want in a module it's ok I'm able to change state to 'sent' but not in automated action.

I'll post another answer with screenshots of automated actions that I tried on my local which is workingn because I can't post screenshot in comments

I updated my answer please check

Author

Hi !

Following your update :

That's what I did, but I got this message when I ADD PRODUCT in cart before confirming order !! ? (the reason of my question about "ghost") :

"

Oops! Something went wrong.

Take a look at the error message below.

Message d'erreur :

Il est interdit de modifier un bon de commande qui n'est pas en l'étape Brouillon. "

Wich means its forbidden to change state of a sale order that's not in draft !

thanks a lot

all the scenarios u said are working for me, not sure what issue are u facing now....

Author

Hum ! Not my day ! I'll investigate further so.....

Thanks a lot !

Why do you delay the state update for 1 min ?

divyansht40@gmail.com you can drop me an email if u need further help and you've trouble asking here

Author Best Answer

Hi both,

So I'v tried using a multiple action that :
- 1st  : send email
- 2nd : execute python code to change 'state' to 'sent'

But the 2nd doesn't work I got a message "A quotation can't be modified if not in "draft" '.
Is there is another "ghost" state before "Draft" ?

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 24
935
0
Sep 21
782
0
Jun 24
220
1
Jun 22
1296
0
Mar 22
791