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 solve "AttributeError: 'sale.order.line' object has no attribute 'product'"

By
Tatorus
on 3/3/16, 3:44 AM 677 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

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

Apparently, it's :

if self.product_id:

rather than :

if self.product:

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: 3/3/16, 3:44 AM
Seen: 677 times
Last updated: 3/3/16, 4:43 AM