Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1702 Näkymät

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
maalisk. 24
7038
3
kesäk. 25
2398
0
toukok. 24
1610
1
maalisk. 24
1502
1
tammik. 24
1459