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.

0

How to add products to quotation template without product name?

By
Yenthe
on 9/22/14, 2:46 AM 1,290 views

Hi guys

Today I'm trying to build my own Odoo templates but I'm stuck on one thing.
I've started from the Quotation template code but I soon ran into some problems. With the Quotations template you can't make any productlines without a product name.
So now I'm wondering how I could add a product without a name. (in other words, unreferenced to a product)

Without using my Quotations template I can do this:
http://i.imgur.com/GvicVk9.png

But with the Quotation template I have to fill in a name. See this:
http://i.imgur.com/Od6pzMe.png

This is my code:
        template = self.browse(cr, uid, template)
        order_lines = template.order_line
        for line in order_lines: 
            vals = line_obj.product_id_change(cr, uid, [],
                pricelist = pricelist_id,
                product = line.product_id and line.product_id.id or False,
                qty = 0.0,
                uom = False,
                qty_uos = 0.0,
                uos = False,
                name = '',
                partner_id = partner_id,
                lang = False,
                update_tax = True,
                date_order = False,
                packaging = False,
                fiscal_position = fiscal_position,
                flag = False)
            vals['value']['discount'] = line.discount
            vals['value']['product_id'] = line.product_id and line.product_id.id or False
            name = line.name
            if name == "" or len(name) <= 0:
                vals['value']['name'] = "Unreferenced Products"
            else:
                vals['value']['name'] = line.name
            vals['value']['state'] = 'draft'
            vals['value']['product_uom_qty'] = line.product_uom_qty
            vals['value']['product_uom'] = line.product_uom and line.product_uom.id or False
            vals['value']['price_unit'] = line.price_unit
            vals['value']['tax_id'] = [(6, 0, [x.id for x in line.tax_id])]
            lines.append(vals['value'])
        result['order_line'] = lines

 

Could anybody please tell me how I could add lines to the templates / quotations without needing to supply anything in the field 'Product'?

Any information or help is much appreciated!
Yenthe

0
Marek Mosiewicz
On 9/22/14, 4:41 AM

Quotation is in fact order, so it is risky ro remove referential constraint on it, but you could try to remove it from order and then you can not fill it. I think better would be to create some special product like "quotation" and use it there with different description.

Best regards,

    Consultant Odoo

So your advise would be to not do this and make a product which you then can choose by default for this? By the way, if it is risky for referential constrains.. why is it then allowed on a quotation for example?

Yenthe
on 9/22/14, 5:08 AM

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: 9/22/14, 2:46 AM
Seen: 1290 times
Last updated: 3/16/15, 8:10 AM