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 | etc.
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:
But with the Quotation template I have to fill in a name. See this:
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"
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])]
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!
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.
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/22/14, 2:46 AM|
|Seen: 1414 times|
|Last updated: 3/16/15, 8:10 AM|