Se rendre au contenu
Menu
Cette question a été signalée
1712 Vues

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
Ignorer
Publications associées Réponses Vues Activité
2
mars 24
7060
3
juin 25
2410
0
mai 24
1618
1
mars 24
1511
1
janv. 24
1459