Skip to Content
Menu
This question has been flagged
1 Reply
1522 Views


Hi,

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

Avatar
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
1
Apr 25
1094
2
Jan 25
1696
2
Jan 25
2400
0
Sep 24
1158
0
Jun 24
1163