تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7235 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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?

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 15
6096
1
يوليو 23
2306
4
نوفمبر 20
6453
1
مارس 19
3236
1
مارس 15
13288