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

Ghost arguments in the function definition

By
Keywoker
on 11/11/14, 12:42 AM 731 views

I'm learning Rental Module for v7 and there is the function definition with "strange arguments" like these:

def _prepare_order_line_procurement(
            self, cr, uid, order, line, move_id, date_planned, context=None): ....

It's ok, but then the sentence

res = super(sale_order, self)._prepare_order_line_procurement(
            cr, uid, order, line, move_id, date_planned, context=context)

is coming.

Could anybody explain to me, if there is no setting value for these arguments - how can it work?

0
shashank verma
On 11/11/14, 1:50 AM

Hello Vladislav,

super(sale_order, self)._prepare_order_line_procurement(
            cr, uid, order, line, move_id, date_planned, context=context)

This statement is called special kind of overding in Inheritence concept.

 

Lets take a  simple example -

class Parent():
    def my_function(self,a,b):
        print 'Hi iam parent class'
       

class Child(Parent):
    def my_function(self,a,b):
        print 'Hi iam child class version 1'
        super(Child,self).my_function(a,b)
        print 'Hi iam child class version 2'


##create instance

obj=Child()
obj.my_function(1,2)

#output

'Hi iam child class version 1'
'Hi iam parent class'
'Hi iam child class version 2'

In your case you can find parent class function _prepare_order_line_procurement  in sale_stock module at line:292

Thanks

Thank you so much, shashank verma. I had the same idea but wasn't sure.

Keywoker
on 11/11/14, 3:10 AM

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: 11/11/14, 12:42 AM
Seen: 731 times
Last updated: 3/16/15, 8:10 AM