Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

[RESOLVED] Force the customer to have at least one product inside quotations

By
Selverine
on 1/25/16, 12:54 PM 430 views

Hi all,


I would like to know how to force the customer to have at least one product inside quotations.

With this, they will not be able to save the quotation ( so create a new line in the database) if there is no product.

I was thinking to add only required=true for the order_line but it is not working.


Someone has an idea?


-----EDIT SOLUTION----

It is working with this solution inside the create function:

def create(self, cr, uid, vals, context=None):

context = context or {}

if not vals['order_line']:

raise osv.except_osv(_('Error!'),_('You cannot confirm a Quotation which has no line.'))


Many thanks,


Selverine



1

Axel Mendoza

--Axel Mendoza--
10205
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 1/25/16, 1:53 PM

One way is using a python constraint in the model to check the number of order lines in the sale.order

0
Selverine
On 1/26/16, 6:58 AM

Ok, but where and how to do it?

And why required=true is not working for this field? It's because it is a OnetoMany?


Many thanks,


Selverine

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/25/16, 12:54 PM
Seen: 430 times
Last updated: 1/26/16, 9:32 AM