Odoo Help


How to solve "AttributeError: 'sale.order.line' object has no attribute 'product'"

on 3/3/16, 3:44 AM 1,636 views

Hi, I have to migrate a custom module from V8 to V9 but I have a problem with a medod:

When i'm on a quotation (sales) and i wanna add an item on the sale order line, I've this error :

File "/usr/local/lib/python2.7/dist-packages/odoo-9.0c-py2.7.egg/openerp/addons/WIPv9/sale.py", line 110, in product_id_change if self.product: AttributeError: 'sale.order.line' object has no attribute 'product'

This is the begining of the code (sale.py) where the error comes from :

  1. class sale_order_line(models.Model):
  2.     _inherit = 'sale.order.line'

  3.     @api.multi
  4.     @api.onchange('product_id')
  5.     def product_id_change(self):
  6.         result = super(sale_order_line, self).product_id_change()
  7.         if self.product:

The problem is the 7th line and i have to write it otherwise . Thanks in advance.

I can't edit, wanna say 8th line instead 7th

on 3/3/16, 3:46 AM
On 3/3/16, 4:42 AM

Apparently, it's :

if self.product_id:

rather than :

if self.product:

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/3/16, 3:44 AM
Seen: 1636 times
Last updated: 3/3/16, 4:43 AM