Skip to Content
Menu
This question has been flagged
1429 Views

I have set an Automated Acton to execute the following python to falg an error when certain fields aren;t completed when the order is being confirmed.  

The issue is not that for some reason it also now flags the error when an invoice is being created or a new customer is being created (Even though the fields are filled in and even though it should only be applicable to the sales module)

Can anyone assist?


---
missing_fields = []


if not record.x_studio_delivery_date:

missing_fields.append("Delivery Date (The date the customer gets on their paperwork)")


if not record.x_studio_date_for_supplier:

missing_fields.append("Date For Supplier (Date for ops To ask supplier to achieve)")


if not record.client_order_ref:

missing_fields.append("Purchase Order (To ensure fast payment of invoices)") 


if not record.x_studio_field_FgkKF:

missing_fields.append("Approved Supplier (If not an existing approved supplier, please follow onboarding process)") 


if record.state == 'sale' and missing_fields:

error_msg = "Please fill in the following fields before confirming the order:\n\n"

error_msg += "- " + "\n- ".join(missing_fields)

raise UserError(error_msg)

-------------------


Avatar
Discard
Related Posts Replies Views Activity
2
Mar 24
6513
1
Apr 25
1674
0
May 24
1159
1
Mar 24
1044
1
Jan 24
1022