Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1746 Представления

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)

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


Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мар. 24
7143
3
июн. 25
2437
0
мая 24
1628
1
мар. 24
1539
1
янв. 24
1470