Passa al contenuto
Menu
La domanda è stata contrassegnata
1 Rispondi
1523 Visualizzazioni


Hi,

How to create automatic actions to cancel expired quotations. because currently odoo v14 not cancel expired quotations. 

Avatar
Abbandona
Risposta migliore

You can create an automatic action in Odoo v14 to cancel expired quotations by following these steps:

  1. Go to the Odoo sales module and click on the "Automatic Actions" menu.
  2. Click the "Create" button to create a new automatic action.
  3. Give your automatic action a name, such as "Cancel Expired Quotations".
  4. Set the object type to "Quotation" and set the domain to filter for quotations that are in the "Quotation Sent" state and have an expiration date that is in the past. You can do this by setting the domain like this:
[('state', '=', 'sent'), ('validity_date', ', fields.Date.today())]

This will filter for quotations that are in the "Quotation Sent" state and have a validity date that is less than the current date.

  1. Set the action type to "Python Code".
  2. In the "Python Code" field, enter the following code to cancel the expired quotations:
for quotation in records:
    quotation.action_cancel()

This code loops through all the records that match the domain (i.e., the expired quotations) and calls the "action_cancel" method on each one to cancel the quotation.

  1. Save the automated action.

Now, whenever a quotation with an expiration date in the past is in the "Quotation Sent" state, the automatic action will cancel it automatically. You can also set the frequency of the automatic action to run at a specific interval, such as daily or hourly, so that expired quotations are automatically canceled without any manual intervention.


Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 25
1096
2
gen 25
1700
2
gen 25
2401
0
set 24
1159
0
giu 24
1164