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 inherit on_change method

By
Chirag Patel
on 3/20/16, 2:54 AM 407 views

i am trying to inherit product_id_change_with_wh method in sale_order_line object but it not override by my custom method

can you paste your code ?

Ahmed M.Elmubarak
on 3/20/16, 5:28 AM

class sale_order_line(osv.osv): _inherit = 'sale.order.line' def product_id_change_with_wh(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, warehouse_id=False, context=None): print "================= inheriteed on_change method =============" I tried this but this method not called and orignal method is call

Chirag Patel
on 3/20/16, 5:48 AM

Yes i already checked that but therfor its not working

Chirag Patel
on 3/20/16, 10:03 AM
0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 3/20/16, 9:12 AM

Hi,

It seems Ok ..

Just check these:

 - in __openerp__.py you depends on 'sale_stock' module.

-  in the __init__.py you added your .py file ..

 - Restart the server and upgrade your custom module ...

Hope this will help


0
Chirag Patel
On 3/20/16, 5:52 AM

class sale_order_line(osv.osv):

_inherit = 'sale.order.line'

def product_id_change_with_wh(self, cr, uid, ids, pricelist, product, qty=0,

uom=False, qty_uos=0, uos=False, name='', partner_id=False,

lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False,

flag=False, warehouse_id=False, context=None):

print "================= inheriteed on_change method ============="



i have tried this but my custom method is not called only orginal method is called

0

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 3/20/16, 10:45 AM

Hello Chirag Patel,

Please refer below code, May be help for you.

Solution-1:

@api.v7

def onchange_partner_id((self, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):

#payment_method = res.partner.payment_method

#payment_method = ['test','TEST!']

return super(account_invoice, self).onchange_partner_id((type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False)


Solution-2:

@api.multi

def onchange_partner_id(self, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):

#payment_method = res.partner.payment_method

#payment_method = ['test','TEST!']

return super(account_invoice, self).onchange_partner_id(type, partner_id, date_invoice=date_invoice, payment_term=payment_term, partner_bank_id=partner_bank_id, company_id=company_id)

Cheers,

Ankit H Gandhi

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/20/16, 2:54 AM
Seen: 407 times
Last updated: 3/20/16, 12:24 PM