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?
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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/31/14, 9:35 AM|
|Seen: 463 times|
|Last updated: 3/16/15, 8:10 AM|