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.
I am having some difficulty with this, i am trying to get the description from the sales order per product line on the delivery note:
The delivery note calls the following function:
def get_product_desc(self,move_line): desc = move_line.product_id.name if move_line.product_id.default_code: desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc return desc
I would have thought that just adding + move_line.product_id.XXX and creating a field in the move line names xxx would have done it? But I cannot for the life of me figure out how to add the field to the move_line ?
Your help would be appreciated
I do not know where do you use the function but if you want to return the
description of the
sale.order.line then you can use:
def get_product_desc(self,move_line): if move_line.sale_line_id: return move_line.sale_line_id.name return False
I assume that
move_line is not only the id, but a whole object.
def get_product_desc(self,move_line): product_product = self.pool.get('product.product') product = product_product.browse(cr, uid, move_line.product_id, context=context_partner) # desc = move_line.product_id.name desc = product.name if product.default_code: desc = '[' + product.default_code + ']' + ' ' + desc return desc
again the move_line is passed from the picking.py and called in the report, i still think I would need to add the description into the move_line
Still stuck but thanks
product_id just holds the identifier for the product, no more details.
you have to do something more like this:
def get_product_desc(self,product_id): product_product = self.pool.get('product.product') product = product_product.browse(cr, uid, product_id, context=context_partner) desc = product.name if product.default_code: desc = '[' + product.default_code + ']' + ' ' + desc return desc
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: 3/21/13, 3:58 PM|
|Seen: 2466 times|
|Last updated: 3/16/15, 8:10 AM|