Skip to Content
Menu
This question has been flagged
3 Replies
2186 Views

Hi, everyone!


Two Error Dialog will pop up when I create Sale Orders (sale.order) on my Odoo 10 service

No. 1

-----

ValueError: <type 'exceptions.NameError'>: "name 'self' is not defined" while evaluating u'

sale_obj = self.pool[\'sale.order.line\']

sale_list = sale_obj.search(cr,uid,[(\'order_id\',\'=\',object.name)],context=context)

if sale_list:

    for line in sale_list:

        product_type = sale_obj.browse(cr,uid,line).product_id.type

        if product_type != \'service\':

            product_uom_qty = sale_obj.browse(cr,uid,line).product_uom_qty

            qty_delivered = sale_obj.browse(cr,uid,line).qty_delivered

            if product_uom_qty != qty_delivered:

                self.write(cr, uid, object.id, {"x_stock":\'1\'}, context=context)

                break

            else:

                self.write(cr, uid, object.id, {"x_stock":\'2\'}, context=context)

        else:

            self.write(cr, uid, object.id, {"x_stock":\'2\'}, context=context)

else:

     self.write(cr, uid, object.id, {"x_stock":\'3\'}, context=context)

'

No. 2

-----

ValueError: <type 'exceptions.NameError'>: "name 'self' is not defined" while evaluating u"

product_type = object.product_id.type self.write(cr,uid,object.id,({'x_type':product_type}),context=context)

"


"x_stock" is a custom field in model "sale.order". Meanwhile, "x_type" is a custom field in model "sale.order.line".

These two block of python code which following "ValueError" didn't find in the source code of Odoo 10. So, these codes have been stored in PostgreSQL?

Are there anyone can give me some advises to fix it?

Avatar
Discard

do you have sale_order in your module dependency ?

Author

I didn't find the module which Technical Name is "sale_order" in the addons folder. However, there is a similar one which Name is "sale_order_dates". The issue should be fixed if I install it?

Author Best Answer

I figured out it.

These Python code was set on the "Settings - Technical - Actions - Server Actions" page.

It's not a good place to edit Python Code. So, I have to move their to my module by hand.

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
31
1
Dec 24
70
0
Nov 24
53
0
Nov 24
65
1
Oct 24
171