Because saving an order where an order_line has an email campaign set shouldn't be possible if the partner doesn't have an email address set. How can I validate that?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
You should be able to relate back fron an order line to any of the following 3:
- The partner in question
- The pricelist
- The sale order on which this line is created
If you have any of the three, write a method on the partner object to check for an email. Then, in your order line, overwrite the on_change method for product_id on you sale order line, where you could check for a certain product for the email campaign. Then validate against the information about the partner (has email yes/no?) and provide the user with a usefull error (You selected a campaign but partner %s has no email set) and leave the product_id blanc.